Lines 140-145
error_get_type (void)
Link Here
|
140 |
#define MAX_LOCAL_USERS 50 |
140 |
#define MAX_LOCAL_USERS 50 |
141 |
#endif |
141 |
#endif |
142 |
|
142 |
|
|
|
143 |
#ifndef __GLIBC__ |
144 |
/* Musl libc does not support fgetspent_r(), write own |
145 |
* wrapper |
146 |
*/ |
147 |
static int fgetspent_r(FILE *fp, struct spwd *spbuf, char *buf, size_t buflen, struct spwd **spbufp) { |
148 |
struct spwd *shadow_entry = fgetspent(fp); |
149 |
if(!shadow_entry) |
150 |
return -1; |
151 |
size_t namplen = strlen(shadow_entry->sp_namp); |
152 |
size_t pwdplen = strlen(shadow_entry->sp_pwdp); |
153 |
|
154 |
if(namplen + pwdplen + 2 > buflen) |
155 |
return -1; |
156 |
|
157 |
*spbufp = memcpy(spbuf, shadow_entry, sizeof(struct spwd)); |
158 |
spbuf->sp_namp = strncpy(buf, shadow_entry->sp_namp, namplen + 1); |
159 |
spbuf->sp_pwdp = strncpy(buf + namplen + 1, shadow_entry->sp_pwdp, pwdplen + 1); |
160 |
|
161 |
return 0; |
162 |
} |
163 |
#endif |
164 |
|
143 |
static struct passwd * |
165 |
static struct passwd * |
144 |
entry_generator_fgetpwent (Daemon *daemon, |
166 |
entry_generator_fgetpwent (Daemon *daemon, |
145 |
GHashTable *users, |
167 |
GHashTable *users, |