Changeset 740 for vendor/current/source3/pam_smbpass
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- Location:
- vendor/current/source3/pam_smbpass
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/pam_smbpass/general.h
r414 r740 1 #include "../librpc/gen_ndr/samr.h" 2 #include "../libcli/auth/pam_errors.h" 3 #include "passdb.h" 4 1 5 #ifndef LINUX 2 6 /* This is only needed by modules in the Sun implementation. */ … … 117 121 */ 118 122 119 #define FAIL_PREFIX "-SMB-FAIL-"120 123 #define SMB_MAX_RETRIES 3 121 124 -
vendor/current/source3/pam_smbpass/pam_smb_acct.c
r414 r740 58 58 59 59 /* Samba initialization. */ 60 load_case_tables ();60 load_case_tables_library(); 61 61 lp_set_in_client(True); 62 62 … … 83 83 /* Getting into places that might use LDAP -- protect the app 84 84 from a SIGPIPE it's not expecting */ 85 oldsig_handler = CatchSignal(SIGPIPE, SIG NAL_CAST SIG_IGN);85 oldsig_handler = CatchSignal(SIGPIPE, SIG_IGN); 86 86 if (!initialize_password_db(True, NULL)) { 87 87 _log_err(pamh, LOG_ALERT, "Cannot access samba password database" ); 88 CatchSignal(SIGPIPE, SIGNAL_CASToldsig_handler);88 CatchSignal(SIGPIPE, oldsig_handler); 89 89 return PAM_AUTHINFO_UNAVAIL; 90 90 } … … 93 93 94 94 if (!(sampass = samu_new( NULL ))) { 95 CatchSignal(SIGPIPE, SIGNAL_CASToldsig_handler);95 CatchSignal(SIGPIPE, oldsig_handler); 96 96 /* malloc fail. */ 97 97 return nt_status_to_pam(NT_STATUS_NO_MEMORY); … … 100 100 if (!pdb_getsampwnam(sampass, name )) { 101 101 _log_err(pamh, LOG_DEBUG, "acct: could not identify user"); 102 CatchSignal(SIGPIPE, SIGNAL_CASToldsig_handler);102 CatchSignal(SIGPIPE, oldsig_handler); 103 103 return PAM_USER_UNKNOWN; 104 104 } … … 106 106 /* check for lookup failure */ 107 107 if (!strlen(pdb_get_username(sampass)) ) { 108 CatchSignal(SIGPIPE, SIGNAL_CASToldsig_handler);108 CatchSignal(SIGPIPE, oldsig_handler); 109 109 return PAM_USER_UNKNOWN; 110 110 } … … 119 119 "please see your system administrator." ); 120 120 121 CatchSignal(SIGPIPE, SIGNAL_CASToldsig_handler);121 CatchSignal(SIGPIPE, oldsig_handler); 122 122 return PAM_ACCT_EXPIRED; 123 123 } … … 125 125 /* TODO: support for expired passwords. */ 126 126 127 CatchSignal(SIGPIPE, SIGNAL_CASToldsig_handler);127 CatchSignal(SIGPIPE, oldsig_handler); 128 128 return PAM_SUCCESS; 129 129 } -
vendor/current/source3/pam_smbpass/pam_smb_auth.c
r414 r740 19 19 20 20 #include "includes.h" 21 #include " debug.h"21 #include "lib/util/debug.h" 22 22 23 23 #ifndef LINUX … … 45 45 do { \ 46 46 /* Restore application signal handler */ \ 47 CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);\47 CatchSignal(SIGPIPE, oldsig_handler); \ 48 48 if(ret_data) { \ 49 49 *ret_data = retval; \ … … 81 81 82 82 /* Samba initialization. */ 83 load_case_tables ();83 load_case_tables_library(); 84 84 lp_set_in_client(True); 85 85 … … 93 93 /* Getting into places that might use LDAP -- protect the app 94 94 from a SIGPIPE it's not expecting */ 95 oldsig_handler = CatchSignal(SIGPIPE, SIG NAL_CAST SIG_IGN);95 oldsig_handler = CatchSignal(SIGPIPE, SIG_IGN); 96 96 97 97 /* get the username */ -
vendor/current/source3/pam_smbpass/pam_smb_passwd.c
r414 r740 106 106 107 107 /* Samba initialization. */ 108 load_case_tables ();108 load_case_tables_library(); 109 109 lp_set_in_client(True); 110 110 … … 134 134 /* Getting into places that might use LDAP -- protect the app 135 135 from a SIGPIPE it's not expecting */ 136 oldsig_handler = CatchSignal(SIGPIPE, SIG NAL_CAST SIG_IGN);136 oldsig_handler = CatchSignal(SIGPIPE, SIG_IGN); 137 137 138 138 if (!initialize_password_db(False, NULL)) { 139 139 _log_err(pamh, LOG_ALERT, "Cannot access samba password database" ); 140 CatchSignal(SIGPIPE, SIGNAL_CASToldsig_handler);140 CatchSignal(SIGPIPE, oldsig_handler); 141 141 return PAM_AUTHINFO_UNAVAIL; 142 142 } … … 144 144 /* obtain user record */ 145 145 if ( !(sampass = samu_new( NULL )) ) { 146 CatchSignal(SIGPIPE, SIGNAL_CASToldsig_handler);146 CatchSignal(SIGPIPE, oldsig_handler); 147 147 return nt_status_to_pam(NT_STATUS_NO_MEMORY); 148 148 } … … 150 150 if (!pdb_getsampwnam(sampass,user)) { 151 151 _log_err(pamh, LOG_ALERT, "Failed to find entry for user %s.", user); 152 CatchSignal(SIGPIPE, SIGNAL_CASToldsig_handler);152 CatchSignal(SIGPIPE, oldsig_handler); 153 153 return PAM_USER_UNKNOWN; 154 154 } … … 168 168 169 169 TALLOC_FREE(sampass); 170 CatchSignal(SIGPIPE, SIGNAL_CASToldsig_handler);170 CatchSignal(SIGPIPE, oldsig_handler); 171 171 return PAM_SUCCESS; 172 172 } … … 177 177 178 178 /* tell user what is happening */ 179 #define greeting "Changing password for " 180 Announce = SMB_MALLOC_ARRAY(char, sizeof(greeting)+strlen(user)); 181 if (Announce == NULL) { 182 _log_err(pamh, LOG_CRIT, "password: out of memory"); 183 TALLOC_FREE(sampass); 184 CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler); 185 return PAM_BUF_ERR; 186 } 187 strncpy( Announce, greeting, sizeof(greeting) ); 188 strncpy( Announce+sizeof(greeting)-1, user, strlen(user)+1 ); 189 #undef greeting 179 if (asprintf(&Announce, "Changing password for %s", user) == -1) { 180 _log_err(pamh, LOG_CRIT, "password: out of memory"); 181 TALLOC_FREE(sampass); 182 CatchSignal(SIGPIPE, oldsig_handler); 183 return PAM_BUF_ERR; 184 } 190 185 191 186 set( SMB__OLD_PASSWD, ctrl ); … … 198 193 "password - (old) token not obtained"); 199 194 TALLOC_FREE(sampass); 200 CatchSignal(SIGPIPE, SIGNAL_CASToldsig_handler);195 CatchSignal(SIGPIPE, oldsig_handler); 201 196 return retval; 202 197 } … … 213 208 pass_old = NULL; 214 209 TALLOC_FREE(sampass); 215 CatchSignal(SIGPIPE, SIGNAL_CASToldsig_handler);210 CatchSignal(SIGPIPE, oldsig_handler); 216 211 return retval; 217 212 … … 243 238 _log_err(pamh, LOG_NOTICE, "password: user not authenticated"); 244 239 TALLOC_FREE(sampass); 245 CatchSignal(SIGPIPE, SIGNAL_CASToldsig_handler);240 CatchSignal(SIGPIPE, oldsig_handler); 246 241 return retval; 247 242 } … … 271 266 pass_old = NULL; /* tidy up */ 272 267 TALLOC_FREE(sampass); 273 CatchSignal(SIGPIPE, SIGNAL_CASToldsig_handler);268 CatchSignal(SIGPIPE, oldsig_handler); 274 269 return retval; 275 270 } … … 291 286 pass_new = pass_old = NULL; /* tidy up */ 292 287 TALLOC_FREE(sampass); 293 CatchSignal(SIGPIPE, SIGNAL_CASToldsig_handler);288 CatchSignal(SIGPIPE, oldsig_handler); 294 289 return retval; 295 290 } … … 340 335 341 336 TALLOC_FREE(sampass); 342 CatchSignal(SIGPIPE, SIGNAL_CASToldsig_handler);337 CatchSignal(SIGPIPE, oldsig_handler); 343 338 return retval; 344 339 } -
vendor/current/source3/pam_smbpass/support.c
r414 r740 20 20 21 21 #include "support.h" 22 #include "secrets.h" 22 23 23 24 #include "../libcli/auth/libcli_auth.h" … … 93 94 { 94 95 va_list args; 95 const char tag[] = "(pam_smbpass) ";96 96 char *mod_format; 97 97 98 mod_format = SMB_MALLOC_ARRAY(char, sizeof(tag) + strlen(format)); 99 /* try really, really hard to log something, since this may have 100 been a message about a malloc() failure... */ 101 if (mod_format == NULL) { 98 if (asprintf(&mod_format, "(pam_smbpass) %s", format) == -1) { 99 /* 100 * try really, really hard to log something, since 101 * this may have been a message about a malloc() 102 * failure... 103 */ 102 104 va_start(args, format); 103 105 vsyslog(err | LOG_AUTH, format, args); … … 105 107 return; 106 108 } 107 108 strncpy(mod_format, tag, strlen(tag)+1);109 strlcat(mod_format, format, strlen(format)+1);110 109 111 110 va_start(args, format); … … 381 380 } 382 381 383 data_name = SMB_MALLOC_ARRAY(char, sizeof(FAIL_PREFIX) + strlen( name )); 384 if (data_name == NULL) { 382 if (asprintf(&data_name, "-SMB-FAIL- %s", name) == -1) { 385 383 _log_err(pamh, LOG_CRIT, "no memory for data-name" ); 386 384 return PAM_AUTH_ERR; 387 385 } 388 strncpy( data_name, FAIL_PREFIX, sizeof(FAIL_PREFIX) );389 strncpy( data_name + sizeof(FAIL_PREFIX) - 1, name, strlen( name ) + 1 );390 386 391 387 /*
Note:
See TracChangeset
for help on using the changeset viewer.