2 #include <../pthread.h>
7 static pthread_mutex_t
getpw_mutex = PTHREAD_MUTEX_INITIALIZER;
10 convert (
struct passwd *ret,
struct passwd *result,
11 char *
buf,
int buflen)
19 result->pw_name = (
char *)
buf;
20 len = strlen (ret->pw_name) + 1;
21 if (len > buflen)
return -1;
24 strcpy (result->pw_name, ret->pw_name);
27 result->pw_passwd = (
char *)
buf;
28 len = strlen (ret->pw_passwd) + 1;
29 if (len > buflen)
return -1;
32 strcpy (result->pw_passwd, ret->pw_passwd);
35 result->pw_gecos = (
char *)
buf;
36 len = strlen (ret->pw_gecos) + 1;
37 if (len > buflen)
return -1;
40 strcpy (result->pw_gecos, ret->pw_gecos);
43 result->pw_dir = (
char *)
buf;
44 len = strlen (ret->pw_dir) + 1;
45 if (len > buflen)
return -1;
48 strcpy (result->pw_dir, ret->pw_dir);
51 result->pw_shell = (
char *)
buf;
52 len = strlen (ret->pw_shell) + 1;
53 if (len > buflen)
return -1;
56 strcpy (result->pw_shell, ret->pw_shell);
63 struct passwd *result,
char *buffer,
size_t buflen)
69 ret = getpwnam (name);
71 convert (ret, result, buffer, buflen) != 0)
82 struct passwd *result,
char *buffer,
size_t buflen)
90 convert (ret, result, buffer, buflen) != 0)