[Pkg-samba-maint] r1842 - branches/samba/experimental/debian/patches

bubulle at alioth.debian.org bubulle at alioth.debian.org
Sat Apr 26 10:14:41 UTC 2008


Author: bubulle
Date: 2008-04-26 10:14:41 +0000 (Sat, 26 Apr 2008)
New Revision: 1842

Modified:
   branches/samba/experimental/debian/patches/smbpasswd-syslog.patch
Log:
Adapted for 3.2.0pre3

Modified: branches/samba/experimental/debian/patches/smbpasswd-syslog.patch
===================================================================
--- branches/samba/experimental/debian/patches/smbpasswd-syslog.patch	2008-04-26 10:13:59 UTC (rev 1841)
+++ branches/samba/experimental/debian/patches/smbpasswd-syslog.patch	2008-04-26 10:14:41 UTC (rev 1842)
@@ -4,38 +4,30 @@
 
 Upstream status: submitted as bugzilla bug #4831
 
-Index: samba-3.2.0pre2/source/pam_smbpass/support.c
+Index: samba-3.2.0pre3/source/pam_smbpass/support.c
 ===================================================================
---- samba-3.2.0pre2.orig/source/pam_smbpass/support.c
-+++ samba-3.2.0pre2/source/pam_smbpass/support.c
+--- samba-3.2.0pre3.orig/source/pam_smbpass/support.c
++++ samba-3.2.0pre3/source/pam_smbpass/support.c
 @@ -14,6 +14,7 @@
- 	 * this program; if not, see <http://www.gnu.org/licenses/>.
- 	 */
+  * this program; if not, see <http://www.gnu.org/licenses/>.
+  */
  
-+	#include "config.h"
- 	#include "includes.h"
- 	#include "general.h"
++#include "config.h"
+ #include "includes.h"
+ #include "general.h"
  
-@@ -61,19 +62,44 @@
- 	void _cleanup(pam_handle_t *, void *, int);
- 	char *_pam_delete(register char *);
+@@ -62,17 +63,42 @@
+ char *_pam_delete(register char *);
  
--	/* syslogging function for errors and other information */
+ /* syslogging function for errors and other information */
 -
--	void _log_err( int err, const char *format, ... )
--	{
--	    va_list args;
-+/* syslogging function for errors and other information */
+-void _log_err( int err, const char *format, ... )
 +#ifdef HAVE_PAM_VSYSLOG
 +void _log_err( pam_handle_t *pamh, int err, const char *format, ... )
-+{
+ {
+-    va_list args;
 +	va_list args;
- 
--	    va_start( args, format );
--	    openlog( "PAM_smbpass", LOG_CONS | LOG_PID, LOG_AUTH );
--	    vsyslog( err, format, args );
--	    va_end( args );
--	    closelog();
++  
 +	va_start(args, format);
 +	pam_vsyslog(pamh, err, format, args);
 +	va_end(args);
@@ -55,51 +47,50 @@
 +		vsyslog(err | LOG_AUTH, format, args);
 +		va_end(args);
 +		return;
- 	}
- 
++  	}
++  
 +	strncpy(mod_format, tag, strlen(tag)+1);
 +	strncat(mod_format, format, strlen(format));
 +
 +	va_start(args, format);
 +	vsyslog(err | LOG_AUTH, mod_format, args);
 +	va_end(args);
-+
+ 
+-    va_start( args, format );
+-    openlog( "PAM_smbpass", LOG_CONS | LOG_PID, LOG_AUTH );
+-    vsyslog( err, format, args );
+-    va_end( args );
+-    closelog();
 +	free(mod_format);
-+}
+ }
 +#endif
-+
- 	/* this is a front-end for module-application conversations */
  
- 	int converse( pam_handle_t * pamh, int ctrl, int nargs
-@@ -90,12 +116,14 @@
- 								,response, conv->appdata_ptr);
+ /* this is a front-end for module-application conversations */
  
