Changeset View
Changeset View
Standalone View
Standalone View
lib/nss_tacplus/nss_tacplus.c
Show All 18 Lines | |||||
#include <nsswitch.h> | #include <nsswitch.h> | ||||
#include <pwd.h> | #include <pwd.h> | ||||
#include <taclib.h> | #include <taclib.h> | ||||
extern int __isthreaded; | extern int __isthreaded; | ||||
#define DEF_UID 65534 | #define DEF_UID 65534 | ||||
#define DEF_GID 65534 | #define DEF_GID 65534 | ||||
#define DEF_CLASS "" | |||||
markj: Shouldn't this be "default"? | |||||
Done Inline ActionsNo. The default class, if it exists, is automatically used for users who don't have another class set. des: No. The `default` class, if it exists, is automatically used for users who don't have another… | |||||
#define DEF_DIR "/" | #define DEF_DIR "/" | ||||
#define DEF_SHELL "/bin/sh" | #define DEF_SHELL "/bin/sh" | ||||
ns_mtab *nss_module_register(const char *, unsigned int *, | ns_mtab *nss_module_register(const char *, unsigned int *, | ||||
nss_module_unregister_fn *); | nss_module_unregister_fn *); | ||||
static void | static void | ||||
tacplus_error(struct tac_handle *h, const char *func) | tacplus_error(struct tac_handle *h, const char *func) | ||||
▲ Show 20 Lines • Show All 152 Lines • ▼ Show 20 Lines | if (strcasecmp(key, "uid") == 0) { | ||||
num = strtoimax(value, &end, 10); | num = strtoimax(value, &end, 10); | ||||
if (end == value || *end != '\0' || | if (end == value || *end != '\0' || | ||||
num < 0 || num > (intmax_t)GID_MAX) { | num < 0 || num > (intmax_t)GID_MAX) { | ||||
errno = EINVAL; | errno = EINVAL; | ||||
free(av); | free(av); | ||||
return (NS_RETURN); | return (NS_RETURN); | ||||
} | } | ||||
pwd->pw_gid = num; | pwd->pw_gid = num; | ||||
} else if (strcasecmp(av, "class") == 0) { | |||||
pwd->pw_class = tacplus_copystr(value, &buffer, | |||||
&bufsize); | |||||
if (pwd->pw_class == NULL) { | |||||
free(av); | |||||
return (NS_RETURN); | |||||
} | |||||
} else if (strcasecmp(av, "gecos") == 0) { | } else if (strcasecmp(av, "gecos") == 0) { | ||||
pwd->pw_gecos = tacplus_copystr(value, &buffer, | pwd->pw_gecos = tacplus_copystr(value, &buffer, | ||||
&bufsize); | &bufsize); | ||||
if (pwd->pw_gecos == NULL) { | if (pwd->pw_gecos == NULL) { | ||||
free(av); | free(av); | ||||
return (NS_RETURN); | return (NS_RETURN); | ||||
} | } | ||||
} else if (strcasecmp(av, "home") == 0) { | } else if (strcasecmp(av, "home") == 0) { | ||||
pwd->pw_dir = tacplus_copystr(value, &buffer, | pwd->pw_dir = tacplus_copystr(value, &buffer, | ||||
&bufsize); | &bufsize); | ||||
if (pwd->pw_dir == NULL) { | if (pwd->pw_dir == NULL) { | ||||
free(av); | free(av); | ||||
return (NS_RETURN); | return (NS_RETURN); | ||||
} | } | ||||
} else if (strcasecmp(av, "shell") == 0) { | } else if (strcasecmp(av, "shell") == 0) { | ||||
pwd->pw_shell = tacplus_copystr(value, &buffer, | pwd->pw_shell = tacplus_copystr(value, &buffer, | ||||
&bufsize); | &bufsize); | ||||
if (pwd->pw_shell == NULL) { | if (pwd->pw_shell == NULL) { | ||||
free(av); | free(av); | ||||
return (NS_RETURN); | return (NS_RETURN); | ||||
} | } | ||||
} | } | ||||
free(av); | free(av); | ||||
} | } | ||||
/* default class if none was provided */ | |||||
if (pwd->pw_class == NULL) | |||||
pwd->pw_class = tacplus_copystr(DEF_CLASS, &buffer, &bufsize); | |||||
/* gecos equal to name if none was provided */ | /* gecos equal to name if none was provided */ | ||||
if (pwd->pw_gecos == NULL) | if (pwd->pw_gecos == NULL) | ||||
pwd->pw_gecos = pwd->pw_name; | pwd->pw_gecos = pwd->pw_name; | ||||
/* default home directory if none was provided */ | /* default home directory if none was provided */ | ||||
if (pwd->pw_dir == NULL) | if (pwd->pw_dir == NULL) | ||||
pwd->pw_dir = tacplus_copystr(DEF_DIR, &buffer, &bufsize); | pwd->pw_dir = tacplus_copystr(DEF_DIR, &buffer, &bufsize); | ||||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |
Shouldn't this be "default"?