blob: bb629dba6f9a32a4d2b2f3601bf62cf7d95253b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
/* ISC license. */
#include <string.h>
#include <errno.h>
#include "nsss-internal.h"
int nsss_shadow_copy (struct spwd *sp, char *buf, size_t buflen, struct spwd const *sp2, char const *s, size_t len)
{
if (len > buflen) return (errno = ERANGE, 0) ;
memcpy(buf, s, len) ;
sp->sp_namp = buf + (sp2->sp_namp - s) ;
sp->sp_pwdp = buf + (sp2->sp_pwdp - s) ;
sp->sp_lstchg = sp2->sp_lstchg ;
sp->sp_min = sp2->sp_min ;
sp->sp_max = sp2->sp_max ;
sp->sp_warn = sp2->sp_warn ;
sp->sp_inact = sp2->sp_inact ;
sp->sp_expire = sp2->sp_expire ;
sp->sp_flag = sp2->sp_flag ;
return 1 ;
}
|