- 			if (retval != PAM_SUCCESS && on(SMB_DEBUG, ctrl)) {
--				_log_err(LOG_DEBUG, "conversation failure [%s]"
--						 ,pam_strerror(pamh, retval));
-+				_log_err(pamh, LOG_DEBUG,
-+				         "conversation failure [%s]",
-+				         pam_strerror(pamh, retval));
- 			}
- 		} else {
--			_log_err(LOG_ERR, "couldn't obtain coversation function [%s]"
--					 ,pam_strerror(pamh, retval));
-+			_log_err(pamh, LOG_ERR,
-+			         "couldn't obtain coversation function [%s]",
-+			         pam_strerror(pamh, retval));
+@@ -90,11 +116,11 @@
+ 							,response, conv->appdata_ptr);
+ 
+ 		if (retval != PAM_SUCCESS && on(SMB_DEBUG, ctrl)) {
+-			_log_err(LOG_DEBUG, "conversation failure [%s]"
++			_log_err(pamh, LOG_DEBUG, "conversation failure [%s]"
+ 					 ,pam_strerror(pamh, retval));
  		}
+ 	} else {
+-		_log_err(LOG_ERR, "couldn't obtain coversation function [%s]"
++		_log_err(pamh, LOG_ERR, "couldn't obtain coversation function [%s]"
+ 				 ,pam_strerror(pamh, retval));
+ 	}
  
- 		return retval;				/* propagate error status */
-@@ -121,7 +149,7 @@
+@@ -121,7 +147,7 @@
  
- 	/* set the control flags for the SMB module. */
+ /* set the control flags for the SMB module. */
  
 -int set_ctrl( int flags, int argc, const char **argv )
 +int set_ctrl( pam_handle_t *pamh, int flags, int argc, const char **argv )
  {
      int i = 0;
      const char *service_file = NULL;
-@@ -163,7 +191,7 @@
+@@ -163,7 +189,7 @@
      /* Read some options from the Samba config. Can be overridden by
         the PAM config. */
      if(lp_load(service_file,True,False,False,True) == False) {
@@ -108,7 +99,7 @@
      }
  
      secrets_init();
-@@ -186,7 +214,7 @@
+@@ -186,7 +212,7 @@
          }
  
          if (j >= SMB_CTRLS_) {
@@ -117,7 +108,7 @@
          } else {
              ctrl &= smb_args[j].mask;	/* for turning things off */
              ctrl |= smb_args[j].flag;	/* for turning things on  */
-@@ -225,7 +253,7 @@
+@@ -225,7 +251,7 @@
   * evidence of old token around for later stack analysis.
   *
   */
@@ -126,7 +117,7 @@
  {
      register char *newstr = NULL;
  
-@@ -235,7 +263,7 @@
+@@ -235,7 +261,7 @@
          for (i = 0; x[i]; ++i); /* length of string */
          if ((newstr = SMB_MALLOC_ARRAY(char, ++i)) == NULL) {
              i = 0;
@@ -135,7 +126,7 @@
          } else {
              while (i-- > 0) {
                  newstr[i] = x[i];
-@@ -277,7 +305,7 @@
+@@ -277,7 +303,7 @@
              /* log the number of authentication failures */
              if (failure->count != 0) {
                  pam_get_item( pamh, PAM_SERVICE, (const void **) &service );
@@ -144,7 +135,7 @@
                            , "%d authentication %s "
                              "from %s for service %s as %s(%d)"
                            , failure->count
-@@ -286,7 +314,7 @@
+@@ -286,7 +312,7 @@
                            , service == NULL ? "**unknown**" : service 
                            , failure->user, failure->id );
                  if (failure->count > SMB_MAX_RETRIES) {
@@ -153,7 +144,7 @@
                                , "service(%s) ignoring max retries; %d > %d"
                                , service == NULL ? "**unknown**" : service
                                , failure->count
-@@ -322,8 +350,7 @@
+@@ -322,8 +348,7 @@
  
      if (!pdb_get_lanman_passwd(sampass))
      {
@@ -163,7 +154,7 @@
  
          if (off( SMB__NONULL, ctrl )
              && (pdb_get_acct_ctrl(sampass) & ACB_PWNOTREQ))
-@@ -333,15 +360,16 @@
+@@ -333,15 +358,16 @@
              const char *service;
  
              pam_get_item( pamh, PAM_SERVICE, (const void **)&service );
@@ -183,7 +174,7 @@
      }
      strncpy( data_name, FAIL_PREFIX, sizeof(FAIL_PREFIX) );
      strncpy( data_name + sizeof(FAIL_PREFIX) - 1, name, strlen( name ) + 1 );
-@@ -387,31 +415,31 @@
+@@ -387,31 +413,31 @@
                          retval = PAM_MAXTRIES;
                      }
                  } else {
@@ -222,7 +213,7 @@
                        "failed auth request by %s for service %s as %s(%d)",
                        uidtoname(getuid()),
                        service ? service : "**unknown**", name);
-@@ -485,8 +513,8 @@
+@@ -485,8 +511,8 @@
          retval = pam_get_item( pamh, authtok_flag, (const void **) &item );
          if (retval != PAM_SUCCESS) {
              /* very strange. */
@@ -233,7 +224,7 @@
              return retval;
          } else if (item != NULL) {	/* we have a password! */
              *pass = item;
-@@ -538,7 +566,7 @@
+@@ -538,7 +564,7 @@
  
          if (retval == PAM_SUCCESS) {	/* a good conversation */
  
@@ -242,7 +233,7 @@
              if (token != NULL) {
                  if (expect == 2) {
                      /* verify that password entered correctly */
-@@ -550,7 +578,8 @@
+@@ -550,7 +576,8 @@
                      }
                  }
              } else {
@@ -252,7 +243,7 @@
              }
          }
  
-@@ -563,7 +592,7 @@
+@@ -563,7 +590,7 @@
  
      if (retval != PAM_SUCCESS) {
          if (on( SMB_DEBUG, ctrl ))
@@ -261,7 +252,7 @@
          return retval;
      }
      /* 'token' is the entered password */
-@@ -578,7 +607,7 @@
+@@ -578,7 +605,7 @@
              || (retval = pam_get_item( pamh, authtok_flag
                              ,(const void **)&item )) != PAM_SUCCESS)
          {
@@ -270,7 +261,7 @@
              return retval;
          }
      } else {
-@@ -592,8 +621,8 @@
+@@ -592,8 +619,8 @@
              || (retval = pam_get_data( pamh, data_name, (const void **)&item ))
                               != PAM_SUCCESS)
          {
@@ -281,7 +272,7 @@
              _pam_delete( token );
              item = NULL;
              return retval;
-@@ -617,8 +646,8 @@
+@@ -617,8 +644,8 @@
      if (pass_new == NULL || (pass_old && !strcmp( pass_old, pass_new )))
      {
  	if (on(SMB_DEBUG, ctrl)) {
@@ -292,23 +283,23 @@
  	}
  	make_remark( pamh, ctrl, PAM_ERROR_MSG, pass_new == NULL ?
  				"No password supplied" : "Password unchanged" );
-Index: samba-3.2.0pre2/source/pam_smbpass/pam_smb_auth.c
+Index: samba-3.2.0pre3/source/pam_smbpass/pam_smb_auth.c
 ===================================================================
---- samba-3.2.0pre2.orig/source/pam_smbpass/pam_smb_auth.c
-+++ samba-3.2.0pre2/source/pam_smbpass/pam_smb_auth.c
-@@ -82,10 +82,9 @@
+--- samba-3.2.0pre3.orig/source/pam_smbpass/pam_smb_auth.c
++++ samba-3.2.0pre3/source/pam_smbpass/pam_smb_auth.c
+@@ -81,10 +81,9 @@
  
  	/* Samba initialization. */
  	load_case_tables();
 -	setup_logging("pam_smbpass",False);
- 	in_client = True;
+         lp_set_in_client(True);
  
 -	ctrl = set_ctrl(flags, argc, argv);
 +	ctrl = set_ctrl(pamh, flags, argc, argv);
  
  	/* Get a few bytes so we can pass our return value to
  		pam_sm_setcred(). */
-@@ -100,29 +99,29 @@
+@@ -99,29 +98,29 @@
  	retval = pam_get_user( pamh, &name, "Username: " );
  	if ( retval != PAM_SUCCESS ) {
  		if (on( SMB_DEBUG, ctrl )) {
@@ -343,7 +334,7 @@
  		retval = nt_status_to_pam(NT_STATUS_NO_MEMORY);
  		AUTH_RETURN;
  	}
-@@ -136,7 +135,7 @@
+@@ -135,7 +134,7 @@
  	}
  
  	if (!found) {
@@ -352,7 +343,7 @@
  		retval = PAM_USER_UNKNOWN;
  		TALLOC_FREE(sampass);
  		sampass = NULL;
-@@ -155,7 +154,7 @@
+@@ -154,7 +153,7 @@
  
  	retval = _smb_read_password(pamh, ctrl, NULL, "Password: ", NULL, _SMB_AUTHTOK, &p);
  	if (retval != PAM_SUCCESS ) {
@@ -361,7 +352,7 @@
  		TALLOC_FREE(sampass);
  		AUTH_RETURN;
  	}
-@@ -203,7 +202,7 @@
+@@ -202,7 +201,7 @@
  	retval = pam_get_item( pamh, PAM_AUTHTOK, (const void **) &pass );
  
  	if (retval != PAM_SUCCESS) {
@@ -370,16 +361,16 @@
  			, "pam_get_item returned error to pam_sm_authenticate" );
  		return PAM_AUTHTOK_RECOVER_ERR;
  	} else if (pass == NULL) {
-Index: samba-3.2.0pre2/source/pam_smbpass/pam_smb_acct.c
+Index: samba-3.2.0pre3/source/pam_smbpass/pam_smb_acct.c
 ===================================================================
---- samba-3.2.0pre2.orig/source/pam_smbpass/pam_smb_acct.c
-+++ samba-3.2.0pre2/source/pam_smbpass/pam_smb_acct.c
-@@ -59,26 +59,25 @@
+--- samba-3.2.0pre3.orig/source/pam_smbpass/pam_smb_acct.c
++++ samba-3.2.0pre3/source/pam_smbpass/pam_smb_acct.c
+@@ -58,26 +58,25 @@
  
  	/* Samba initialization. */
  	load_case_tables();
 -	setup_logging( "pam_smbpass", False );
- 	in_client = True;
+         lp_set_in_client(True);
  
 -	ctrl = set_ctrl( flags, argc, argv );
 +	ctrl = set_ctrl(pamh, flags, argc, argv );
@@ -390,22 +381,22 @@
  	if (retval != PAM_SUCCESS) {
  		if (on( SMB_DEBUG, ctrl )) {
 -			_log_err( LOG_DEBUG, "acct: could not identify user" );
-+		  _log_err(pamh, LOG_DEBUG, "acct: could not identify user" );
++			_log_err(pamh, LOG_DEBUG, "acct: could not identify user" );
  		}
  		return retval;
  	}
  	if (on( SMB_DEBUG, ctrl )) {
 -		_log_err( LOG_DEBUG, "acct: username [%s] obtained", name );
-+	  _log_err(pamh, LOG_DEBUG, "acct: username [%s] obtained", name );
++		_log_err(pamh, LOG_DEBUG, "acct: username [%s] obtained", name );
  	}
  
  	if (geteuid() != 0) {
 -		_log_err( LOG_DEBUG, "Cannot access samba password database, not running as root.");
-+	  _log_err(pamh, LOG_DEBUG, "Cannot access samba password database, not running as root.");
++		_log_err(pamh, LOG_DEBUG, "Cannot access samba password database, not running as root.");
  		return PAM_AUTHINFO_UNAVAIL;
  	}
  
-@@ -86,7 +85,7 @@
+@@ -85,7 +84,7 @@
  		from a SIGPIPE it's not expecting */
  	oldsig_handler = CatchSignal(SIGPIPE, SIGNAL_CAST SIG_IGN);
  	if (!initialize_password_db(True, NULL)) {
@@ -414,7 +405,7 @@
  		CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
  		return PAM_AUTHINFO_UNAVAIL;
  	}
-@@ -100,7 +99,7 @@
+@@ -99,7 +98,7 @@
  	}
  
  	if (!pdb_getsampwnam(sampass, name )) {
@@ -423,7 +414,7 @@
          	CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
          	return PAM_USER_UNKNOWN;
  	}
-@@ -113,8 +112,8 @@
+@@ -112,8 +111,8 @@
  
  	if (pdb_get_acct_ctrl(sampass) & ACB_DISABLED) {
  		if (on( SMB_DEBUG, ctrl )) {
@@ -434,23 +425,23 @@
  		}
  		make_remark( pamh, ctrl, PAM_ERROR_MSG
  			, "Your account has been disabled; "
-Index: samba-3.2.0pre2/source/pam_smbpass/pam_smb_passwd.c
+Index: samba-3.2.0pre3/source/pam_smbpass/pam_smb_passwd.c
 ===================================================================
---- samba-3.2.0pre2.orig/source/pam_smbpass/pam_smb_passwd.c
-+++ samba-3.2.0pre2/source/pam_smbpass/pam_smb_passwd.c
-@@ -108,10 +108,9 @@
+--- samba-3.2.0pre3.orig/source/pam_smbpass/pam_smb_passwd.c
++++ samba-3.2.0pre3/source/pam_smbpass/pam_smb_passwd.c
+@@ -106,10 +106,9 @@
  
      /* Samba initialization. */
      load_case_tables();
 -    setup_logging( "pam_smbpass", False );
-     in_client = True;
+     lp_set_in_client(True);
  
 -    ctrl = set_ctrl(flags, argc, argv);
 +    ctrl = set_ctrl(pamh, flags, argc, argv);
  
      /*
       * First get the name of a user.  No need to do anything if we can't
-@@ -121,16 +120,16 @@
+@@ -119,16 +118,16 @@
      retval = pam_get_user( pamh, &user, "Username: " );
      if (retval != PAM_SUCCESS) {
          if (on( SMB_DEBUG, ctrl )) {
@@ -470,7 +461,7 @@
  	return PAM_AUTHINFO_UNAVAIL;
      }
  
-@@ -139,7 +138,7 @@
+@@ -137,7 +136,7 @@
      oldsig_handler = CatchSignal(SIGPIPE, SIGNAL_CAST SIG_IGN);
  
      if (!initialize_password_db(False, NULL)) {
@@ -479,7 +470,7 @@
          CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
          return PAM_AUTHINFO_UNAVAIL;
      }
-@@ -151,12 +150,12 @@
+@@ -149,12 +148,12 @@
      }
  
      if (!pdb_getsampwnam(sampass,user)) {
@@ -494,7 +485,7 @@
      }
  
      if (flags & PAM_PRELIM_CHECK) {
-@@ -182,7 +181,7 @@
+@@ -180,7 +179,7 @@
  #define greeting "Changing password for "
              Announce = SMB_MALLOC_ARRAY(char, sizeof(greeting)+strlen(user));
              if (Announce == NULL) {
@@ -503,7 +494,7 @@
                  TALLOC_FREE(sampass);
                  CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
                  return PAM_BUF_ERR;
-@@ -197,8 +196,8 @@
+@@ -195,8 +194,8 @@
              SAFE_FREE( Announce );
  
              if (retval != PAM_SUCCESS) {
@@ -514,7 +505,7 @@
                  TALLOC_FREE(sampass);
                  CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
                  return retval;
-@@ -243,7 +242,7 @@
+@@ -241,7 +240,7 @@
          }
  
          if (retval != PAM_SUCCESS) {
@@ -523,7 +514,7 @@
              TALLOC_FREE(sampass);
              CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
              return retval;
-@@ -268,8 +267,8 @@
+@@ -266,8 +265,8 @@
  
          if (retval != PAM_SUCCESS) {
              if (on( SMB_DEBUG, ctrl )) {
@@ -534,7 +525,7 @@
              }
              pass_old = NULL;                               /* tidy up */
              TALLOC_FREE(sampass);
-@@ -290,7 +289,7 @@
+@@ -288,7 +287,7 @@
          retval = _pam_smb_approve_pass(pamh, ctrl, pass_old, pass_new);
  
          if (retval != PAM_SUCCESS) {
@@ -543,7 +534,7 @@
              pass_new = pass_old = NULL;               /* tidy up */
              TALLOC_FREE(sampass);
              CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
-@@ -310,16 +309,17 @@
+@@ -308,16 +307,17 @@
  	    
              /* password updated */
  		if (!sid_to_uid(pdb_get_user_sid(sampass), &uid)) {
@@ -565,7 +556,7 @@
  	}
  
          pass_old = pass_new = NULL;
-@@ -330,7 +330,7 @@
+@@ -328,7 +328,7 @@
  
      } else {            /* something has broken with the library */
  
@@ -574,10 +565,10 @@
          retval = PAM_ABORT;
  
      }
-Index: samba-3.2.0pre2/source/pam_smbpass/support.h
+Index: samba-3.2.0pre3/source/pam_smbpass/support.h
 ===================================================================
---- samba-3.2.0pre2.orig/source/pam_smbpass/support.h
-+++ samba-3.2.0pre2/source/pam_smbpass/support.h
+--- samba-3.2.0pre3.orig/source/pam_smbpass/support.h
++++ samba-3.2.0pre3/source/pam_smbpass/support.h
 @@ -1,8 +1,8 @@
  /* syslogging function for errors and other information */
 -extern void _log_err(int, const char *, ...);




More information about the Pkg-samba-maint mailing list