summaryrefslogtreecommitdiff
path: root/source3/pam_smbpass
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2006-02-20 20:09:36 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:10:15 -0500
commit2203bed32c84c63737f402accf73452efb76b483 (patch)
tree76259a35b1137cfa89547b80b2b93eb0eedf5bcf /source3/pam_smbpass
parent69b2669b559c009d17f621cbc7c6937eafc56af6 (diff)
downloadsamba-2203bed32c84c63737f402accf73452efb76b483.tar.gz
samba-2203bed32c84c63737f402accf73452efb76b483.tar.bz2
samba-2203bed32c84c63737f402accf73452efb76b483.zip
r13576: This is the beginnings of moving the SAM_ACCOUNT data structure
to make full use of the new talloc() interface. Discussed with Volker and Jeremy. * remove the internal mem_ctx and simply use the talloc() structure as the context. * replace the internal free_fn() with a talloc_destructor() function * remove the unnecessary private nested structure * rename SAM_ACCOUNT to 'struct samu' to indicate the current an upcoming changes. Groups will most likely be replaced with a 'struct samg' in the future. Note that there are now passbd API changes. And for the most part, the wrapper functions remain the same. While this code has been tested on tdb and ldap based Samba PDC's as well as Samba member servers, there are probably still some bugs. The code also needs more testing under valgrind to ensure it's not leaking memory. But it's a start...... (This used to be commit 19b7593972480540283c5bf02c02e5ecd8d2c3f0)
Diffstat (limited to 'source3/pam_smbpass')
-rw-r--r--source3/pam_smbpass/pam_smb_acct.c2
-rw-r--r--source3/pam_smbpass/pam_smb_auth.c16
-rw-r--r--source3/pam_smbpass/pam_smb_passwd.c22
-rw-r--r--source3/pam_smbpass/support.c4
-rw-r--r--source3/pam_smbpass/support.h4
5 files changed, 24 insertions, 24 deletions
diff --git a/source3/pam_smbpass/pam_smb_acct.c b/source3/pam_smbpass/pam_smb_acct.c
index 2ea7eea7d8..8d5882bc93 100644
--- a/source3/pam_smbpass/pam_smb_acct.c
+++ b/source3/pam_smbpass/pam_smb_acct.c
@@ -46,7 +46,7 @@ int pam_sm_acct_mgmt( pam_handle_t *pamh, int flags,
int retval;
const char *name;
- SAM_ACCOUNT *sampass = NULL;
+ struct samu *sampass = NULL;
void (*oldsig_handler)(int);
extern BOOL in_client;
diff --git a/source3/pam_smbpass/pam_smb_auth.c b/source3/pam_smbpass/pam_smb_auth.c
index f604d42449..3de752cd30 100644
--- a/source3/pam_smbpass/pam_smb_auth.c
+++ b/source3/pam_smbpass/pam_smb_auth.c
@@ -47,7 +47,7 @@ do { \
} while (0)
static int _smb_add_user(pam_handle_t *pamh, unsigned int ctrl,
- const char *name, SAM_ACCOUNT *sampass, BOOL exist);
+ const char *name, struct samu *sampass, BOOL exist);
/*
@@ -64,7 +64,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
{
unsigned int ctrl;
int retval, *ret_data = NULL;
- SAM_ACCOUNT *sampass = NULL;
+ struct samu *sampass = NULL;
extern BOOL in_client;
const char *name;
void (*oldsig_handler)(int) = NULL;
@@ -113,14 +113,14 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
if (on( SMB_MIGRATE, ctrl )) {
retval = _smb_add_user(pamh, ctrl, name, sampass, found);
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
AUTH_RETURN;
}
if (!found) {
_log_err(LOG_ALERT, "Failed to find entry for user %s.", name);
retval = PAM_USER_UNKNOWN;
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
sampass = NULL;
AUTH_RETURN;
}
@@ -128,7 +128,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
/* if this user does not have a password... */
if (_smb_blankpasswd( ctrl, sampass )) {
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
retval = PAM_SUCCESS;
AUTH_RETURN;
}
@@ -139,14 +139,14 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
if (retval != PAM_SUCCESS ) {
_log_err(LOG_CRIT, "auth: no password provided for [%s]"
, name);
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
AUTH_RETURN;
}
/* verify the password of this user */
retval = _smb_verify_password( pamh, sampass, p, ctrl );
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
p = NULL;
AUTH_RETURN;
}
@@ -176,7 +176,7 @@ int pam_sm_setcred(pam_handle_t *pamh, int flags,
/* Helper function for adding a user to the db. */
static int _smb_add_user(pam_handle_t *pamh, unsigned int ctrl,
- const char *name, SAM_ACCOUNT *sampass, BOOL exist)
+ const char *name, struct samu *sampass, BOOL exist)
{
pstring err_str;
pstring msg_str;
diff --git a/source3/pam_smbpass/pam_smb_passwd.c b/source3/pam_smbpass/pam_smb_passwd.c
index 176b278c04..f0a94bd49c 100644
--- a/source3/pam_smbpass/pam_smb_passwd.c
+++ b/source3/pam_smbpass/pam_smb_passwd.c
@@ -96,7 +96,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
extern BOOL in_client;
- SAM_ACCOUNT *sampass = NULL;
+ struct samu *sampass = NULL;
void (*oldsig_handler)(int);
const char *user;
char *pass_old;
@@ -158,7 +158,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
if (_smb_blankpasswd( ctrl, sampass )) {
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
return PAM_SUCCESS;
}
@@ -172,7 +172,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
Announce = SMB_MALLOC_ARRAY(char, sizeof(greeting)+strlen(user));
if (Announce == NULL) {
_log_err(LOG_CRIT, "password: out of memory");
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
return PAM_BUF_ERR;
}
@@ -188,7 +188,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
if (retval != PAM_SUCCESS) {
_log_err( LOG_NOTICE
, "password - (old) token not obtained" );
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
return retval;
}
@@ -203,7 +203,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
}
pass_old = NULL;
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
return retval;
@@ -233,7 +233,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
if (retval != PAM_SUCCESS) {
_log_err( LOG_NOTICE, "password: user not authenticated" );
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
return retval;
}
@@ -261,7 +261,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
, "password: new password not obtained" );
}
pass_old = NULL; /* tidy up */
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
return retval;
}
@@ -281,7 +281,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
if (retval != PAM_SUCCESS) {
_log_err(LOG_NOTICE, "new password not acceptable");
pass_new = pass_old = NULL; /* tidy up */
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
return retval;
}
@@ -313,7 +313,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
pass_old = pass_new = NULL;
if (sampass) {
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
sampass = NULL;
}
@@ -325,11 +325,11 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
}
if (sampass) {
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
sampass = NULL;
}
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
return retval;
}
diff --git a/source3/pam_smbpass/support.c b/source3/pam_smbpass/support.c
index add74acc5d..c318a5c3ed 100644
--- a/source3/pam_smbpass/support.c
+++ b/source3/pam_smbpass/support.c
@@ -305,7 +305,7 @@ void _cleanup_failures( pam_handle_t * pamh, void *fl, int err )
}
}
-int _smb_verify_password( pam_handle_t * pamh, SAM_ACCOUNT *sampass,
+int _smb_verify_password( pam_handle_t * pamh, struct samu *sampass,
const char *p, unsigned int ctrl )
{
uchar lm_pw[16];
@@ -437,7 +437,7 @@ int _smb_verify_password( pam_handle_t * pamh, SAM_ACCOUNT *sampass,
* - to avoid prompting for one in such cases (CG)
*/
-int _smb_blankpasswd( unsigned int ctrl, SAM_ACCOUNT *sampass )
+int _smb_blankpasswd( unsigned int ctrl, struct samu *sampass )
{
int retval;
diff --git a/source3/pam_smbpass/support.h b/source3/pam_smbpass/support.h
index a13a2d0aeb..0b2863d7b9 100644
--- a/source3/pam_smbpass/support.h
+++ b/source3/pam_smbpass/support.h
@@ -26,7 +26,7 @@ extern BOOL strequal(const char *, const char *);
extern struct smb_passwd *
_my_get_smbpwnam(FILE *, const char *, BOOL *, BOOL *, long *);
-extern int _smb_verify_password( pam_handle_t *pamh , SAM_ACCOUNT *sampass,
+extern int _smb_verify_password( pam_handle_t *pamh , struct samu *sampass,
const char *p, unsigned int ctrl );
/*
@@ -39,7 +39,7 @@ extern int _smb_get_user(pam_handle_t *, unsigned int,
/* _smb_blankpasswd() is a quick check for a blank password */
-extern int _smb_blankpasswd(unsigned int, SAM_ACCOUNT *);
+extern int _smb_blankpasswd(unsigned int, struct samu *);
/* obtain a password from the user */