3 Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006,
6 This file is part of Cygwin.
8 This software is a copyrighted work licensed under the terms of the
9 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
12 #define _WIN32_WINNT 0x0600
21 #include <sys/fcntl.h>
22 #include <sys/cygwin.h>
31 #define print_win_error(x) _print_win_error(x, __LINE__)
33 #define MAX_SID_LEN 40
35 static const char version
[] = "$Revision$";
37 extern char *__progname
;
39 SID_IDENTIFIER_AUTHORITY sid_world_auth
= {SECURITY_WORLD_SID_AUTHORITY
};
40 SID_IDENTIFIER_AUTHORITY sid_nt_auth
= {SECURITY_NT_AUTHORITY
};
42 NET_API_STATUS
WINAPI (*dsgetdcname
)(LPWSTR
,LPWSTR
,GUID
*,LPWSTR
,ULONG
,PDOMAIN_CONTROLLER_INFOW
*);
45 #define min(a,b) (((a)<(b))?(a):(b))
57 _print_win_error(DWORD code
, int line
)
61 if (FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM
62 | FORMAT_MESSAGE_IGNORE_INSERTS
,
65 MAKELANGID (LANG_NEUTRAL
, SUBLANG_DEFAULT
),
66 (LPTSTR
) buf
, sizeof (buf
), NULL
))
67 fprintf (stderr
, "mkpasswd (%d): [%lu] %s", line
, code
, buf
);
69 fprintf (stderr
, "mkpasswd (%d): error %lu", line
, code
);
75 HANDLE h
= LoadLibrary ("netapi32.dll");
78 dsgetdcname
= (void *) GetProcAddress (h
, "DsGetDcNameW");
82 get_dcname (char *domain
)
84 static WCHAR server
[INTERNET_MAX_HOST_NAME_LENGTH
+ 1];
87 WCHAR domain_name
[MAX_DOMAIN_NAME_LEN
+ 1];
88 PDOMAIN_CONTROLLER_INFOW pdci
= NULL
;
94 mbstowcs (domain_name
, domain
, strlen (domain
) + 1);
95 rc
= dsgetdcname (NULL
, domain_name
, NULL
, NULL
, 0, &pdci
);
98 rc
= dsgetdcname (NULL
, NULL
, NULL
, NULL
, 0, &pdci
);
99 if (rc
!= ERROR_SUCCESS
)
104 wcscpy (server
, pdci
->DomainControllerName
);
105 NetApiBufferFree (pdci
);
109 rc
= NetGetDCName (NULL
, NULL
, (void *) &servername
);
110 if (rc
== ERROR_SUCCESS
&& domain
)
112 LPWSTR server
= servername
;
113 mbstowcs (domain_name
, domain
, strlen (domain
) + 1);
114 rc
= NetGetDCName (server
, domain_name
, (void *) &servername
);
115 NetApiBufferFree (server
);
117 if (rc
!= ERROR_SUCCESS
)
122 wcscpy (server
, servername
);
123 NetApiBufferFree ((PVOID
) servername
);
136 sprintf(t
, "%u", GetSidIdentifierAuthority (sid
)->Value
[5]);
138 for (i
= 0; i
< *GetSidSubAuthorityCount (sid
); ++i
)
140 sprintf(t
, "-%lu", *GetSidSubAuthority (sid
, i
));
147 psx_dir (char *in
, char *out
)
149 if (isalpha (in
[0]) && in
[1] == ':')
151 sprintf (out
, "/cygdrive/%c", in
[0]);
170 uni2ansi (LPWSTR wcs
, char *mbs
, int size
)
173 wcstombs (mbs
, wcs
, size
);
183 static sidbuf curr_user
;
184 static sidbuf curr_pgrp
;
185 static BOOL got_curr_user
= FALSE
;
188 fetch_current_user_sid ()
193 if (!OpenProcessToken (GetCurrentProcess (), TOKEN_QUERY
, &ptok
)
194 || !GetTokenInformation (ptok
, TokenUser
, &curr_user
, sizeof curr_user
,
196 || !GetTokenInformation (ptok
, TokenPrimaryGroup
, &curr_pgrp
,
197 sizeof curr_pgrp
, &len
)
198 || !CloseHandle (ptok
))
200 print_win_error (GetLastError ());
206 current_user (int print_cygpath
, const char *sep
, const char *passed_home_path
,
207 DWORD id_offset
, const char *disp_username
)
209 WCHAR user
[UNLEN
+ 1];
210 WCHAR dom
[MAX_DOMAIN_NAME_LEN
+ 1];
211 DWORD ulen
= UNLEN
+ 1;
212 DWORD dlen
= MAX_DOMAIN_NAME_LEN
+ 1;
213 SID_NAME_USE acc_type
;
215 char homedir_psx
[PATH_MAX
] = {0}, homedir_w32
[MAX_PATH
] = {0};
217 if (!curr_user
.psid
|| !curr_pgrp
.psid
218 || !LookupAccountSidW (NULL
, curr_user
.psid
, user
, &ulen
, dom
, &dlen
,
221 print_win_error (GetLastError ());
225 uid
= *GetSidSubAuthority (curr_user
.psid
,
226 *GetSidSubAuthorityCount(curr_user
.psid
) - 1);
227 gid
= *GetSidSubAuthority (curr_pgrp
.psid
,
228 *GetSidSubAuthorityCount(curr_pgrp
.psid
) - 1);
229 if (passed_home_path
[0] == '\0')
231 char *envhome
= getenv ("HOME");
232 char *envhomedrive
= getenv ("HOMEDRIVE");
233 char *envhomepath
= getenv ("HOMEPATH");
235 if (envhome
&& envhome
[0])
238 cygwin_conv_path (CCP_WIN_A_TO_POSIX
| CCP_ABSOLUTE
, envhome
,
239 homedir_psx
, PATH_MAX
);
241 psx_dir (envhome
, homedir_psx
);
243 else if (envhomepath
&& envhomepath
[0])
246 strlcpy (homedir_w32
, envhomedrive
, sizeof (homedir_w32
));
247 if (envhomepath
[0] != '\\')
248 strlcat (homedir_w32
, "\\", sizeof (homedir_w32
));
249 strlcat (homedir_w32
, envhomepath
, sizeof (homedir_w32
));
251 cygwin_conv_path (CCP_WIN_A_TO_POSIX
| CCP_ABSOLUTE
, homedir_w32
,
252 homedir_psx
, PATH_MAX
);
254 psx_dir (homedir_w32
, homedir_psx
);
258 wcstombs (stpncpy (homedir_psx
, "/home/", sizeof (homedir_psx
)),
259 user
, sizeof (homedir_psx
) - 6);
260 homedir_psx
[PATH_MAX
- 1] = '\0';
265 char *p
= stpncpy (homedir_psx
, passed_home_path
, sizeof (homedir_psx
));
266 wcstombs (p
, user
, sizeof (homedir_psx
) - (p
- homedir_psx
));
267 homedir_psx
[PATH_MAX
- 1] = '\0';
270 printf ("%ls%s%ls:unused:%lu:%lu:U-%ls\\%ls,%s:%s:/bin/bash\n",
278 put_sid (curr_user
.psid
),
283 enum_unix_users (domlist_t
*dom_or_machine
, const char *sep
, DWORD id_offset
,
284 char *unix_user_list
)
286 WCHAR machine
[INTERNET_MAX_HOST_NAME_LENGTH
+ 1];
287 PWCHAR servername
= NULL
;
288 char *d_or_m
= dom_or_machine
? dom_or_machine
->str
: NULL
;
289 BOOL with_dom
= dom_or_machine
? dom_or_machine
->with_dom
: FALSE
;
290 SID_IDENTIFIER_AUTHORITY auth
= { { 0, 0, 0, 0, 0, 22 } };
291 char *ustr
, *user_list
;
292 WCHAR user
[UNLEN
+ sizeof ("Unix User\\") + 1];
293 WCHAR dom
[MAX_DOMAIN_NAME_LEN
+ 1];
294 DWORD ulen
, dlen
, sidlen
;
296 char psid_buffer
[MAX_SID_LEN
];
297 SID_NAME_USE acc_type
;
302 int ret
= mbstowcs (machine
, d_or_m
, INTERNET_MAX_HOST_NAME_LENGTH
+ 1);
303 if (ret
< 1 || ret
>= INTERNET_MAX_HOST_NAME_LENGTH
+ 1)
305 fprintf (stderr
, "%s: Invalid machine name '%s'. Skipping...\n",
309 servername
= machine
;
311 if (!AllocateAndInitializeSid (&auth
, 2, 1, 0, 0, 0, 0, 0, 0, 0, &psid
))
314 if (!(user_list
= strdup (unix_user_list
)))
320 for (ustr
= strtok (user_list
, ","); ustr
; ustr
= strtok (NULL
, ","))
322 if (!isdigit (ustr
[0]) && ustr
[0] != '-')
324 PWCHAR p
= wcpcpy (user
, L
"Unix User\\");
325 ret
= mbstowcs (p
, ustr
, UNLEN
+ 1);
326 if (ret
< 1 || ret
>= UNLEN
+ 1)
327 fprintf (stderr
, "%s: Invalid user name '%s'. Skipping...\n",
329 else if (LookupAccountNameW (servername
, user
,
330 psid
= (PSID
) psid_buffer
,
331 (sidlen
= MAX_SID_LEN
, &sidlen
),
333 (dlen
= MAX_DOMAIN_NAME_LEN
+ 1, &dlen
),
335 printf ("%s%s%ls:unused:%lu:99999:,%s::\n",
336 with_dom
? "Unix User" : "",
340 *GetSidSubAuthority (psid
,
341 *GetSidSubAuthorityCount(psid
) - 1),
351 start
= strtol (p
, &p
, 10);
354 else if (*p
++ != '-' || !isdigit (*p
)
355 || (stop
= strtol (p
, &p
, 10)) < start
|| *p
)
357 fprintf (stderr
, "%s: Malformed unix user list entry '%s'. "
358 "Skipping...\n", __progname
, ustr
);
361 for (; start
<= stop
; ++ start
)
363 *GetSidSubAuthority (psid
, *GetSidSubAuthorityCount(psid
) - 1)
365 if (LookupAccountSidW (servername
, psid
,
366 user
, (ulen
= GNLEN
+ 1, &ulen
),
368 (dlen
= MAX_DOMAIN_NAME_LEN
+ 1, &dlen
),
370 && !iswdigit (user
[0]))
371 printf ("%s%s%ls:unused:%lu:99999:,%s::\n",
372 with_dom
? "Unix User" : "",
386 enum_users (BOOL domain
, domlist_t
*dom_or_machine
, const char *sep
,
387 int print_cygpath
, const char *passed_home_path
, DWORD id_offset
,
388 char *disp_username
, int print_current
)
390 WCHAR machine
[INTERNET_MAX_HOST_NAME_LENGTH
+ 1];
391 PWCHAR servername
= NULL
;
392 char *d_or_m
= dom_or_machine
? dom_or_machine
->str
: NULL
;
393 BOOL with_dom
= dom_or_machine
? dom_or_machine
->with_dom
: FALSE
;
395 DWORD entriesread
= 0;
396 DWORD totalentries
= 0;
397 DWORD resume_handle
= 0;
399 WCHAR uni_name
[UNLEN
+ 1];
402 servername
= get_dcname (d_or_m
);
403 if (servername
== (PWCHAR
) -1)
408 int ret
= mbstowcs (machine
, d_or_m
, INTERNET_MAX_HOST_NAME_LENGTH
+ 1);
409 if (ret
< 1 || ret
>= INTERNET_MAX_HOST_NAME_LENGTH
+ 1)
411 fprintf (stderr
, "%s: Invalid machine name '%s'. Skipping...\n",
415 servername
= machine
;
422 if (disp_username
!= NULL
)
424 mbstowcs (uni_name
, disp_username
, UNLEN
+ 1);
425 rc
= NetUserGetInfo (servername
, (LPWSTR
) &uni_name
, 3,
430 rc
= NetUserEnum (servername
, 3, FILTER_NORMAL_ACCOUNT
,
431 (void *) &buffer
, MAX_PREFERRED_LENGTH
,
432 &entriesread
, &totalentries
, &resume_handle
);
435 case ERROR_ACCESS_DENIED
:
439 case ERROR_MORE_DATA
:
448 for (i
= 0; i
< entriesread
; i
++)
450 char homedir_psx
[PATH_MAX
];
451 char homedir_w32
[MAX_PATH
];
452 WCHAR domain_name
[MAX_DOMAIN_NAME_LEN
+ 1];
453 DWORD domname_len
= MAX_DOMAIN_NAME_LEN
+ 1;
454 char psid_buffer
[MAX_SID_LEN
];
455 PSID psid
= (PSID
) psid_buffer
;
456 DWORD sid_length
= MAX_SID_LEN
;
457 SID_NAME_USE acc_type
;
459 int uid
= buffer
[i
].usri3_user_id
;
460 int gid
= buffer
[i
].usri3_primary_group_id
;
461 homedir_w32
[0] = homedir_psx
[0] = '\0';
462 if (passed_home_path
[0] == '\0')
464 uni2ansi (buffer
[i
].usri3_home_dir
, homedir_w32
,
465 sizeof (homedir_w32
));
466 if (homedir_w32
[0] != '\0')
469 cygwin_conv_path (CCP_WIN_A_TO_POSIX
| CCP_ABSOLUTE
,
470 homedir_w32
, homedir_psx
, PATH_MAX
);
472 psx_dir (homedir_w32
, homedir_psx
);
475 uni2ansi (buffer
[i
].usri3_name
,
476 stpcpy (homedir_psx
, "/home/"), PATH_MAX
- 6);
479 uni2ansi (buffer
[i
].usri3_name
,
480 stpcpy (homedir_psx
, passed_home_path
),
481 PATH_MAX
- strlen (passed_home_path
));
483 if (!LookupAccountNameW (servername
, buffer
[i
].usri3_name
,
484 psid
, &sid_length
, domain_name
,
485 &domname_len
, &acc_type
))
487 print_win_error(GetLastError ());
488 fprintf(stderr
, " (%ls)\n", buffer
[i
].usri3_name
);
491 else if (acc_type
== SidTypeDomain
)
493 WCHAR domname
[MAX_DOMAIN_NAME_LEN
+ UNLEN
+ 2];
495 wcscpy (domname
, domain
|| !servername
496 ? domain_name
: servername
);
497 wcscat (domname
, L
"\\");
498 wcscat (domname
, buffer
[i
].usri3_name
);
499 sid_length
= MAX_SID_LEN
;
500 domname_len
= sizeof (domname
);
501 if (!LookupAccountNameW (servername
, domname
, psid
,
502 &sid_length
, domain_name
,
503 &domname_len
, &acc_type
))
505 print_win_error(GetLastError ());
506 fprintf(stderr
, " (%ls)\n", domname
);
512 else if (EqualSid (curr_user
.psid
, psid
))
513 got_curr_user
= TRUE
;
517 printf ("%ls%s%ls:unused:%lu:%lu:%ls%sU-%ls\\%ls,%s:%s:/bin/bash\n",
518 with_dom
? domain_name
: L
"",
520 buffer
[i
].usri3_name
,
523 buffer
[i
].usri3_full_name
?: L
"",
524 buffer
[i
].usri3_full_name
525 && buffer
[i
].usri3_full_name
[0] ? "," : "",
527 buffer
[i
].usri3_name
,
532 NetApiBufferFree (buffer
);
535 while (rc
== ERROR_MORE_DATA
);
541 print_special (PSID_IDENTIFIER_AUTHORITY auth
, BYTE cnt
,
542 DWORD sub1
, DWORD sub2
, DWORD sub3
, DWORD sub4
,
543 DWORD sub5
, DWORD sub6
, DWORD sub7
, DWORD sub8
)
545 WCHAR user
[UNLEN
+ 1], dom
[MAX_DOMAIN_NAME_LEN
+ 1];
546 DWORD len
, len2
, rid
;
548 SID_NAME_USE acc_type
;
550 if (AllocateAndInitializeSid (auth
, cnt
, sub1
, sub2
, sub3
, sub4
,
551 sub5
, sub6
, sub7
, sub8
, &sid
))
553 if (LookupAccountSidW (NULL
, sid
,
554 user
, (len
= UNLEN
+ 1, &len
),
555 dom
, (len2
= MAX_DOMAIN_NAME_LEN
+ 1, &len
),
574 printf ("%ls:*:%lu:%lu:,%s::\n",
575 user
, rid
, rid
== 18 ? 544 : rid
, /* SYSTEM hack */
583 usage (FILE * stream
)
586 "Usage: mkpasswd [OPTIONS]...\n"
587 "Print /etc/passwd file to stdout\n"
590 " -l,--local [machine[,offset]]\n"
591 " print local user accounts with uid offset offset\n"
592 " (from local machine if no machine specified)\n"
593 " -L,--Local [machine[,offset]]\n"
594 " ditto, but generate username with machine prefix\n"
595 " -d,--domain [domain[,offset]]\n"
596 " print domain accounts with uid offset offset\n"
597 " (from current domain if no domain specified)\n"
598 " -D,--Domain [domain[,offset]]\n"
599 " ditto, but generate username with domain prefix\n"
600 " -c,--current print current user\n"
601 " -C,--Current ditto, but generate username with machine or\n"
603 " -S,--separator char for -L, -D, -C use character char as domain\\user\n"
604 " separator in username instead of the default '\\'\n"
605 " -o,--id-offset offset change the default offset (10000) added to uids\n"
606 " in domain or foreign server accounts.\n"
607 " -u,--username username only return information for the specified user\n"
608 " one of -l, -L, -d, -D must be specified, too\n"
609 " -p,--path-to-home path use specified path instead of user account home dir\n"
611 " -m,--no-mount don't use mount points for home dir\n"
612 " -U,--unix userlist additionally print UNIX users when using -l or -L\n"
613 " on a UNIX Samba server\n"
614 " userlist is a comma-separated list of usernames\n"
615 " or uid ranges (root,-25,50-100).\n"
616 " (enumerating large ranges can take a long time!)\n"
617 " -s,--no-sids (ignored)\n"
618 " -g,--local-groups (ignored)\n"
619 " -h,--help displays this message\n"
620 " -v,--version version information and exit\n"
622 "Default is to print local accounts on stand-alone machines, domain accounts\n"
623 "on domain controllers and domain member machines.\n");
627 static struct option longopts
[] = {
628 {"current", no_argument
, NULL
, 'c'},
629 {"Current", no_argument
, NULL
, 'C'},
630 {"domain", optional_argument
, NULL
, 'd'},
631 {"Domain", optional_argument
, NULL
, 'D'},
632 {"local-groups", no_argument
, NULL
, 'g'},
633 {"help", no_argument
, NULL
, 'h'},
634 {"local", optional_argument
, NULL
, 'l'},
635 {"Local", optional_argument
, NULL
, 'L'},
636 {"no-mount", no_argument
, NULL
, 'm'},
637 {"id-offset", required_argument
, NULL
, 'o'},
638 {"path-to-home", required_argument
, NULL
, 'p'},
639 {"no-sids", no_argument
, NULL
, 's'},
640 {"separator", required_argument
, NULL
, 'S'},
641 {"username", required_argument
, NULL
, 'u'},
642 {"unix", required_argument
, NULL
, 'U'},
643 {"version", no_argument
, NULL
, 'v'},
644 {0, no_argument
, NULL
, 0}
647 static char opts
[] = "cCd::D::ghl::L::mo:sS:p:u:U:v";
652 const char *v
= strchr (version
, ':');
662 len
= strchr (v
, ' ') - v
;
665 mkpasswd (cygwin) %.*s\n\
666 passwd File Generator\n\
667 Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2008 Red Hat, Inc.\n\
669 ", len
, v
, __DATE__
);
675 /* Generate service starter account entries. */
676 printf ("SYSTEM:*:18:544:,S-1-5-18::\n");
677 printf ("LocalService:*:19:544:U-NT AUTHORITY\\LocalService,S-1-5-19::\n");
678 printf ("NetworkService:*:20:544:U-NT AUTHORITY\\NetworkService,S-1-5-20::\n");
679 /* Get 'administrators' group (has localized name). */
680 print_special (&sid_nt_auth
, 2, SECURITY_BUILTIN_DOMAIN_RID
,
681 DOMAIN_ALIAS_RID_ADMINS
, 0, 0, 0, 0, 0, 0);
684 static PPOLICY_PRIMARY_DOMAIN_INFO p_dom
;
687 fetch_primary_domain ()
690 LSA_OBJECT_ATTRIBUTES oa
= { 0, 0, 0, 0, 0, 0 };
695 status
= LsaOpenPolicy (NULL
, &oa
, POLICY_VIEW_LOCAL_INFORMATION
, &lsa
);
696 if (!NT_SUCCESS (status
))
698 status
= LsaQueryInformationPolicy (lsa
, PolicyPrimaryDomainInformation
,
699 (PVOID
*) ((void *) &p_dom
));
701 if (!NT_SUCCESS (status
))
708 main (int argc
, char **argv
)
710 int print_domlist
= 0;
711 domlist_t domlist
[32];
713 int print_cygpath
= 1;
714 int print_current
= 0;
715 char *print_unix
= NULL
;
716 const char *sep_char
= "\\";
717 DWORD id_offset
= 10000, off
;
719 char *disp_username
= NULL
;
720 char passed_home_path
[PATH_MAX
];
722 int optional_args
= 0;
724 passed_home_path
[0] = '\0';
726 setmode (1, O_BINARY
);
729 in_domain
= fetch_primary_domain ();
730 fetch_current_user_sid ();
734 enum_std_accounts ();
736 enum_users (TRUE
, NULL
, sep_char
, print_cygpath
, passed_home_path
,
737 10000, disp_username
, 0);
739 enum_users (FALSE
, NULL
, sep_char
, print_cygpath
, passed_home_path
, 0,
744 unsetenv ("POSIXLY_CORRECT"); /* To get optional arg processing right. */
745 while ((c
= getopt_long (argc
, argv
, opts
, longopts
, NULL
)) != EOF
)
752 if (print_domlist
>= 32)
754 fprintf (stderr
, "%s: Can not enumerate from more than 32 "
755 "domains and machines.\n", __progname
);
758 domlist
[print_domlist
].domain
= (c
== 'd' || c
== 'D');
760 argv
[optind
] && argv
[optind
][0] != '-' ? argv
[optind
] : NULL
;
761 if (argv
[optind
] && opt
== argv
[optind
])
763 for (i
= 0; i
< print_domlist
; ++i
)
764 if (domlist
[i
].domain
== domlist
[print_domlist
].domain
765 && ((!domlist
[i
].str
&& !opt
)
766 || (domlist
[i
].str
&& opt
767 && (off
= strlen (domlist
[i
].str
))
768 && !strncmp (domlist
[i
].str
, opt
, off
)
769 && (!opt
[off
] || opt
[off
] == ','))))
771 fprintf (stderr
, "%s: Duplicate %s '%s'. Skipping...\n",
772 __progname
, domlist
[i
].domain
? "domain" : "machine",
776 domlist
[print_domlist
].str
= opt
;
777 domlist
[print_domlist
].id_offset
= ULONG_MAX
;
778 if (opt
&& (p
= strchr (opt
, ',')))
782 || (domlist
[print_domlist
].id_offset
= strtol (p
+ 1, &ep
, 10)
785 fprintf (stderr
, "%s: Malformed domain,offset string '%s'. "
786 "Skipping...\n", __progname
, opt
);
791 domlist
[print_domlist
++].with_dom
= (c
== 'D' || c
== 'L');
796 if (strlen (sep_char
) > 1)
798 fprintf (stderr
, "%s: Only one character allowed as domain\\user "
799 "separator character.\n", __progname
);
802 if (*sep_char
== ':')
804 fprintf (stderr
, "%s: Colon not allowed as domain\\user separator "
805 "character.\n", __progname
);
819 id_offset
= strtoul (optarg
, &ep
, 10);
822 fprintf (stderr
, "%s: Malformed offset '%s'. "
823 "Skipping...\n", __progname
, optarg
);
835 if (optarg
[0] != '/')
837 fprintf (stderr
, "%s: '%s' is not a fully qualified path.\n",
841 strcpy (passed_home_path
, optarg
);
842 if (optarg
[strlen (optarg
)-1] != '/')
843 strcat (passed_home_path
, "/");
846 disp_username
= optarg
;
855 fprintf (stderr
, "Try '%s --help' for more information.\n", __progname
);
859 optind
+= optional_args
;
863 "mkpasswd: non-option command line argument `%s' is not allowed.\n"
864 "Try `mkpasswd --help' for more information.\n", argv
[optind
]);
869 for (i
= 0; i
< print_domlist
; ++i
)
871 DWORD my_off
= (domlist
[i
].domain
|| domlist
[i
].str
)
872 ? domlist
[i
].id_offset
!= ULONG_MAX
873 ? domlist
[i
].id_offset
: off
: 0;
874 if (!domlist
[i
].domain
&& domlist
[i
].str
&& print_unix
)
875 enum_unix_users (domlist
+ i
, sep_char
, my_off
, print_unix
);
876 if (!my_off
&& !print_current
&& !disp_username
)
877 enum_std_accounts ();
878 enum_users (domlist
[i
].domain
, domlist
+ i
, sep_char
, print_cygpath
,
879 passed_home_path
, my_off
, disp_username
, print_current
);
884 if (print_current
&& !got_curr_user
)
885 current_user (print_cygpath
, sep_char
, passed_home_path
, off
,