]> sourceware.org Git - newlib-cygwin.git/blobdiff - winsup/utils/mkpasswd.c
Cygwin: add 3.2.1 release file and add fixes up to this point
[newlib-cygwin.git] / winsup / utils / mkpasswd.c
index 3f33496aab1c7b493258a31569c0bd98dd6e05c9..3bbdb1c71033da91808900ba01a9cf2e8db7a3a5 100644 (file)
@@ -6,7 +6,7 @@
    Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
    details. */
 
-#define _WIN32_WINNT 0x0600
+#define _WIN32_WINNT 0x0a00
 #include <errno.h>
 #include <ctype.h>
 #include <stdlib.h>
@@ -312,10 +312,12 @@ enum_users (domlist_t *mach, const char *sep, const char *passed_home_path,
          else if (acc_type == SidTypeDomain)
            {
              WCHAR domname[MAX_DOMAIN_NAME_LEN + UNLEN + 2];
+             PWCHAR p;
 
-             wcscpy (domname, machine);
-             wcscat (domname, L"\\");
-             wcscat (domname, buffer[i].usri3_name);
+             p = wcpcpy (domname, machine);
+             p = wcpcpy (p, L"\\");
+             p = wcpncpy (p, buffer[i].usri3_name, UNLEN);
+             *p = L'\0';
              sid_length = SECURITY_MAX_SID_SIZE;
              domname_len = sizeof (domname);
              if (!LookupAccountNameW (machine, domname, psid,
@@ -356,7 +358,7 @@ enum_users (domlist_t *mach, const char *sep, const char *passed_home_path,
   return 0;
 }
 
-static int
+static int __attribute__ ((__noreturn__))
 usage (FILE * stream)
 {
   fprintf (stream,
@@ -397,7 +399,7 @@ usage (FILE * stream)
 "on domain controllers and domain member machines.\n"
 "\n", program_invocation_short_name,
       (const char *) cygwin_internal (CW_GETNSSSEP));
-  return 1;
+  exit (stream == stdout ? 0 : 1);
 }
 
 static struct option longopts[] = {
@@ -604,7 +606,6 @@ main (int argc, char **argv)
        break;
       case 'h':
        usage (stdout);
-       return 0;
       case 'V':
        print_version ();
        return 0;
This page took 0.025663 seconds and 5 git commands to generate.