svn commit: samba r5733 - in branches/SAMBA_3_0/source/passdb: .

jelmer at samba.org jelmer at samba.org
Thu Mar 10 22:47:56 GMT 2005


Author: jelmer
Date: 2005-03-10 22:47:56 +0000 (Thu, 10 Mar 2005)
New Revision: 5733

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5733

Log:
Don't crash when the SID column contains NULL (Fixes #2316)
Patch by Justin Ossevoort

Modified:
   branches/SAMBA_3_0/source/passdb/pdb_pgsql.c


Changeset:
Modified: branches/SAMBA_3_0/source/passdb/pdb_pgsql.c
===================================================================
--- branches/SAMBA_3_0/source/passdb/pdb_pgsql.c	2005-03-10 21:44:11 UTC (rev 5732)
+++ branches/SAMBA_3_0/source/passdb/pdb_pgsql.c	2005-03-10 22:47:56 UTC (rev 5733)
@@ -104,10 +104,15 @@
   pdb_set_logon_count            ( u, PQgetlong ( r, row, 27 ), PDB_SET ) ;
   pdb_set_unknown_6            ( u, PQgetlong ( r, row, 28 ), PDB_SET ) ;
   
-  if ( !PQgetisnull( r, row, 18 ) ) string_to_sid( &sid, PQgetvalue( r, row, 18 ) ) ;
-  pdb_set_user_sid ( u, &sid, PDB_SET ) ;
-  if ( !PQgetisnull( r, row, 19 ) ) string_to_sid( &sid, PQgetvalue( r, row, 19 ) ) ;
-  pdb_set_group_sid( u, &sid, PDB_SET ) ;
+  if ( !PQgetisnull( r, row, 18 ) ) {
+    string_to_sid( &sid, PQgetvalue( r, row, 18 ) ) ;
+    pdb_set_user_sid ( u, &sid, PDB_SET ) ;
+  }
+
+  if ( !PQgetisnull( r, row, 19 ) ) {
+    string_to_sid( &sid, PQgetvalue( r, row, 19 ) ) ;
+    pdb_set_group_sid( u, &sid, PDB_SET ) ;
+  }
   
   if ( pdb_gethexpwd( PQgetvalue( r, row, 20 ), temp ), PDB_SET ) pdb_set_lanman_passwd( u, temp, PDB_SET ) ;
   if ( pdb_gethexpwd( PQgetvalue( r, row, 21 ), temp ), PDB_SET ) pdb_set_nt_passwd    ( u, temp, PDB_SET ) ;
@@ -146,7 +151,7 @@
   }
   else
   {
-    DEBUG( 5, ("pgsqlsam_setsampwent succeeded(%llu results)!\n", PQntuples(data->pwent)) ) ;
+    DEBUG( 5, ("pgsqlsam_setsampwent succeeded(%d results)!\n", PQntuples(data->pwent)) ) ;
     retval = NT_STATUS_OK ;
   }
   



More information about the samba-cvs mailing list