* passwd.cc (getpwnam_r): Use correct offsets into buffer.
Copy pw_gecos field as well. (getpwuid_r): Ditto.
This commit is contained in:
parent
f669342ed7
commit
3c73ae1c1e
|
@ -1,3 +1,9 @@
|
|||
Tue Apr 24 23:43:00 2001 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* passwd.cc (getpwnam_r): Use correct offsets into buffer.
|
||||
Copy pw_gecos field as well.
|
||||
(getpwuid_r): Ditto.
|
||||
|
||||
2001-04-24 Egor Duda <deo@logos-m.ru>
|
||||
|
||||
* dlmalloc.c: New file. Port of Doug Lea's malloc
|
||||
|
|
|
@ -230,7 +230,8 @@ getpwuid_r (uid_t uid, struct passwd *pwd, char *buffer, size_t bufsize, struct
|
|||
return 0;
|
||||
|
||||
/* check needed buffer size. */
|
||||
size_t needsize = strlen (temppw->pw_name) + strlen (temppw->pw_dir) + strlen (temppw->pw_shell);
|
||||
size_t needsize = strlen (temppw->pw_name) + strlen (temppw->pw_dir) +
|
||||
strlen (temppw->pw_shell) + strlen (temppw->pw_gecos) + 4;
|
||||
if (needsize > bufsize)
|
||||
return ERANGE;
|
||||
|
||||
|
@ -239,11 +240,13 @@ getpwuid_r (uid_t uid, struct passwd *pwd, char *buffer, size_t bufsize, struct
|
|||
pwd->pw_uid = temppw->pw_uid;
|
||||
pwd->pw_gid = temppw->pw_gid;
|
||||
pwd->pw_name = buffer;
|
||||
pwd->pw_dir = buffer + strlen (temppw->pw_name);
|
||||
pwd->pw_shell = buffer + strlen (temppw->pw_name) + strlen (temppw->pw_dir);
|
||||
pwd->pw_dir = pwd->pw_name + strlen (temppw->pw_name) + 1;
|
||||
pwd->pw_shell = pwd->pw_dir + strlen (temppw->pw_dir) + 1;
|
||||
pwd->pw_gecos = pwd->pw_shell + strlen (temppw->pw_shell) + 1;
|
||||
strcpy (pwd->pw_name, temppw->pw_name);
|
||||
strcpy (pwd->pw_dir, temppw->pw_dir);
|
||||
strcpy (pwd->pw_shell, temppw->pw_shell);
|
||||
strcpy (pwd->pw_gecos, temppw->pw_gecos);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -282,7 +285,8 @@ getpwnam_r (const char *nam, struct passwd *pwd, char *buffer, size_t bufsize, s
|
|||
return 0;
|
||||
|
||||
/* check needed buffer size. */
|
||||
size_t needsize = strlen (temppw->pw_name) + strlen (temppw->pw_dir) + strlen (temppw->pw_shell);
|
||||
size_t needsize = strlen (temppw->pw_name) + strlen (temppw->pw_dir) +
|
||||
strlen (temppw->pw_shell) + strlen (temppw->pw_gecos) + 4;
|
||||
if (needsize > bufsize)
|
||||
return ERANGE;
|
||||
|
||||
|
@ -291,11 +295,13 @@ getpwnam_r (const char *nam, struct passwd *pwd, char *buffer, size_t bufsize, s
|
|||
pwd->pw_uid = temppw->pw_uid;
|
||||
pwd->pw_gid = temppw->pw_gid;
|
||||
pwd->pw_name = buffer;
|
||||
pwd->pw_dir = buffer + strlen (temppw->pw_name);
|
||||
pwd->pw_shell = buffer + strlen (temppw->pw_name) + strlen (temppw->pw_dir);
|
||||
pwd->pw_dir = pwd->pw_name + strlen (temppw->pw_name) + 1;
|
||||
pwd->pw_shell = pwd->pw_dir + strlen (temppw->pw_dir) + 1;
|
||||
pwd->pw_gecos = pwd->pw_shell + strlen (temppw->pw_shell) + 1;
|
||||
strcpy (pwd->pw_name, temppw->pw_name);
|
||||
strcpy (pwd->pw_dir, temppw->pw_dir);
|
||||
strcpy (pwd->pw_shell, temppw->pw_shell);
|
||||
strcpy (pwd->pw_gecos, temppw->pw_gecos);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue