aboutsummaryrefslogtreecommitdiff
path: root/nis/nss_compat/compat-pwd.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-06-28 07:57:21 +0000
committerUlrich Drepper <drepper@redhat.com>2003-06-28 07:57:21 +0000
commitbbca27a424c7b9e339b11e1447b2756f3582a59c (patch)
treec7a969f6e9ac0458494cb70e177f3927e3370a7d /nis/nss_compat/compat-pwd.c
parent1aa43890df5ecc09004007336f64ed1344a9d335 (diff)
downloadglibc-bbca27a424c7b9e339b11e1447b2756f3582a59c.tar
glibc-bbca27a424c7b9e339b11e1447b2756f3582a59c.tar.gz
glibc-bbca27a424c7b9e339b11e1447b2756f3582a59c.tar.bz2
glibc-bbca27a424c7b9e339b11e1447b2756f3582a59c.zip
Update.
2003-06-07 Thorsten Kukuk <kukuk@suse.de> * nis/nss_compat/compat-grp.c: Remove unused nis_first variable (getgrent_next_file) Don't store group name to early in blacklist. * nis/nss_compat/compat-pwd.c (internal_getpwuid_r): Save strlen result and use memcpy instead of strcpy. 2003-06-28 Ulrich Drepper <drepper@redhat.com> * nis/nss_compat/compat-grp.c: Optimize several little things. Use stream unlocked. * nis/nss_compat/compat-initgroups.c: Likewise. * nis/nss_compat/compat-pwd.c: Likewise. * nis/nss_compat/compat-spwd.c: Likewise. 2003-06-27 Thorsten Kukuk <kukuk@suse.de> * nis/nss_compat/compat-initgroups.c: Don't use our own NIS/NIS+ functions, dlopen corresponding NSS module instead.
Diffstat (limited to 'nis/nss_compat/compat-pwd.c')
-rw-r--r--nis/nss_compat/compat-pwd.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/nis/nss_compat/compat-pwd.c b/nis/nss_compat/compat-pwd.c
index d8b9ba18d6..350a638644 100644
--- a/nis/nss_compat/compat-pwd.c
+++ b/nis/nss_compat/compat-pwd.c
@@ -588,12 +588,13 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
if (result->pw_name[0] == '+' && result->pw_name[1] != '\0'
&& result->pw_name[1] != '@')
{
- char buf[strlen (result->pw_name)];
+ size_t len = strlen (result->pw_name);
+ char buf[len];
enum nss_status status;
/* Store the User in the blacklist for the "+" at the end of
/etc/passwd */
- strcpy (buf, &result->pw_name[1]);
+ memcpy (buf, &result->pw_name[1], len);
status = getpwnam_plususer (&result->pw_name[1], result, ent,
buffer, buflen, errnop);
blacklist_store_name (buf, ent);
@@ -942,10 +943,12 @@ internal_getpwuid_r (uid_t uid, struct passwd *result, ent_t *ent,
if (result->pw_name[0] == '-' && result->pw_name[1] == '@'
&& result->pw_name[2] != '\0')
{
- char buf[strlen (result->pw_name)];
+ /* -1, because we remove first two character of pw_name. */
+ size_t len = strlen (result->pw_name) - 1;
+ char buf[len];
enum nss_status status;
- strcpy (buf, &result->pw_name[2]);
+ memcpy (buf, &result->pw_name[2], len);
status = getpwuid_plususer (uid, result, buffer, buflen, errnop);
if (status == NSS_STATUS_SUCCESS &&
@@ -959,10 +962,12 @@ internal_getpwuid_r (uid_t uid, struct passwd *result, ent_t *ent,
if (result->pw_name[0] == '+' && result->pw_name[1] == '@'
&& result->pw_name[2] != '\0')
{
- char buf[strlen (result->pw_name)];
+ /* -1, because we remove first two characters of pw_name. */
+ size_t len = strlen (result->pw_name) - 1;
+ char buf[len];
enum nss_status status;
- strcpy (buf, &result->pw_name[2]);
+ memcpy (buf, &result->pw_name[2], len);
status = getpwuid_plususer (uid, result, buffer, buflen, errnop);
@@ -986,10 +991,11 @@ internal_getpwuid_r (uid_t uid, struct passwd *result, ent_t *ent,
if (result->pw_name[0] == '-' && result->pw_name[1] != '\0'
&& result->pw_name[1] != '@')
{
- char buf[strlen (result->pw_name)];
+ size_t len = strlen (result->pw_name);
+ char buf[len];
enum nss_status status;
- strcpy (buf, &result->pw_name[1]);
+ memcpy (buf, &result->pw_name[1], len);
status = getpwuid_plususer (uid, result, buffer, buflen, errnop);
if (status == NSS_STATUS_SUCCESS &&
@@ -1002,10 +1008,11 @@ internal_getpwuid_r (uid_t uid, struct passwd *result, ent_t *ent,
if (result->pw_name[0] == '+' && result->pw_name[1] != '\0'
&& result->pw_name[1] != '@')
{
- char buf[strlen (result->pw_name)];
+ size_t len = strlen (result->pw_name);
+ char buf[len];
enum nss_status status;
- strcpy (buf, &result->pw_name[1]);
+ memcpy (buf, &result->pw_name[1], len);
status = getpwuid_plususer (uid, result, buffer, buflen, errnop);