| 1 |
/* |
| 2 |
* Linux-PAM session chroot()er |
| 3 |
* account, session, authentication |
| 4 |
* |
| 5 |
* $Id: pam_chroot.c,v 1.3 2004/06/24 02:01:44 schmolli Exp $ |
| 6 |
*/ |
| 7 |
|
| 8 |
#include <syslog.h> |
| 9 |
#include <string.h> |
| 10 |
#include <stdlib.h> |
| 11 |
#include <unistd.h> |
| 12 |
#include <regex.h> |
| 13 |
#include <stdio.h> |
| 14 |
#include <errno.h> |
| 15 |
#include <ctype.h> |
| 16 |
#include <stdarg.h> |
| 17 |
#include <grp.h> |
| 18 |
#include <pwd.h> |
| 19 |
#include <sys/stat.h> |
| 20 |
|
| 21 |
#define PAM_SM_AUTHcxx . . $ `pam_chroot.c:21:10`! |
| 22 |
#define PAM_SM_ACCOUNTcxx . . $ `pam_chroot.c:22:10`! |
| 23 |
#define PAM_SM_SESSIONcxx . . $ `pam_chroot.c:23:10`! |
| 24 |
#include <security/pam_modules.h> |
| 25 |
#include <security/_pam_macros.h> |
| 26 |
|
| 27 |
#define CONFIGcxx . . $ `pam_chroot.c:27:9`! "/etc/security/chroot.conf" |
| 28 |
#define LINELENcxx . . $ `pam_chroot.c:28:9`! 1024 /* max length (bytes) of line in config file */ |
| 29 |
#define SCRATCHcxx . . $ `pam_chroot.c:29:9`! 32 /* max length (bytes) for scribble space */ |
| 30 |
#define MAX_GROUPScxx . . $ `pam_chroot.c:30:9`! 64 /* maximum number of groups we handle */ |
| 31 |
|
| 32 |
/* defines for flags */ |
| 33 |
#define _PAM_OPTS_NOOPTScxx . . $ `pam_chroot.c:33:9`! 0x0000 |
| 34 |
#define _PAM_OPTS_DEBUGcxx . . $ `pam_chroot.c:34:9`! 0x0001 |
| 35 |
#define _PAM_OPTS_SILENTcxx . . $ `pam_chroot.c:35:9`! 0x0002 |
| 36 |
#define _PAM_OPTS_NOTFOUNDFAILScxx . . $ `pam_chroot.c:36:9`! 0x0004 |
| 37 |
#define _PAM_OPTS_NO_CHROOTcxx . . $ `pam_chroot.c:37:9`! 0x0008 |
| 38 |
#define _PAM_OPTS_USE_REGEXcxx . . $ `pam_chroot.c:38:9`! 0x0010 |
| 39 |
#define _PAM_OPTS_USE_EXT_REGEXcxx . . $ `pam_chroot.c:39:9`! 0x0030 /* includes _PAM_OPTS_USE_REGEX */ |
| 40 |
#define _PAM_OPTS_USE_GROUPScxx . . $ `pam_chroot.c:40:9`! 0x0040 |
| 41 |
#define _PAM_OPTS_SECCHECKScxx . . $ `pam_chroot.c:41:9`! 0x0080 |
| 42 |
|
| 43 |
/* defines for (internal) return values */ |
| 44 |
#define _PAM_CHROOT_INTERNALERRcxx . . $ `pam_chroot.c:44:9`! -2 |
| 45 |
#define _PAM_CHROOT_SYSERRcxx . . $ `pam_chroot.c:45:9`! -1 |
| 46 |
#define _PAM_CHROOT_OKcxx . . $ `pam_chroot.c:46:9`! 0 |
| 47 |
#define _PAM_CHROOT_USERNOTFOUNDcxx . . $ `pam_chroot.c:47:9`! 1 |
| 48 |
#define _PAM_CHROOT_INCOMPLETEcxx . . $ `pam_chroot.c:48:9`! 2 |
| 49 |
|
| 50 |
|
| 51 |
struct _pam_optscxx . . $ _pam_opts# { |
| 52 |
int16_tcxx . . $ int16_t# flagscxx . . $ _pam_opts#flags.; /* combined option flags */ |
| 53 |
char* chroot_dircxx . . $ _pam_opts#chroot_dir.; /* where to chroot to */ |
| 54 |
char* confcxx . . $ _pam_opts#conf.; /* name of pam_chroot config file */ |
| 55 |
char* modulecxx . . $ _pam_opts#module.; /* module currently being processed */ |
| 56 |
}; |
| 57 |
|
| 58 |
static void _pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(int err, const char *format, ...) { |
| 59 |
va_listcxx . . $ va_list# args; |
| 60 |
|
| 61 |
va_startcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stdarg.h:50:9`!(args, format); |
| 62 |
openlogcxx . . $ openlog(7b85637613228108).("pam_chroot", LOG_PIDcxx . . $ `<external>/6168640806541382331/syslog.h:162:9`!, LOG_AUTHPRIVcxx . . $ `<external>/6168640806541382331/syslog.h:103:9`!); |
| 63 |
vsyslogcxx . . $ vsyslog(7aa579bceef62d01).(err, format, args); |
| 64 |
va_endcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stdarg.h:52:9`!(args); |
| 65 |
closelogcxx . . $ closelog(49f6e7a06ebc5aa8).(); |
| 66 |
} |
| 67 |
|
| 68 |
/* initialize opts to a standard known state */ |
| 69 |
int _pam_opts_initcxx . . $ _pam_opts_init(8668569be3176d09).(struct _pam_optscxx . . $ _pam_opts#* opts) { |
| 70 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == opts) { |
| •71 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "%s: NULL opts pointer", __extension__ __FUNCTION__); |
| 72 |
return _PAM_CHROOT_INTERNALERRcxx . . $ `pam_chroot.c:44:9`!; |
| 73 |
} |
| 74 |
|
| 75 |
opts->flagscxx . . $ _pam_opts#flags. = _PAM_OPTS_NOOPTScxx . . $ `pam_chroot.c:33:9`!; |
| 76 |
opts->chroot_dircxx . . $ _pam_opts#chroot_dir. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 77 |
|
| •78 |
opts->confcxx . . $ _pam_opts#conf. = strdupcxx . . $ strdup(a8b8e32347182212).(CONFIGcxx . . $ `pam_chroot.c:27:9`!); |
| 79 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == opts->confcxx . . $ _pam_opts#conf.) { |
| 80 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "strdup: %s", strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 81 |
return _PAM_CHROOT_SYSERRcxx . . $ `pam_chroot.c:45:9`!; |
| 82 |
} |
| 83 |
|
| 84 |
return _PAM_CHROOT_OKcxx . . $ `pam_chroot.c:46:9`!; |
| 85 |
} |
| 86 |
|
| 87 |
/* configure opts per the passed flags and cmd line args */ |
| 88 |
int _pam_opts_configcxx . . $ _pam_opts_config(f3ebb82247d488f7).(struct _pam_optscxx . . $ _pam_opts#* opts, int flags, |
| 89 |
int argc, const char** argv) |
| 90 |
{ |
| 91 |
int i; |
| 92 |
|
| 93 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == opts) { |
| •94 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "%s: NULL opts pointer", __extension__ __FUNCTION__); |
| 95 |
return _PAM_CHROOT_INTERNALERRcxx . . $ `pam_chroot.c:44:9`!; |
| 96 |
} |
| 97 |
|
| 98 |
if(flags & PAM_SILENTcxx . . $ `<external>/1475977469199658974/_pam_types.h:97:9`!) { opts->flagscxx . . $ _pam_opts#flags. = opts->flagscxx . . $ _pam_opts#flags. | _PAM_OPTS_SILENTcxx . . $ `pam_chroot.c:35:9`!; } |
| 99 |
if((flags & PAM_DISALLOW_NULL_AUTHTOKcxx . . $ `<external>/1475977469199658974/_pam_types.h:103:9`!) && |
| 100 |
(!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(opts->modulecxx . . $ _pam_opts#module., "auth") || !strcmpcxx . . $ strcmp(5ae29d726ae57f88).(opts->modulecxx . . $ _pam_opts#module., "account"))) |
| 101 |
{ |
| 102 |
opts->flagscxx . . $ _pam_opts#flags. = opts->flagscxx . . $ _pam_opts#flags. | _PAM_OPTS_NOTFOUNDFAILScxx . . $ `pam_chroot.c:36:9`!; |
| 103 |
} |
| 104 |
|
| 105 |
/* parse command line args */ |
| 106 |
for(i = 0; i < argc; i++) { |
| 107 |
if(!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "debug")) { |
| 108 |
opts->flagscxx . . $ _pam_opts#flags. = opts->flagscxx . . $ _pam_opts#flags. | _PAM_OPTS_DEBUGcxx . . $ `pam_chroot.c:34:9`!; |
| 109 |
} else if(!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "no_warn")) { |
| 110 |
opts->flagscxx . . $ _pam_opts#flags. = opts->flagscxx . . $ _pam_opts#flags. | _PAM_OPTS_SILENTcxx . . $ `pam_chroot.c:35:9`!; |
| 111 |
} else if(!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "use_first_pass") || |
| 112 |
!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "try_first_pass") || |
| 113 |
!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "use_mapped_pass")) { |
| 114 |
/* ignore these, pam_chroot doesn't care about passwds */ |
| 115 |
} else if(!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "no_chroot")) { |
| 116 |
opts->flagscxx . . $ _pam_opts#flags. = opts->flagscxx . . $ _pam_opts#flags. | _PAM_OPTS_NO_CHROOTcxx . . $ `pam_chroot.c:37:9`!; |
| 117 |
} else if(!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "use_regex")) { |
| 118 |
opts->flagscxx . . $ _pam_opts#flags. = opts->flagscxx . . $ _pam_opts#flags. | _PAM_OPTS_USE_REGEXcxx . . $ `pam_chroot.c:38:9`!; |
| 119 |
} else if(!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "use_ext_regex")) { |
| 120 |
opts->flagscxx . . $ _pam_opts#flags. = opts->flagscxx . . $ _pam_opts#flags. | _PAM_OPTS_USE_EXT_REGEXcxx . . $ `pam_chroot.c:39:9`!; |
| 121 |
} else if(!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "use_groups")) { |
| 122 |
opts->flagscxx . . $ _pam_opts#flags. = opts->flagscxx . . $ _pam_opts#flags. | _PAM_OPTS_USE_GROUPScxx . . $ `pam_chroot.c:40:9`!; |
| 123 |
} else if(!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i], "sec_checks")) { |
| 124 |
opts->flagscxx . . $ _pam_opts#flags. = opts->flagscxx . . $ _pam_opts#flags. | _PAM_OPTS_SECCHECKScxx . . $ `pam_chroot.c:41:9`!; |
| 125 |
} else if(!strncmpcxx . . $ strncmp(fd278af2f295fa2e).(argv[i], "notfound=", 9)) { |
| 126 |
if(!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i] + 9, "success")) { |
| 127 |
opts->flagscxx . . $ _pam_opts#flags. = opts->flagscxx . . $ _pam_opts#flags. & (~_PAM_OPTS_NOTFOUNDFAILScxx . . $ `pam_chroot.c:36:9`!); |
| 128 |
} else if(!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i] + 9, "failure")) { |
| 129 |
opts->flagscxx . . $ _pam_opts#flags. = opts->flagscxx . . $ _pam_opts#flags. | _PAM_OPTS_NOTFOUNDFAILScxx . . $ `pam_chroot.c:36:9`!; |
| 130 |
} else { |
| 131 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "bad config option: \"%s\"", argv[i]); |
| 132 |
} |
| 133 |
} else if(!strncmpcxx . . $ strncmp(fd278af2f295fa2e).(argv[i], "onerr=", 6)) { |
| 134 |
if(!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i] + 6, "succeed")) { |
| 135 |
opts->flagscxx . . $ _pam_opts#flags. = opts->flagscxx . . $ _pam_opts#flags. & (~_PAM_OPTS_NOTFOUNDFAILScxx . . $ `pam_chroot.c:36:9`!); |
| •136 |
} else if(!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[i] + 6, "fail")) { |
| 137 |
opts->flagscxx . . $ _pam_opts#flags. = opts->flagscxx . . $ _pam_opts#flags. | _PAM_OPTS_NOTFOUNDFAILScxx . . $ `pam_chroot.c:36:9`!; |
| 138 |
} else { |
| 139 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "bad config option: \"%s\"", argv[i]); |
| 140 |
} |
| 141 |
} else if(!strncmpcxx . . $ strncmp(fd278af2f295fa2e).(argv[i], "chroot_dir=", 11)) { |
| 142 |
if(*(argv[i] + 11) == '\0') { |
| 143 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, |
| 144 |
"bad config option: \"%s\": specify a directory", argv[i]); |
| 145 |
} else if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! != opts->chroot_dircxx . . $ _pam_opts#chroot_dir.) { |
| 146 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, |
| 147 |
"bad config option: \"%s\": chroot dir already set", argv[i]); |
| 148 |
} else { |
| •149 |
opts->chroot_dircxx . . $ _pam_opts#chroot_dir. = strdupcxx . . $ strdup(a8b8e32347182212).(argv[i] + 11); |
| 150 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == opts->chroot_dircxx . . $ _pam_opts#chroot_dir.) { |
| 151 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "strdup: %s", strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 152 |
} |
| 153 |
} |
| 154 |
} else { |
| 155 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "unrecognized config option: \"%s\"", argv[i]); |
| 156 |
} |
| 157 |
} |
| 158 |
|
| 159 |
return _PAM_CHROOT_OKcxx . . $ `pam_chroot.c:46:9`!; |
| 160 |
} |
| 161 |
|
| 162 |
/* free the allocated memory of a struct _pam_opts */ |
| 163 |
int _pam_opts_freecxx . . $ _pam_opts_free(8668569be3176d09).(struct _pam_optscxx . . $ _pam_opts#* opts) { |
| 164 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == opts) { |
| •165 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "%s: NULL opts pointer", __extension__ __FUNCTION__); |
| 166 |
} |
| 167 |
_pam_dropcxx . . $ `<external>/2287393389393091601/_pam_macros.h:45:9`!(opts->chroot_dir); |
| 168 |
_pam_dropcxx . . $ `<external>/2287393389393091601/_pam_macros.h:45:9`!(opts->conf); |
| 169 |
|
| 170 |
return _PAM_CHROOT_OKcxx . . $ `pam_chroot.c:46:9`!; |
| 171 |
} |
| 172 |
|
| 173 |
/* if the system doesn't have getgrouplist(), then I have to do it myself */ |
| 174 |
#ifndef HAVE_GETGROUPLIST |
| 175 |
#define _PAM_GETUGROUPScxx . . $ `pam_chroot.c:175:9`! _pam_getugroups |
| 176 |
/* *user is the user to collect info on |
| 177 |
* gid is a gid to include in the grplist |
| 178 |
* *grps is the array of gid_t to return the grplist in (if not NULL) |
| 179 |
* *ngrps is the max number of gid_t to return in grplist AND where to |
| 180 |
* store the actual number of gid_t returned |
| 181 |
* |
| 182 |
* return -1 if *ngrps is too small |
| 183 |
*/ |
| 184 |
int _pam_getugroupscxx . . $ _pam_getugroups(ddecb8d96979b99f).(const char *user, gid_tcxx . . $ gid_t# gid, gid_tcxx . . $ gid_t# *grps, int *ngrps) { |
| 185 |
struct groupcxx . . $ group# *grp; |
| 186 |
int gcount = 0; |
| 187 |
char **uptr; |
| 188 |
|
| 189 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == user || NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == ngrps) { return -1; } |
| •190 |
if(0 > *ngrps) { return -1; } |
| 191 |
|
| 192 |
if(gcount < *ngrps) { |
| 193 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! != grps) { grps[gcount] = gid; } |
| 194 |
gcount++; |
| 195 |
} else { |
| 196 |
*ngrps = gcount; |
| 197 |
endgrentcxx . . $ endgrent(49f6e7a06ebc5aa8).(); |
| 198 |
return -1; |
| 199 |
} |
| 200 |
|
| 201 |
setgrentcxx . . $ setgrent(49f6e7a06ebc5aa8).(); |
| 202 |
while(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! != (grp = getgrentcxx . . $ getgrent(9c466968f5bbfe27).())) { |
| 203 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == grp->gr_namecxx . . $ group#gr_name. || NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == grp->gr_memcxx . . $ group#gr_mem.) { continue; } |
| 204 |
|
| 205 |
/* don't add gids more than once, don't do this check if grps is NULL */ |
| 206 |
/* yes, that's incorrect, but it's harder to do it correctly, and since |
| 207 |
* we're just counting, for the NULL case, it's unlikely to cause a |
| 208 |
* real problem in reasonable circumstances */ |
| 209 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! != grps) { |
| 210 |
int i; |
| 211 |
for(i = 0 ; i < gcount ; i++) { |
| 212 |
if(grp->gr_gidcxx . . $ group#gr_gid. == grps[i]) { i = -1; break; } |
| 213 |
} |
| 214 |
if(-1 == i) { continue; } |
| 215 |
} |
| 216 |
|
| 217 |
for(uptr = grp->gr_memcxx . . $ group#gr_mem. ; NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! != *uptr ; uptr++) { |
| 218 |
if(0 != strcmpcxx . . $ strcmp(5ae29d726ae57f88).(*uptr, user)) { continue; } |
| 219 |
|
| 220 |
if(gcount < *ngrps) { |
| 221 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! != grps) { grps[gcount] = grp->gr_gidcxx . . $ group#gr_gid.; } |
| 222 |
gcount++; |
| 223 |
} else { |
| 224 |
*ngrps = gcount; |
| 225 |
endgrentcxx . . $ endgrent(49f6e7a06ebc5aa8).(); |
| 226 |
return -1; |
| 227 |
} |
| 228 |
} |
| 229 |
} |
| 230 |
endgrentcxx . . $ endgrent(49f6e7a06ebc5aa8).(); |
| 231 |
*ngrps = gcount; |
| 232 |
return gcount; |
| 233 |
} |
| 234 |
#else |
| 235 |
#define _PAM_GETUGROUPS getgrouplist |
| 236 |
#endif |
| 237 |
|
| 238 |
/* generate a list of group names from a list of gids */ |
| 239 |
char** _pam_get_groupscxx . . $ _pam_get_groups(7bbf6df382d9e75d).(const char* user, struct _pam_optscxx . . $ _pam_opts#* opts) { |
| 240 |
int i, ret, ngroups = MAX_GROUPScxx . . $ `pam_chroot.c:30:9`!; |
| 241 |
struct groupcxx . . $ group#* grp; |
| 242 |
struct passwdcxx . . $ passwd#* pwd; |
| 243 |
gid_tcxx . . $ gid_t# *gids; |
| 244 |
char **groups; |
| 245 |
char scratch[SCRATCHcxx . . $ `pam_chroot.c:29:9`!]; |
| 246 |
|
| 247 |
pwd = getpwnamcxx . . $ getpwnam(826a6902c684e2bc).(user); |
| 248 |
if(pwd == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 249 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "%s: user \"%s\" not a valid username", |
| 250 |
opts->modulecxx . . $ _pam_opts#module., user); |
| 251 |
return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 252 |
} |
| 253 |
|
| 254 |
/* get a list of all the gids for this username */ |
| 255 |
_PAM_GETUGROUPScxx . . $ `pam_chroot.c:175:9`!(pwd->pw_namecxx . . $ passwd#pw_name., pwd->pw_gidcxx . . $ passwd#pw_gid., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &ngroups); |
| 256 |
if(0 >= ngroups) { |
| 257 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "%s: error fetching groups for user \"%s\"", |
| 258 |
opts->modulecxx . . $ _pam_opts#module., user); |
| 259 |
return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 260 |
} |
| 261 |
gids = (gid_tcxx . . $ gid_t#*) malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(ngroups*sizeof(gid_tcxx . . $ gid_t#)); |
| 262 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == gids) { |
| 263 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "%s: %s: malloc: %s", |
| •264 |
opts->modulecxx . . $ _pam_opts#module., __extension__ __FUNCTION__, strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 265 |
return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 266 |
} |
| 267 |
ret = _PAM_GETUGROUPScxx . . $ `pam_chroot.c:175:9`!(pwd->pw_namecxx . . $ passwd#pw_name., pwd->pw_gidcxx . . $ passwd#pw_gid., gids, &ngroups); |
| 268 |
if(-1 == ret) { |
| 269 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_WARNINGcxx . . $ `<external>/6168640806541382331/syslog.h:55:9`!, |
| 270 |
"%s: %s: _PAM_GETUGROUPS found more gids on second run", |
| •271 |
opts->modulecxx . . $ _pam_opts#module., __extension__ __FUNCTION__); |
| 272 |
} |
| 273 |
if(0 >= ngroups) { |
| 274 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, |
| 275 |
"%s: %s: _PAM_GETUGROUPS returned no groups for user \"%s\"", |
| •276 |
opts->modulecxx . . $ _pam_opts#module., __extension__ __FUNCTION__, user); |
| 277 |
_pam_dropcxx . . $ `<external>/2287393389393091601/_pam_macros.h:45:9`!(gids); |
| 278 |
return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 279 |
} |
| 280 |
|
| 281 |
/* resolve gids into grpnams */ |
| 282 |
groups = (char**)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).((ngroups+1)*sizeof(char*)); |
| 283 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == groups) { |
| 284 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "%s: %s: malloc: %s", |
| •285 |
opts->modulecxx . . $ _pam_opts#module., __extension__ __FUNCTION__, strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 286 |
_pam_dropcxx . . $ `<external>/2287393389393091601/_pam_macros.h:45:9`!(gids); |
| 287 |
return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 288 |
} |
| 289 |
for(i = 0; i < ngroups ; i++) { |
| 290 |
grp = getgrgidcxx . . $ getgrgid(1b008c0d810735fc).(gids[i]); |
| 291 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == grp) { |
| 292 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_DEBUGcxx . . $ `<external>/6168640806541382331/syslog.h:58:9`!, "%s: no grnam for gid %d", opts->modulecxx . . $ _pam_opts#module., gids[i]); |
| 293 |
snprintfcxx . . $ snprintf(ea502d73e74c754c).(scratch, SCRATCHcxx . . $ `pam_chroot.c:29:9`!, "%d", gids[i]); |
| •294 |
groups[i] = strdupcxx . . $ strdup(a8b8e32347182212).(scratch); |
| 295 |
} else { |
| •296 |
groups[i] = strdupcxx . . $ strdup(a8b8e32347182212).(grp->gr_namecxx . . $ group#gr_name.); |
| 297 |
} |
| 298 |
} |
| 299 |
groups[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 300 |
_pam_dropcxx . . $ `<external>/2287393389393091601/_pam_macros.h:45:9`!(gids); |
| 301 |
|
| 302 |
return groups; |
| 303 |
} |
| 304 |
|
| 305 |
/* helper function to free group list */ |
| 306 |
void _pam_free_groupscxx . . $ _pam_free_groups(3ed91490e421178f).(char **groups) { |
| 307 |
int i = 0; |
| 308 |
|
| 309 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == groups) { return; } |
| 310 |
while(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! != groups[i]) { |
| 311 |
_pam_dropcxx . . $ `<external>/2287393389393091601/_pam_macros.h:45:9`!(groups[i]); |
| 312 |
i++; |
| 313 |
} |
| 314 |
_pam_dropcxx . . $ `<external>/2287393389393091601/_pam_macros.h:45:9`!(groups); |
| 315 |
} |
| 316 |
|
| 317 |
/* verify that the arguement path is root owned and not writable by |
| 318 |
* group or other |
| 319 |
* return 0 if ok, 1 if not, -1 on system error */ |
| 320 |
int _pam_check_path_permscxx . . $ _pam_check_path_perms(b50bf27db23a96af).(char *path, struct _pam_optscxx . . $ _pam_opts#* opts) { |
| 321 |
int i = 0, rslt = 0; |
| 322 |
char save; |
| 323 |
struct statcxx . . $ stat# st; |
| 324 |
|
| •325 |
path = strdupcxx . . $ strdup(a8b8e32347182212).(path); |
| 326 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == path) { |
| 327 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "strdup: %s", strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 328 |
return -1; |
| 329 |
} |
| 330 |
|
| 331 |
while('\0' != path[i]) { |
| 332 |
if('/' == path[i]) { |
| 333 |
save = path[i + 1]; |
| 334 |
path[i + 1] = '\0'; |
| 335 |
|
| 336 |
if(-1 == statcxx . . $ stat(a9cd1e23e96f423c).(path, &st)) { |
| 337 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "stat(%s): %s", path, strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 338 |
rslt = -1; |
| 339 |
break; |
| 340 |
} |
| 341 |
|
| 342 |
if((0 != st.st_uidcxx . . $ stat#st_uid.) || (st.st_modecxx . . $ stat#st_mode. & (S_IWGRPcxx . . $ `<external>/531885356569766532/stat.h:181:9`! | S_IWOTHcxx . . $ `<external>/531885356569766532/stat.h:187:9`!))) { |
| 343 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "bad ownership/perms on %s", path); |
| 344 |
rslt = 1; |
| 345 |
break; |
| 346 |
} |
| 347 |
path[i + 1] = save; |
| 348 |
} |
| 349 |
i++; |
| 350 |
} |
| 351 |
if((NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! != opts) && (opts->flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_DEBUGcxx . . $ `pam_chroot.c:34:9`!)) { |
| 352 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, |
| 353 |
"%s: ownership/perms ok on %s", opts->modulecxx . . $ _pam_opts#module., path); |
| 354 |
} |
| 355 |
|
| 356 |
_pam_dropcxx . . $ `<external>/2287393389393091601/_pam_macros.h:45:9`!(path); |
| 357 |
return rslt; |
| 358 |
} |
| 359 |
|
| 360 |
/* expand chroot path */ |
| 361 |
/* path - string to expand |
| 362 |
* user - username, for %u expansion |
| 363 |
* grp - group, for %g expansion |
| 364 |
* match - name entry that was matched |
| 365 |
* matchptr - array of regmatch_t containing matched substrings (assume |
| 366 |
* at least 10 items in array) |
| 367 |
*/ |
| 368 |
char* _pam_expand_chroot_dircxx . . $ _pam_expand_chroot_dir(60af87a5f1864dc8).(const char* path, const char* user, |
| 369 |
const char* grp, const char* match, regmatch_tcxx . . $ regmatch_t#* matchptr, |
| 370 |
struct _pam_optscxx . . $ _pam_opts#* opts) |
| 371 |
{ |
| 372 |
char ref; /* ref char */ |
| 373 |
char *pos; /* ref position */ |
| 374 |
char *exp; /* expanded path */ |
| 375 |
int reflen; /* length of expanded path */ |
| 376 |
int refnum; /* number of regex backreference */ |
| 377 |
int offset = 0; /* search offset */ |
| 378 |
|
| 379 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == path || NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == user || NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == opts) { |
| 380 |
return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 381 |
} else if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == grp && (opts->flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_USE_GROUPScxx . . $ `pam_chroot.c:40:9`!)) { |
| 382 |
return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 383 |
} |
| 384 |
|
| •385 |
exp = strdupcxx . . $ strdup(a8b8e32347182212).(path); |
| 386 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == exp) { |
| 387 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "%s: strdup: %s", opts->modulecxx . . $ _pam_opts#module., strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 388 |
return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 389 |
} |
| 390 |
|
| 391 |
while(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! != (pos = strchrcxx . . $ strchr(2050848944e00d54).(exp + offset, '%'))) { |
| 392 |
offset = pos - exp; /* save for post-realloc */ |
| 393 |
reflen = 0; |
| 394 |
ref = *(pos + 1); |
| 395 |
|
| 396 |
if('u' == tolowercxx . . $ `<external>/17904084882347303253/ctype.h:220:11`!(ref)) { /* %u found */ |
| 397 |
reflen = strlencxx . . $ strlen(751346f8406fd082).(user); |
| 398 |
exp = (char*) realloccxx . . $ realloc(417ab160f6baadc6).(exp, strlencxx . . $ strlen(751346f8406fd082).(exp) + reflen - 1); |
| 399 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == exp) { break; } |
| 400 |
pos = exp + offset; |
| 401 |
memmovecxx . . $ memmove(cc817cb175f282d).(pos + reflen, pos + 2, strlencxx . . $ strlen(751346f8406fd082).(pos + 2) + 1); |
| 402 |
memcpycxx . . $ memcpy(cc817cb175f282d).(pos, user, reflen); |
| 403 |
|
| 404 |
} else if ('g' == tolowercxx . . $ `<external>/17904084882347303253/ctype.h:220:11`!(ref)) { /* %g found */ |
| 405 |
reflen = strlencxx . . $ strlen(751346f8406fd082).(grp); |
| 406 |
exp = (char*) realloccxx . . $ realloc(417ab160f6baadc6).(exp, strlencxx . . $ strlen(751346f8406fd082).(exp) + reflen - 1); |
| 407 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == exp) { break; } |
| 408 |
pos = exp + offset; |
| 409 |
memmovecxx . . $ memmove(cc817cb175f282d).(pos + reflen, pos + 2, strlencxx . . $ strlen(751346f8406fd082).(pos + 2) + 1); |
| 410 |
memcpycxx . . $ memcpy(cc817cb175f282d).(pos, grp, reflen); |
| 411 |
|
| 412 |
} else if (isdigitcxx . . $ `<external>/17904084882347303253/ctype.h:192:10`!(ref)) { /* backreference (%1...%9) found */ |
| 413 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == match) { |
| 414 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, |
| 415 |
"%s: backreference \"%%%c\" found, but subject of match is NULL", |
| 416 |
opts->modulecxx . . $ _pam_opts#module., ref); |
| 417 |
_pam_dropcxx . . $ `<external>/2287393389393091601/_pam_macros.h:45:9`!(exp); |
| 418 |
return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 419 |
} |
| 420 |
|
| 421 |
refnum = ref - '0'; |
| 422 |
if(-1 != matchptr[refnum].rm_socxx . . $ $anonymous_type_2410a2af4c2f900a_1#rm_so.) { /* submatch exists */ |
| 423 |
reflen = matchptr[refnum].rm_eocxx . . $ $anonymous_type_2410a2af4c2f900a_1#rm_eo. - matchptr[refnum].rm_socxx . . $ $anonymous_type_2410a2af4c2f900a_1#rm_so.; |
| 424 |
exp = (char*) realloccxx . . $ realloc(417ab160f6baadc6).(exp, strlencxx . . $ strlen(751346f8406fd082).(exp) + reflen + 1); |
| 425 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == exp) { break; } |
| 426 |
pos = exp + offset; |
| 427 |
memmovecxx . . $ memmove(cc817cb175f282d).(pos + reflen, pos + 2, strlencxx . . $ strlen(751346f8406fd082).(pos + 2) + 1); |
| 428 |
memcpycxx . . $ memcpy(cc817cb175f282d). (pos, match + matchptr[refnum].rm_socxx . . $ $anonymous_type_2410a2af4c2f900a_1#rm_so., reflen); |
| 429 |
} else { |
| 430 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, |
| 431 |
"%s: no submatch corresponding to backreference \"%%%c\"", |
| 432 |
opts->modulecxx . . $ _pam_opts#module., ref); |
| 433 |
_pam_dropcxx . . $ `<external>/2287393389393091601/_pam_macros.h:45:9`!(exp); |
| 434 |
return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 435 |
} |
| 436 |
|
| 437 |
} else if ('%' == ref) { /* %% found */ |
| 438 |
memmovecxx . . $ memmove(cc817cb175f282d).(pos, pos + 1, strlencxx . . $ strlen(751346f8406fd082).(pos) + 1); |
| 439 |
reflen = 1; |
| 440 |
|
| 441 |
} else { /* unknown ref */ |
| 442 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "%s: unknown reference \"%%%c\"", |
| 443 |
opts->modulecxx . . $ _pam_opts#module., ref); |
| 444 |
_pam_dropcxx . . $ `<external>/2287393389393091601/_pam_macros.h:45:9`!(exp); |
| 445 |
return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 446 |
} |
| 447 |
|
| 448 |
offset += reflen; /* skip past what we just copied */ |
| 449 |
} |
| 450 |
|
| 451 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == exp) { /* catch realloc errors - don't forget to free old exp! */ |
| 452 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "%s: realloc: %s", opts->modulecxx . . $ _pam_opts#module., strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 453 |
freecxx . . $ free(5d22bdacc48458e8).(pos - offset); |
| 454 |
return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 455 |
} |
| 456 |
|
| 457 |
if(opts->flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_DEBUGcxx . . $ `pam_chroot.c:34:9`!) { |
| 458 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, "%s: expanded path \"%s\" -> \"%s\"", |
| 459 |
opts->modulecxx . . $ _pam_opts#module., path, exp); |
| 460 |
} |
| 461 |
return exp; |
| 462 |
} |
| 463 |
|
| 464 |
/* parse the chroot.conf to find chroot_dir */ |
| 465 |
int _pam_get_chrootdircxx . . $ _pam_get_chrootdir(3fcfc58249a0c5c5).(const char* user, struct _pam_optscxx . . $ _pam_opts#* opts) { |
| 466 |
FILEcxx . . $ FILE#* conf; |
| 467 |
char conf_line[LINELENcxx . . $ `pam_chroot.c:28:9`!]; |
| 468 |
int lineno, err, name_is_group, regflags = REG_ICASEcxx . . $ `<external>/18190116149591951179/regex.h:314:9`!, i; |
| 469 |
char *name, *mark, *group = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, **group_list = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 470 |
|
| 471 |
if(opts->flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_SECCHECKScxx . . $ `pam_chroot.c:41:9`!) { |
| 472 |
/* don't need to distinguish the errors for now */ |
| 473 |
if(0 != _pam_check_path_permscxx . . $ _pam_check_path_perms(b50bf27db23a96af).(opts->confcxx . . $ _pam_opts#conf., opts)) { |
| 474 |
return _PAM_CHROOT_SYSERRcxx . . $ `pam_chroot.c:45:9`!; |
| 475 |
} |
| 476 |
} |
| 477 |
if(!(conf = fopencxx . . $ fopen(82ec0787cd37e0a3).(opts->confcxx . . $ _pam_opts#conf., "r"))) { |
| 478 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, |
| 479 |
"%s: fopen(%s): %s", opts->modulecxx . . $ _pam_opts#module., opts->confcxx . . $ _pam_opts#conf., strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 480 |
opts->chroot_dircxx . . $ _pam_opts#chroot_dir. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 481 |
return _PAM_CHROOT_SYSERRcxx . . $ `pam_chroot.c:45:9`!; |
| 482 |
} |
| 483 |
|
| 484 |
if(opts->flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_USE_GROUPScxx . . $ `pam_chroot.c:40:9`!) { |
| 485 |
group_list = _pam_get_groupscxx . . $ _pam_get_groups(7bbf6df382d9e75d).(user, opts); |
| 486 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == group_list) { /* probably some kind of malloc error */ |
| 487 |
fclosecxx . . $ fclose(89bc1efcdac0ca22).(conf); |
| 488 |
return _PAM_CHROOT_SYSERRcxx . . $ `pam_chroot.c:45:9`!; |
| 489 |
} else { |
| 490 |
group = group_list[0]; |
| 491 |
} |
| 492 |
} |
| 493 |
|
| 494 |
lineno = 0; err = 0; |
| 495 |
while(fgetscxx . . $ fgets(efb0aaba7ac866ae).(conf_line, LINELENcxx . . $ `pam_chroot.c:28:9`!, conf)) { |
| 496 |
++lineno; |
| 497 |
|
| 498 |
/* ignore comments and blank lines */ |
| 499 |
if((mark = strchrcxx . . $ strchr(2050848944e00d54).(conf_line, '#'))) { *mark = 0; } |
| 500 |
if(!(name = strtokcxx . . $ strtok(b7b3a83273496486).(conf_line, " \t\r\n"))) { continue; } |
| 501 |
|
| 502 |
/* ignore lines that contain usernames/regexps but not directories */ |
| 503 |
if(!(mark = strtokcxx . . $ strtok(b7b3a83273496486).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, " \t\r\n"))) { |
| 504 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "%s: %s %d: no directory", |
| 505 |
opts->modulecxx . . $ _pam_opts#module., opts->confcxx . . $ _pam_opts#conf., lineno); |
| 506 |
continue; |
| 507 |
} |
| 508 |
|
| 509 |
/* is it a group? */ |
| 510 |
name_is_group = 0; |
| 511 |
if('@' == name[0]) { |
| 512 |
if(opts->flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_USE_GROUPScxx . . $ `pam_chroot.c:40:9`!) { |
| 513 |
name_is_group = 1; |
| 514 |
name++; |
| 515 |
} else { |
| 516 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "%s: %s %d: found @group style syntax, but use_groups has not been turned on", |
| 517 |
opts->modulecxx . . $ _pam_opts#module., opts->confcxx . . $ _pam_opts#conf., lineno); |
| 518 |
fclosecxx . . $ fclose(89bc1efcdac0ca22).(conf); |
| 519 |
return _PAM_CHROOT_SYSERRcxx . . $ `pam_chroot.c:45:9`!; |
| 520 |
} |
| 521 |
} |
| 522 |
|
| 523 |
if(opts->flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_USE_REGEXcxx . . $ `pam_chroot.c:38:9`!) { |
| 524 |
regex_tcxx . . $ regex_t# name_regex; |
| 525 |
regmatch_tcxx . . $ regmatch_t# matchptr[10]; |
| 526 |
char const* match = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 527 |
if(opts->flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_USE_EXT_REGEXcxx . . $ `pam_chroot.c:39:9`!) { |
| 528 |
regflags |= REG_EXTENDEDcxx . . $ `<external>/18190116149591951179/regex.h:310:9`!; |
| 529 |
} |
| 530 |
|
| 531 |
if(0 != (err = regcompcxx . . $ regcomp(aa05013d3db24b3e).(&name_regex, name, regflags))) { |
| 532 |
size_t len = regerrorcxx . . $ regerror(b50a774f5c91fda6).(err, &name_regex, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0); |
| 533 |
char *errbuf = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(len); |
| 534 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == errbuf) { |
| 535 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "%s: %s: malloc: %s", |
| •536 |
opts->modulecxx . . $ _pam_opts#module., __extension__ __FUNCTION__, strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 537 |
if(opts->flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_USE_GROUPScxx . . $ `pam_chroot.c:40:9`!) { |
| 538 |
_pam_free_groupscxx . . $ _pam_free_groups(3ed91490e421178f).(group_list); |
| 539 |
} |
| 540 |
regfreecxx . . $ regfree(b1814a8fd6af504b).(&name_regex); |
| 541 |
fclosecxx . . $ fclose(89bc1efcdac0ca22).(conf); |
| 542 |
return _PAM_CHROOT_SYSERRcxx . . $ `pam_chroot.c:45:9`!; |
| 543 |
} |
| 544 |
regerrorcxx . . $ regerror(b50a774f5c91fda6).(err, &name_regex, errbuf, len); |
| 545 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "%s: %s %d: illegal regex \"%s\": %s", |
| 546 |
opts->modulecxx . . $ _pam_opts#module., opts->confcxx . . $ _pam_opts#conf., lineno, name, errbuf); |
| 547 |
|
| 548 |
freecxx . . $ free(5d22bdacc48458e8).(errbuf); |
| 549 |
regfreecxx . . $ regfree(b1814a8fd6af504b).(&name_regex); |
| 550 |
continue; /* with the next line */ |
| 551 |
} |
| 552 |
|
| 553 |
if(1 == name_is_group) { |
| 554 |
for(i = 0; NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! != group_list[i]; i++) { |
| 555 |
match = group_list[i]; |
| 556 |
err = regexeccxx . . $ regexec(7b724a18a85d26ac).(&name_regex, match, 10, matchptr, 0); |
| 557 |
if(0 == err) { break; } |
| 558 |
} |
| 559 |
} else { |
| 560 |
match = user; |
| 561 |
err = regexeccxx . . $ regexec(7b724a18a85d26ac).(&name_regex, match, 10, matchptr, 0); |
| 562 |
} |
| 563 |
regfreecxx . . $ regfree(b1814a8fd6af504b).(&name_regex); |
| 564 |
|
| 565 |
if(0 == err) { |
| 566 |
fclosecxx . . $ fclose(89bc1efcdac0ca22).(conf); |
| 567 |
|
| 568 |
opts->chroot_dircxx . . $ _pam_opts#chroot_dir. = _pam_expand_chroot_dircxx . . $ _pam_expand_chroot_dir(60af87a5f1864dc8).(mark, user, |
| 569 |
group, match, matchptr, opts); |
| 570 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == opts->chroot_dircxx . . $ _pam_opts#chroot_dir.) { |
| 571 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "%s: unable to expand chroot_dir", |
| 572 |
opts->modulecxx . . $ _pam_opts#module.); |
| 573 |
_pam_free_groupscxx . . $ _pam_free_groups(3ed91490e421178f).(group_list); |
| 574 |
return _PAM_CHROOT_SYSERRcxx . . $ `pam_chroot.c:45:9`!; |
| 575 |
} |
| 576 |
if (opts->flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_DEBUGcxx . . $ `pam_chroot.c:34:9`!) { |
| 577 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, |
| 578 |
"%s: found chroot_dir \"%s\" for user \"%s\"", |
| 579 |
opts->modulecxx . . $ _pam_opts#module., opts->chroot_dircxx . . $ _pam_opts#chroot_dir., user); |
| 580 |
} |
| 581 |
_pam_free_groupscxx . . $ _pam_free_groups(3ed91490e421178f).(group_list); |
| 582 |
|
| 583 |
return _PAM_CHROOT_OKcxx . . $ `pam_chroot.c:46:9`!; |
| 584 |
} |
| 585 |
} else { |
| 586 |
char* tmp = name; |
| 587 |
|
| 588 |
/* tack a NULL at the end of the name field */ |
| 589 |
while(('\0' != *tmp) && !isspacecxx . . $ `<external>/17904084882347303253/ctype.h:197:10`!(*tmp)) { tmp++; } |
| 590 |
*tmp = '\0'; |
| 591 |
|
| 592 |
if(1 == name_is_group) { |
| 593 |
for(i = 0; NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! != group_list[i]; i++) { |
| 594 |
if(0 == (err = strcmpcxx . . $ strcmp(5ae29d726ae57f88).(group_list[i], name))) { break; } |
| 595 |
} |
| 596 |
} else { |
| 597 |
err = strcmpcxx . . $ strcmp(5ae29d726ae57f88).(user, name); |
| 598 |
} |
| 599 |
|
| 600 |
if(0 == err) { |
| 601 |
fclosecxx . . $ fclose(89bc1efcdac0ca22).(conf); |
| 602 |
|
| 603 |
opts->chroot_dircxx . . $ _pam_opts#chroot_dir. = _pam_expand_chroot_dircxx . . $ _pam_expand_chroot_dir(60af87a5f1864dc8).(mark, user, |
| 604 |
group, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, opts); |
| 605 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == opts->chroot_dircxx . . $ _pam_opts#chroot_dir.) { |
| 606 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "%s: unable to expand chroot_dir", |
| 607 |
opts->modulecxx . . $ _pam_opts#module.); |
| 608 |
return _PAM_CHROOT_SYSERRcxx . . $ `pam_chroot.c:45:9`!; |
| 609 |
} |
| 610 |
if (opts->flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_DEBUGcxx . . $ `pam_chroot.c:34:9`!) { |
| 611 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, |
| 612 |
"%s: found chroot_dir \"%s\" for user \"%s\"", |
| 613 |
opts->modulecxx . . $ _pam_opts#module., opts->chroot_dircxx . . $ _pam_opts#chroot_dir., user); |
| 614 |
} |
| 615 |
_pam_free_groupscxx . . $ _pam_free_groups(3ed91490e421178f).(group_list); |
| 616 |
return _PAM_CHROOT_OKcxx . . $ `pam_chroot.c:46:9`!; |
| 617 |
} |
| 618 |
} |
| 619 |
if(opts->flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_DEBUGcxx . . $ `pam_chroot.c:34:9`!) { |
| 620 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, |
| 621 |
"%s: \"%s\" does not match \"%s\"", |
| 622 |
opts->modulecxx . . $ _pam_opts#module., user, conf_line); |
| 623 |
} |
| 624 |
} /* end while(fgets(conf_line, LINELEN, conf)) */ |
| 625 |
|
| 626 |
if(opts->flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_DEBUGcxx . . $ `pam_chroot.c:34:9`!) { |
| 627 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, |
| 628 |
"%s: no match found for user \"%s\" in conf file \"%s\"", |
| 629 |
opts->modulecxx . . $ _pam_opts#module., user, opts->confcxx . . $ _pam_opts#conf.); |
| 630 |
} |
| 631 |
fclosecxx . . $ fclose(89bc1efcdac0ca22).(conf); |
| 632 |
_pam_free_groupscxx . . $ _pam_free_groups(3ed91490e421178f).(group_list); |
| 633 |
opts->chroot_dircxx . . $ _pam_opts#chroot_dir. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 634 |
return _PAM_CHROOT_USERNOTFOUNDcxx . . $ `pam_chroot.c:47:9`!; |
| 635 |
} |
| 636 |
|
| 637 |
/* This is the workhorse function. All of the pam_sm_* functions should |
| 638 |
* initialize a _pam_opts struct with the command line args and flags, |
| 639 |
* then pass it to this function */ |
| 640 |
int _pam_do_chrootcxx . . $ _pam_do_chroot(a02f5bc360a79b2b).(pam_handle_tcxx . . $ pam_handle_t# *pamh, struct _pam_optscxx . . $ _pam_opts# *opts) { |
| 641 |
int err,debug; |
| 642 |
char const *user; |
| 643 |
|
| 644 |
debug = opts->flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_DEBUGcxx . . $ `pam_chroot.c:34:9`!; |
| 645 |
|
| 646 |
err = pam_get_usercxx . . $ pam_get_user(4c637adc70a57032).(pamh, &user, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 647 |
if(PAM_CONV_AGAINcxx . . $ `<external>/1475977469199658974/_pam_types.h:79:9`! == err) { |
| 648 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, "$s: retry username lookup later", opts->modulecxx . . $ _pam_opts#module.); |
| 649 |
return _PAM_CHROOT_INCOMPLETEcxx . . $ `pam_chroot.c:48:9`!; |
| 650 |
} else if(PAM_SUCCESScxx . . $ `<external>/1475977469199658974/_pam_types.h:29:9`! != err) { |
| 651 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "%s: can't get username", opts->modulecxx . . $ _pam_opts#module.); |
| 652 |
return _PAM_CHROOT_SYSERRcxx . . $ `pam_chroot.c:45:9`!; |
| 653 |
} |
| 654 |
|
| 655 |
if(opts->chroot_dircxx . . $ _pam_opts#chroot_dir.) { /* overrides the conf file */ |
| 656 |
if(debug) { |
| 657 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, |
| 658 |
"%s: chrootdir (%s) specified, ignoring conf file", |
| 659 |
opts->modulecxx . . $ _pam_opts#module., opts->chroot_dircxx . . $ _pam_opts#chroot_dir.); |
| 660 |
} |
| 661 |
err = _PAM_CHROOT_OKcxx . . $ `pam_chroot.c:46:9`!; |
| 662 |
} else { |
| 663 |
if(debug) { |
| 664 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, |
| 665 |
"%s: reading config file (%s)", opts->modulecxx . . $ _pam_opts#module., opts->confcxx . . $ _pam_opts#conf.); |
| 666 |
} |
| 667 |
err = _pam_get_chrootdircxx . . $ _pam_get_chrootdir(3fcfc58249a0c5c5).(user, opts); |
| 668 |
} |
| 669 |
|
| 670 |
if(_PAM_CHROOT_OKcxx . . $ `pam_chroot.c:46:9`! == err) { |
| 671 |
if(debug) { |
| 672 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, "%s: preparing to chroot()", opts->modulecxx . . $ _pam_opts#module.); |
| 673 |
} |
| 674 |
|
| 675 |
if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == opts->chroot_dircxx . . $ _pam_opts#chroot_dir.) { |
| 676 |
/* This is a state that I should never see. If the user wasn't in |
| 677 |
* the conf file, then USERNOTFOUND should have been returned. */ |
| 678 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, |
| 679 |
"%s: no chroot_dir set for \"%s\"", opts->modulecxx . . $ _pam_opts#module., user); |
| 680 |
return _PAM_CHROOT_INTERNALERRcxx . . $ `pam_chroot.c:44:9`!; |
| 681 |
} |
| 682 |
|
| 683 |
if(opts->flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_SECCHECKScxx . . $ `pam_chroot.c:41:9`!) { |
| 684 |
if(0 != _pam_check_path_permscxx . . $ _pam_check_path_perms(b50bf27db23a96af).(opts->chroot_dircxx . . $ _pam_opts#chroot_dir., opts)) { |
| 685 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, |
| 686 |
"%s: chroot_dir \"%s\" failed security check", |
| 687 |
opts->modulecxx . . $ _pam_opts#module., opts->chroot_dircxx . . $ _pam_opts#chroot_dir.); |
| 688 |
return _PAM_CHROOT_SYSERRcxx . . $ `pam_chroot.c:45:9`!; |
| 689 |
} |
| 690 |
} |
| 691 |
|
| 692 |
if(opts->flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_NO_CHROOTcxx . . $ `pam_chroot.c:37:9`!) { |
| 693 |
if(debug) { |
| 694 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, |
| 695 |
"%s: no_chroot is set, skipping chroot(%s)", |
| 696 |
opts->modulecxx . . $ _pam_opts#module., opts->chroot_dircxx . . $ _pam_opts#chroot_dir.); |
| 697 |
} |
| 698 |
} else if(chdircxx . . $ chdir(5c4306d8553b3696).(opts->chroot_dircxx . . $ _pam_opts#chroot_dir.) != 0) { |
| 699 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, |
| 700 |
"%s: chdir(%s): %s", |
| 701 |
opts->modulecxx . . $ _pam_opts#module., opts->chroot_dircxx . . $ _pam_opts#chroot_dir., strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 702 |
return _PAM_CHROOT_SYSERRcxx . . $ `pam_chroot.c:45:9`!; |
| 703 |
} else if(chrootcxx . . $ chroot(5c4306d8553b3696).(opts->chroot_dircxx . . $ _pam_opts#chroot_dir.) != 0) { |
| 704 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, |
| 705 |
"%s: chroot(%s): %s", |
| 706 |
opts->modulecxx . . $ _pam_opts#module., opts->chroot_dircxx . . $ _pam_opts#chroot_dir., strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 707 |
return _PAM_CHROOT_SYSERRcxx . . $ `pam_chroot.c:45:9`!; |
| 708 |
} else { |
| 709 |
if(debug) { |
| 710 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, |
| 711 |
"%s: chroot(%s) ok", opts->modulecxx . . $ _pam_opts#module., opts->chroot_dircxx . . $ _pam_opts#chroot_dir.); |
| 712 |
} |
| 713 |
} |
| 714 |
return _PAM_CHROOT_OKcxx . . $ `pam_chroot.c:46:9`!; |
| 715 |
} else if(_PAM_CHROOT_USERNOTFOUNDcxx . . $ `pam_chroot.c:47:9`! == err) { |
| 716 |
if(debug) { |
| 717 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, "%s: no match for %s in %s", |
| 718 |
opts->modulecxx . . $ _pam_opts#module., user, opts->confcxx . . $ _pam_opts#conf.); |
| 719 |
} |
| 720 |
return _PAM_CHROOT_USERNOTFOUNDcxx . . $ `pam_chroot.c:47:9`!; |
| 721 |
} else { |
| 722 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, |
| 723 |
"%s: error determining chrootdir: user=\"%s\", dir=\"%s\"", |
| 724 |
opts->modulecxx . . $ _pam_opts#module., user, opts->chroot_dircxx . . $ _pam_opts#chroot_dir.); |
| 725 |
return err; |
| 726 |
} |
| 727 |
} |
| 728 |
|
| 729 |
PAM_EXTERNcxx . . $ `<external>/5130975668888882828/pam_modules.h:80:9`! int pam_sm_authenticatecxx . . $ pam_sm_authenticate(60e77177d68aa4a0).(pam_handle_tcxx . . $ pam_handle_t# *pamh, int flags, |
| 730 |
int argc, const char **argv) |
| 731 |
{ |
| 732 |
int err; |
| 733 |
struct _pam_optscxx . . $ _pam_opts# opts; |
| 734 |
|
| 735 |
_pam_opts_initcxx . . $ _pam_opts_init(8668569be3176d09).(&opts); |
| 736 |
_pam_opts_configcxx . . $ _pam_opts_config(f3ebb82247d488f7).(&opts, flags, argc, argv); |
| 737 |
opts.modulecxx . . $ _pam_opts#module. = "auth"; |
| 738 |
|
| 739 |
err = _pam_do_chrootcxx . . $ _pam_do_chroot(a02f5bc360a79b2b).(pamh, &opts); |
| 740 |
switch(err) { |
| 741 |
case _PAM_CHROOT_OKcxx . . $ `pam_chroot.c:46:9`!: |
| 742 |
if(opts.flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_DEBUGcxx . . $ `pam_chroot.c:34:9`!) { |
| 743 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, "%s: returning success", opts.modulecxx . . $ _pam_opts#module.); |
| 744 |
} |
| 745 |
err = PAM_SUCCESScxx . . $ `<external>/1475977469199658974/_pam_types.h:29:9`!; |
| 746 |
break; |
| 747 |
|
| 748 |
case _PAM_CHROOT_USERNOTFOUNDcxx . . $ `pam_chroot.c:47:9`!: |
| 749 |
if(opts.flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_DEBUGcxx . . $ `pam_chroot.c:34:9`!) { |
| 750 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, "%s: unknown user", opts.modulecxx . . $ _pam_opts#module.); |
| 751 |
} |
| 752 |
err = PAM_USER_UNKNOWNcxx . . $ `<external>/1475977469199658974/_pam_types.h:43:9`!; |
| 753 |
break; |
| 754 |
|
| 755 |
case _PAM_CHROOT_INCOMPLETEcxx . . $ `pam_chroot.c:48:9`!: |
| 756 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, "%s: returning incomplete", opts.modulecxx . . $ _pam_opts#module.); |
| 757 |
err = PAM_INCOMPLETEcxx . . $ `<external>/1475977469199658974/_pam_types.h:81:9`!; |
| 758 |
break; |
| 759 |
|
| 760 |
case _PAM_CHROOT_INTERNALERRcxx . . $ `pam_chroot.c:44:9`!: |
| 761 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "%s: internal error encountered", opts.modulecxx . . $ _pam_opts#module.); |
| 762 |
err = PAM_AUTH_ERRcxx . . $ `<external>/1475977469199658974/_pam_types.h:37:9`!; |
| 763 |
break; |
| 764 |
|
| 765 |
default: |
| 766 |
if(opts.flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_DEBUGcxx . . $ `pam_chroot.c:34:9`!) { |
| 767 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, "%s: returning failure", opts.modulecxx . . $ _pam_opts#module.); |
| 768 |
} |
| 769 |
err = PAM_AUTH_ERRcxx . . $ `<external>/1475977469199658974/_pam_types.h:37:9`!; |
| 770 |
break; |
| 771 |
} |
| 772 |
_pam_opts_freecxx . . $ _pam_opts_free(8668569be3176d09).(&opts); |
| 773 |
return err; |
| 774 |
} |
| 775 |
|
| 776 |
PAM_EXTERNcxx . . $ `<external>/5130975668888882828/pam_modules.h:80:9`! int pam_sm_setcredcxx . . $ pam_sm_setcred(60e77177d68aa4a0).(pam_handle_tcxx . . $ pam_handle_t# *pamh, int flags, |
| 777 |
int argc, const char **argv) |
| 778 |
{ |
| 779 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "not a credentialator"); |
| 780 |
return PAM_IGNOREcxx . . $ `<external>/1475977469199658974/_pam_types.h:71:9`!; |
| 781 |
} |
| 782 |
|
| 783 |
PAM_EXTERNcxx . . $ `<external>/5130975668888882828/pam_modules.h:80:9`! int pam_sm_acct_mgmtcxx . . $ pam_sm_acct_mgmt(60e77177d68aa4a0).(pam_handle_tcxx . . $ pam_handle_t# *pamh, int flags, |
| 784 |
int argc, const char **argv) |
| 785 |
{ |
| 786 |
int err; |
| 787 |
struct _pam_optscxx . . $ _pam_opts# opts; |
| 788 |
|
| 789 |
_pam_opts_initcxx . . $ _pam_opts_init(8668569be3176d09).(&opts); |
| 790 |
_pam_opts_configcxx . . $ _pam_opts_config(f3ebb82247d488f7).(&opts, flags, argc, argv); |
| 791 |
opts.modulecxx . . $ _pam_opts#module. = "account"; |
| 792 |
|
| 793 |
err = _pam_do_chrootcxx . . $ _pam_do_chroot(a02f5bc360a79b2b).(pamh, &opts); |
| 794 |
switch(err) { |
| 795 |
case _PAM_CHROOT_OKcxx . . $ `pam_chroot.c:46:9`!: |
| 796 |
if(opts.flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_DEBUGcxx . . $ `pam_chroot.c:34:9`!) { |
| 797 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, "%s: returning success", opts.modulecxx . . $ _pam_opts#module.); |
| 798 |
} |
| 799 |
err = PAM_SUCCESScxx . . $ `<external>/1475977469199658974/_pam_types.h:29:9`!; |
| 800 |
break; |
| 801 |
|
| 802 |
case _PAM_CHROOT_USERNOTFOUNDcxx . . $ `pam_chroot.c:47:9`!: |
| 803 |
if(opts.flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_DEBUGcxx . . $ `pam_chroot.c:34:9`!) { |
| 804 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, "%s: unknown user", opts.modulecxx . . $ _pam_opts#module.); |
| 805 |
} |
| 806 |
err = PAM_USER_UNKNOWNcxx . . $ `<external>/1475977469199658974/_pam_types.h:43:9`!; |
| 807 |
break; |
| 808 |
|
| 809 |
case _PAM_CHROOT_INCOMPLETEcxx . . $ `pam_chroot.c:48:9`!: |
| 810 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, "%s: returning incomplete", opts.modulecxx . . $ _pam_opts#module.); |
| 811 |
err = PAM_INCOMPLETEcxx . . $ `<external>/1475977469199658974/_pam_types.h:81:9`!; |
| 812 |
break; |
| 813 |
|
| 814 |
case _PAM_CHROOT_INTERNALERRcxx . . $ `pam_chroot.c:44:9`!: |
| 815 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "%s: internal error encountered", opts.modulecxx . . $ _pam_opts#module.); |
| 816 |
err = PAM_AUTH_ERRcxx . . $ `<external>/1475977469199658974/_pam_types.h:37:9`!; |
| 817 |
break; |
| 818 |
|
| 819 |
default: |
| 820 |
if(opts.flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_DEBUGcxx . . $ `pam_chroot.c:34:9`!) { |
| 821 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, "%s: returning failure", opts.modulecxx . . $ _pam_opts#module.); |
| 822 |
} |
| 823 |
err = PAM_AUTH_ERRcxx . . $ `<external>/1475977469199658974/_pam_types.h:37:9`!; |
| 824 |
break; |
| 825 |
} |
| 826 |
_pam_opts_freecxx . . $ _pam_opts_free(8668569be3176d09).(&opts); |
| 827 |
return err; |
| 828 |
} |
| 829 |
|
| 830 |
PAM_EXTERNcxx . . $ `<external>/5130975668888882828/pam_modules.h:80:9`! int pam_sm_open_sessioncxx . . $ pam_sm_open_session(60e77177d68aa4a0).(pam_handle_tcxx . . $ pam_handle_t# *pamh, int flags, |
| 831 |
int argc, const char **argv) |
| 832 |
{ |
| 833 |
int err; |
| 834 |
struct _pam_optscxx . . $ _pam_opts# opts; |
| 835 |
|
| 836 |
_pam_opts_initcxx . . $ _pam_opts_init(8668569be3176d09).(&opts); |
| 837 |
_pam_opts_configcxx . . $ _pam_opts_config(f3ebb82247d488f7).(&opts, flags, argc, argv); |
| 838 |
opts.modulecxx . . $ _pam_opts#module. = "session"; |
| 839 |
|
| 840 |
err = _pam_do_chrootcxx . . $ _pam_do_chroot(a02f5bc360a79b2b).(pamh, &opts); |
| 841 |
switch(err) { |
| 842 |
case _PAM_CHROOT_OKcxx . . $ `pam_chroot.c:46:9`!: |
| 843 |
if(opts.flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_DEBUGcxx . . $ `pam_chroot.c:34:9`!) { |
| 844 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, "%s: returning success", opts.modulecxx . . $ _pam_opts#module.); |
| 845 |
} |
| 846 |
err = PAM_SUCCESScxx . . $ `<external>/1475977469199658974/_pam_types.h:29:9`!; |
| 847 |
break; |
| 848 |
|
| 849 |
case _PAM_CHROOT_USERNOTFOUNDcxx . . $ `pam_chroot.c:47:9`!: |
| 850 |
if(opts.flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_NOTFOUNDFAILScxx . . $ `pam_chroot.c:36:9`!) { |
| 851 |
if(opts.flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_DEBUGcxx . . $ `pam_chroot.c:34:9`!) { |
| 852 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, |
| 853 |
"%s: notfound=failure is set, returning failure", |
| 854 |
opts.modulecxx . . $ _pam_opts#module.); |
| 855 |
} |
| 856 |
err = PAM_SESSION_ERRcxx . . $ `<external>/1475977469199658974/_pam_types.h:56:9`!; |
| 857 |
} else { |
| 858 |
err = PAM_SUCCESScxx . . $ `<external>/1475977469199658974/_pam_types.h:29:9`!; |
| 859 |
} |
| 860 |
break; |
| 861 |
|
| 862 |
case _PAM_CHROOT_INCOMPLETEcxx . . $ `pam_chroot.c:48:9`!: |
| 863 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, "%s: returning incomplete", opts.modulecxx . . $ _pam_opts#module.); |
| 864 |
err = PAM_INCOMPLETEcxx . . $ `<external>/1475977469199658974/_pam_types.h:81:9`!; |
| 865 |
break; |
| 866 |
|
| 867 |
case _PAM_CHROOT_INTERNALERRcxx . . $ `pam_chroot.c:44:9`!: |
| 868 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "%s: internal error encountered", opts.modulecxx . . $ _pam_opts#module.); |
| 869 |
err = PAM_SESSION_ERRcxx . . $ `<external>/1475977469199658974/_pam_types.h:56:9`!; |
| 870 |
break; |
| 871 |
|
| 872 |
default: |
| •873 |
if(opts.flagscxx . . $ _pam_opts#flags. & _PAM_OPTS_DEBUGcxx . . $ `pam_chroot.c:34:9`!) { |
| 874 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, "%s: returning failure", opts.modulecxx . . $ _pam_opts#module.); |
| 875 |
} |
| 876 |
err = PAM_SESSION_ERRcxx . . $ `<external>/1475977469199658974/_pam_types.h:56:9`!; |
| 877 |
break; |
| 878 |
} |
| 879 |
_pam_opts_freecxx . . $ _pam_opts_free(8668569be3176d09).(&opts); |
| 880 |
return err; |
| 881 |
} |
| 882 |
|
| 883 |
|
| 884 |
PAM_EXTERNcxx . . $ `<external>/5130975668888882828/pam_modules.h:80:9`! int pam_sm_close_sessioncxx . . $ pam_sm_close_session(60e77177d68aa4a0).(pam_handle_tcxx . . $ pam_handle_t# *pamh, int flags, |
| 885 |
int argc, const char **argv) |
| 886 |
{ |
| 887 |
return PAM_SUCCESScxx . . $ `<external>/1475977469199658974/_pam_types.h:29:9`!; |
| 888 |
} |
| 889 |
|
| 890 |
PAM_EXTERNcxx . . $ `<external>/5130975668888882828/pam_modules.h:80:9`! int pam_sm_chauthtokcxx . . $ pam_sm_chauthtok(60e77177d68aa4a0).(pam_handle_tcxx . . $ pam_handle_t# *pamh, int flags, |
| 891 |
int argc, const char **argv) |
| 892 |
{ |
| 893 |
_pam_logcxx . . $ _pam_log(afcfcee7634adf7d).(LOG_ERRcxx . . $ `<external>/6168640806541382331/syslog.h:54:9`!, "password management group is unsupported"); |
| 894 |
return PAM_SERVICE_ERRcxx . . $ `<external>/1475977469199658974/_pam_types.h:33:9`!; |
| 895 |
} |
| 896 |
|