* 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>
|
2009-08-10 Dave Korn <dave.korn.cygwin@gmail.com>
|
||||||
|
|
||||||
* mingw: Add fallbacks to search for MinGW components in standard
|
* 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;
|
DWORD i;
|
||||||
|
|
||||||
if (disp_groupname != NULL)
|
if (disp_groupname)
|
||||||
{
|
{
|
||||||
mbstowcs (gname, disp_groupname, GNLEN + 1);
|
mbstowcs (gname, disp_groupname, GNLEN + 1);
|
||||||
rc = NetLocalGroupGetInfo (servername, gname, 0, (void *) &buffer);
|
rc = NetLocalGroupGetInfo (servername, gname, 0, (void *) &buffer);
|
||||||
if (rc == ERROR_SUCCESS)
|
if (rc == ERROR_SUCCESS)
|
||||||
entriesread = 1;
|
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
|
else
|
||||||
rc = NetLocalGroupEnum (servername, 0, (void *) &buffer,
|
rc = NetLocalGroupEnum (servername, 0, (void *) &buffer,
|
||||||
|
@ -453,10 +458,10 @@ skip_group:
|
||||||
}
|
}
|
||||||
while (rc == ERROR_MORE_DATA);
|
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
|
avoid calling enum_groups for the same group, thus avoiding a spurious
|
||||||
error message "group name could not be found" in enum_groups. */
|
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
|
static void
|
||||||
|
@ -502,6 +507,10 @@ enum_groups (BOOL domain, domlist_t *dom_or_machine, const char *sep,
|
||||||
rc = NetGroupGetInfo (servername, (LPWSTR) & gname, 2,
|
rc = NetGroupGetInfo (servername, (LPWSTR) & gname, 2,
|
||||||
(void *) &buffer);
|
(void *) &buffer);
|
||||||
entriesread=1;
|
entriesread=1;
|
||||||
|
/* Avoid annoying error messages just because the group hasn't been
|
||||||
|
found. */
|
||||||
|
if (rc == NERR_GroupNotFound)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rc = NetGroupEnum (servername, 2, (void *) & buffer,
|
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,
|
rc = NetUserGetInfo (servername, (LPWSTR) &uni_name, 3,
|
||||||
(void *) &buffer);
|
(void *) &buffer);
|
||||||
entriesread = 1;
|
entriesread = 1;
|
||||||
|
/* Avoid annoying error messages just because the user hasn't been
|
||||||
|
found. */
|
||||||
|
if (rc == NERR_UserNotFound)
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rc = NetUserEnum (servername, 3, FILTER_NORMAL_ACCOUNT,
|
rc = NetUserEnum (servername, 3, FILTER_NORMAL_ACCOUNT,
|
||||||
|
|
Loading…
Reference in New Issue