From 09ba42a2c1240f14e83e9258c3a265d0084eadc7 Mon Sep 17 00:00:00 2001 From: corinna Date: Mon, 18 Aug 2008 12:56:59 +0000 Subject: [PATCH] * mkgroup.c (enum_local_groups): Use NetLocalGroupGetInfo to find out if a group exists, rather than just allocating a buffer and going ahead. --- winsup/utils/ChangeLog | 5 +++++ winsup/utils/mkgroup.c | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index 7cd59bff81..6917ab58d4 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,5 +1,10 @@ 2008-08-18 Corinna Vinschen + * 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 + * mkgroup.c (enum_local_groups): Call print_win_error with GetLastError as argument when LookupAccountXXX failed. (enum_groups): Ditto. diff --git a/winsup/utils/mkgroup.c b/winsup/utils/mkgroup.c index 6854f09d1a..700363ee99 100644 --- a/winsup/utils/mkgroup.c +++ b/winsup/utils/mkgroup.c @@ -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, -- 2.11.0