-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathnss_debug-passwd.c
50 lines (42 loc) · 1.4 KB
/
nss_debug-passwd.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <nss.h>
#include <pwd.h>
#include <stdio.h>
/**************************************
* Functions for the passwd database. *
**************************************/
// Called to open the passwd file
enum nss_status
_nss_debug_setpwent(int stayopen)
{
fprintf(stderr, "NSS DEBUG: Called %s with args (stayopen: %d)\n", __FUNCTION__, stayopen);
// Must be marked as success otherwise getpwent_r won't be called.
return NSS_STATUS_SUCCESS;
}
// Called to close the passwd file
enum nss_status
_nss_debug_endpwent(void)
{
fprintf(stderr, "NSS DEBUG: Called %s\n", __FUNCTION__);
return NSS_STATUS_NOTFOUND;
}
// Called to look up next entry in passwd file
enum nss_status
_nss_debug_getpwent_r(struct passwd *result, char *buffer, size_t buflen, int *errnop)
{
fprintf(stderr, "NSS DEBUG: Called %s\n", __FUNCTION__);
return NSS_STATUS_NOTFOUND;
}
// Find a user account by uid
enum nss_status
_nss_debug_getpwuid_r(uid_t uid, struct passwd *result, char *buffer, size_t buflen, int *errnop)
{
fprintf(stderr, "NSS DEBUG: Called %s with args (uid: %d)\n", __FUNCTION__, uid);
return NSS_STATUS_NOTFOUND;
}
// Find a user account by name
enum nss_status
_nss_debug_getpwnam_r(const char *name, struct passwd *result, char *buffer, size_t buflen, int *errnop)
{
fprintf(stderr, "NSS DEBUG: Called %s with args (name: %s)\n", __FUNCTION__, name);
return NSS_STATUS_NOTFOUND;
}