* mkgroup.c (enum_local_groups): Avoid error message if given group
name isn't found and return 0 to allow searching to proceed. Always return 0 or 1, not -1. (enum_groups): Avoid error message if given group name isn't found. * mkpasswd.c (enum_users): Ditto.
This commit is contained in:
parent
b1ce1770ea
commit
91dd009e81
@ -1,3 +1,11 @@
|
||||
2009-08-11 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* mkgroup.c (enum_local_groups): Avoid error message if given group
|
||||
name isn't found and return 0 to allow searching to proceed. Always
|
||||
return 0 or 1, not -1.
|
||||
(enum_groups): Avoid error message if given group name isn't found.
|
||||
* mkpasswd.c (enum_users): Ditto.
|
||||
|
||||
2009-08-10 Dave Korn <dave.korn.cygwin@gmail.com>
|
||||
|
||||
* mingw: Add fallbacks to search for MinGW components in standard
|
||||
|
@ -346,12 +346,17 @@ enum_local_groups (BOOL domain, domlist_t *dom_or_machine, const char *sep,
|
||||
{
|
||||
DWORD i;
|
||||
|
||||
if (disp_groupname != NULL)
|
||||
if (disp_groupname)
|
||||
{
|
||||
mbstowcs (gname, disp_groupname, GNLEN + 1);
|
||||
rc = NetLocalGroupGetInfo (servername, gname, 0, (void *) &buffer);
|
||||
if (rc == ERROR_SUCCESS)
|
||||
entriesread = 1;
|
||||
/* Allow further searching for the group and avoid annoying
|
||||
error messages just because the group is not a local group or
|
||||
the group hasn't been found. */
|
||||
else if (rc == ERROR_NO_SUCH_ALIAS || rc == NERR_GroupNotFound)
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
rc = NetLocalGroupEnum (servername, 0, (void *) &buffer,
|
||||
@ -453,10 +458,10 @@ skip_group:
|
||||
}
|
||||
while (rc == ERROR_MORE_DATA);
|
||||
|
||||
/* Return -1 if the single group we're looking for has been found here to
|
||||
/* Return 1 if the single group we're looking for has been found here to
|
||||
avoid calling enum_groups for the same group, thus avoiding a spurious
|
||||
error message "group name could not be found" in enum_groups. */
|
||||
return disp_groupname && entriesread ? -1 : 0;
|
||||
return disp_groupname && entriesread ? 1 : 0;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -502,6 +507,10 @@ enum_groups (BOOL domain, domlist_t *dom_or_machine, const char *sep,
|
||||
rc = NetGroupGetInfo (servername, (LPWSTR) & gname, 2,
|
||||
(void *) &buffer);
|
||||
entriesread=1;
|
||||
/* Avoid annoying error messages just because the group hasn't been
|
||||
found. */
|
||||
if (rc == NERR_GroupNotFound)
|
||||
return;
|
||||
}
|
||||
else
|
||||
rc = NetGroupEnum (servername, 2, (void *) & buffer,
|
||||
|
@ -411,6 +411,10 @@ enum_users (BOOL domain, domlist_t *dom_or_machine, const char *sep,
|
||||
rc = NetUserGetInfo (servername, (LPWSTR) &uni_name, 3,
|
||||
(void *) &buffer);
|
||||
entriesread = 1;
|
||||
/* Avoid annoying error messages just because the user hasn't been
|
||||
found. */
|
||||
if (rc == NERR_UserNotFound)
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
rc = NetUserEnum (servername, 3, FILTER_NORMAL_ACCOUNT,
|
||||
|
Loading…
Reference in New Issue
Block a user