-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnss_cdb-spwd.c
36 lines (30 loc) · 1023 Bytes
/
nss_cdb-spwd.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* $Id: nss_cdb-spwd.c,v 1.1 2003-11-03 18:23:42 mjt Exp $
* nss_cdb shadow passwd database routines.
*
* This file is a part of tinycdb package by Michael Tokarev, [email protected].
* Public domain.
*/
#include "nss_cdb.h"
#include <shadow.h>
nss_common(shadow, struct spwd, spent);
nss_getbyname(getspnam, struct spwd);
static int
nss_shadow_parse(struct spwd *result, char *buf, size_t bufl) {
STRING_FIELD(buf, result->sp_namp);
if (!result->sp_namp[0]) return -1;
STRING_FIELD(buf, result->sp_pwdp);
INT_FIELD_MAYBE_NULL(buf, result->sp_lstchg, (long), -1);
INT_FIELD_MAYBE_NULL(buf, result->sp_min, (long), -1);
INT_FIELD_MAYBE_NULL(buf, result->sp_max, (long), -1);
INT_FIELD_MAYBE_NULL(buf, result->sp_warn, (long), -1);
INT_FIELD_MAYBE_NULL(buf, result->sp_inact, (long), -1);
INT_FIELD_MAYBE_NULL(buf, result->sp_expire, (long), -1);
if (*buf) {
result->sp_flag = strtoul(buf, &buf, 10);
if (*buf) return -1;
}
else
result->sp_flag = ~0ul;
bufl = bufl;
return 1;
}