OSDN Git Service

* mkgroup.c (enum_local_groups): Use NetLocalGroupGetInfo to find out
authorcorinna <corinna>
Mon, 18 Aug 2008 12:56:59 +0000 (12:56 +0000)
committercorinna <corinna>
Mon, 18 Aug 2008 12:56:59 +0000 (12:56 +0000)
if a group exists, rather than just allocating a buffer and going ahead.

winsup/utils/ChangeLog
winsup/utils/mkgroup.c

index 7cd59bf..6917ab5 100644 (file)
@@ -1,5 +1,10 @@
 2008-08-18  Corinna Vinschen  <corinna@vinschen.de>
 
+       * mkgroup.c (enum_local_groups): Use NetLocalGroupGetInfo to find out
+       if a group exists, rather than just allocating a buffer and going ahead.
+
+2008-08-18  Corinna Vinschen  <corinna@vinschen.de>
+
        * mkgroup.c (enum_local_groups): Call print_win_error with GetLastError
        as argument when LookupAccountXXX failed.
        (enum_groups): Ditto.
index 6854f09..700363e 100644 (file)
@@ -348,10 +348,9 @@ enum_local_groups (BOOL domain, domlist_t *dom_or_machine, const char *sep,
       if (disp_groupname != NULL)
        {
          mbstowcs (gname, disp_groupname, GNLEN + 1);
-         rc = NetApiBufferAllocate (sizeof (LOCALGROUP_INFO_0),
-                                    (void *) &buffer);
-         buffer[0].lgrpi0_name = gname;
-         entriesread = 1;
+         rc = NetLocalGroupGetInfo (servername, gname, 0, (void *) &buffer);
+         if (rc == ERROR_SUCCESS)
+           entriesread = 1;
        }
       else
        rc = NetLocalGroupEnum (servername, 0, (void *) &buffer,