svn commit: samba r16616 - in branches/SAMBA_3_0/source/smbd: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 05:00:09 + (Wed, 28 Jun 2006)
New Revision: 16616

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

Log:
Klocwork #2025. Stop null deref. I actually don't
think this can happen in real life but the code is
too complicated to be sure
Jerry please merge this for 3.0.23.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/smbd/posix_acls.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/posix_acls.c
===
--- branches/SAMBA_3_0/source/smbd/posix_acls.c 2006-06-28 04:59:58 UTC (rev 
16615)
+++ branches/SAMBA_3_0/source/smbd/posix_acls.c 2006-06-28 05:00:09 UTC (rev 
16616)
@@ -1483,7 +1483,7 @@
 * Only add to the file ACL if not inherit only.
 */
 
-   if (!(psa->flags & SEC_ACE_FLAG_INHERIT_ONLY)) {
+   if (current_ace && !(psa->flags & SEC_ACE_FLAG_INHERIT_ONLY)) {
DLIST_ADD_END(file_ace, current_ace, tmp_ace);
 
/*



svn commit: samba r16615 - in trunk/source/smbd: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 04:59:58 + (Wed, 28 Jun 2006)
New Revision: 16615

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

Log:
Klocwork #2025. Stop null deref. I actually don't
think this can happen in real life but the code is
too complicated to be sure
Jerry please merge this for 3.0.23.
Jeremy.

Modified:
   trunk/source/smbd/posix_acls.c


Changeset:
Modified: trunk/source/smbd/posix_acls.c
===
--- trunk/source/smbd/posix_acls.c  2006-06-28 04:56:23 UTC (rev 16614)
+++ trunk/source/smbd/posix_acls.c  2006-06-28 04:59:58 UTC (rev 16615)
@@ -1483,7 +1483,7 @@
 * Only add to the file ACL if not inherit only.
 */
 
-   if (!(psa->flags & SEC_ACE_FLAG_INHERIT_ONLY)) {
+   if (current_ace && !(psa->flags & SEC_ACE_FLAG_INHERIT_ONLY)) {
DLIST_ADD_END(file_ace, current_ace, tmp_ace);
 
/*



svn commit: samba r16614 - in branches/SAMBA_3_0/source/utils: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 04:56:23 + (Wed, 28 Jun 2006)
New Revision: 16614

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

Log:
Klocwork #2012. memleak on error path.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/utils/net_rpc_registry.c


Changeset:
Modified: branches/SAMBA_3_0/source/utils/net_rpc_registry.c
===
--- branches/SAMBA_3_0/source/utils/net_rpc_registry.c  2006-06-28 04:56:19 UTC 
(rev 16613)
+++ branches/SAMBA_3_0/source/utils/net_rpc_registry.c  2006-06-28 04:56:23 UTC 
(rev 16614)
@@ -410,6 +410,7 @@

if ((nk = regfio_rootkey( registry )) == NULL) {
d_fprintf(stderr, "Could not get rootkey\n");
+   regfio_close( registry );
return 1;
}
d_printf("[%s]\n", nk->keyname);



svn commit: samba r16613 - in trunk/source/utils: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 04:56:19 + (Wed, 28 Jun 2006)
New Revision: 16613

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

Log:
Klocwork #2012. memleak on error path.
Jeremy.

Modified:
   trunk/source/utils/net_rpc_registry.c


Changeset:
Modified: trunk/source/utils/net_rpc_registry.c
===
--- trunk/source/utils/net_rpc_registry.c   2006-06-28 04:51:23 UTC (rev 
16612)
+++ trunk/source/utils/net_rpc_registry.c   2006-06-28 04:56:19 UTC (rev 
16613)
@@ -399,6 +399,7 @@

if ((nk = regfio_rootkey( registry )) == NULL) {
d_fprintf(stderr, "Could not get rootkey\n");
+   regfio_close( registry );
return 1;
}
d_printf("[%s]\n", nk->keyname);



svn commit: samba r16612 - in branches/SAMBA_3_0/source/utils: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 04:51:23 + (Wed, 28 Jun 2006)
New Revision: 16612

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

Log:
Klocwork fix #2011. memleak on error path.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/utils/net_rpc_registry.c


Changeset:
Modified: branches/SAMBA_3_0/source/utils/net_rpc_registry.c
===
--- branches/SAMBA_3_0/source/utils/net_rpc_registry.c  2006-06-28 04:51:18 UTC 
(rev 16611)
+++ branches/SAMBA_3_0/source/utils/net_rpc_registry.c  2006-06-28 04:51:23 UTC 
(rev 16612)
@@ -433,7 +433,7 @@
 
 static int rpc_registry_copy( int argc, const char **argv )
 {
-   REGF_FILE   *infile, *outfile;
+   REGF_FILE   *infile = NULL, *outfile = NULL;
REGF_NK_REC *nk;
int result = 1;

@@ -452,7 +452,7 @@
d_printf("Opening %s", argv[1]);
if ( !(outfile = regfio_open( argv[1], (O_RDWR|O_CREAT|O_TRUNC), 
(S_IREAD|S_IWRITE) )) ) {
d_fprintf(stderr, "Failed to open %s for writing\n", argv[1]);
-   goto out_close_infile;
+   goto out;
}
d_printf("ok\n");

@@ -460,7 +460,7 @@

if ((nk = regfio_rootkey( infile )) == NULL) {
d_fprintf(stderr, "Could not get rootkey\n");
-   goto out_close_infile;
+   goto out;
}
d_printf("RootKey: [%s]\n", nk->keyname);
 
@@ -468,13 +468,18 @@
 
result = 0;
 
+out:
+
d_printf("Closing %s...", argv[1]);
-   regfio_close( outfile );
+   if (outfile) {
+   regfio_close( outfile );
+   }
d_printf("ok\n");
 
-out_close_infile:
d_printf("Closing %s...", argv[0]);
-   regfio_close( infile );
+   if (infile) {
+   regfio_close( infile );
+   }
d_printf("ok\n");
 
return( result);



svn commit: samba r16611 - in trunk/source/utils: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 04:51:18 + (Wed, 28 Jun 2006)
New Revision: 16611

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

Log:
Klocwork fix #2011. memleak on error path.
Jeremy.

Modified:
   trunk/source/utils/net_rpc_registry.c


Changeset:
Modified: trunk/source/utils/net_rpc_registry.c
===
--- trunk/source/utils/net_rpc_registry.c   2006-06-28 04:43:19 UTC (rev 
16610)
+++ trunk/source/utils/net_rpc_registry.c   2006-06-28 04:51:18 UTC (rev 
16611)
@@ -422,7 +422,7 @@
 
 static int rpc_registry_copy( int argc, const char **argv )
 {
-   REGF_FILE   *infile, *outfile;
+   REGF_FILE   *infile = NULL, *outfile = NULL;
REGF_NK_REC *nk;
int result = 1;

@@ -441,7 +441,7 @@
d_printf("Opening %s", argv[1]);
if ( !(outfile = regfio_open( argv[1], (O_RDWR|O_CREAT|O_TRUNC), 
(S_IREAD|S_IWRITE) )) ) {
d_fprintf(stderr, "Failed to open %s for writing\n", argv[1]);
-   goto out_close_infile;
+   goto out;
}
d_printf("ok\n");

@@ -449,7 +449,7 @@

if ((nk = regfio_rootkey( infile )) == NULL) {
d_fprintf(stderr, "Could not get rootkey\n");
-   goto out_close_infile;
+   goto out;
}
d_printf("RootKey: [%s]\n", nk->keyname);
 
@@ -457,13 +457,18 @@
 
result = 0;
 
+out:
+
d_printf("Closing %s...", argv[1]);
-   regfio_close( outfile );
+   if (outfile) {
+   regfio_close( outfile );
+   }
d_printf("ok\n");
 
-out_close_infile:
d_printf("Closing %s...", argv[0]);
-   regfio_close( infile );
+   if (infile) {
+   regfio_close( infile );
+   }
d_printf("ok\n");
 
return( result);



svn commit: samba r16610 - in branches/SAMBA_3_0/source/nsswitch: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 04:43:19 + (Wed, 28 Jun 2006)
New Revision: 16610

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

Log:
Subtle one from Klocwork #2076. If multiple flags
are set in a winbindd request it might overwrite existing
state->response.extra_data.data values without freeing.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/nsswitch/winbindd_pam.c


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_pam.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd_pam.c   2006-06-28 04:43:14 UTC 
(rev 16609)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_pam.c   2006-06-28 04:43:19 UTC 
(rev 16610)
@@ -97,6 +97,7 @@
}
 
size = prs_data_size(&ps);
+   SAFE_FREE(state->response.extra_data.data);
state->response.extra_data.data = SMB_MALLOC(size);
if (!state->response.extra_data.data) {
prs_mem_free(&ps);
@@ -1365,6 +1366,7 @@
cell += 1;
 
/* Append an AFS token string */
+   SAFE_FREE(state->response.extra_data.data);
state->response.extra_data.data =
afs_createtoken_str(afsname, cell);
 
@@ -1614,6 +1616,7 @@
 
DEBUG(5, ("Setting unix username to [%s]\n", 
username_out));
 
+   SAFE_FREE(state->response.extra_data.data);
state->response.extra_data.data = 
SMB_STRDUP(username_out);
if (!state->response.extra_data.data) {
result = NT_STATUS_NO_MEMORY;



svn commit: samba r16609 - in trunk/source/nsswitch: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 04:43:14 + (Wed, 28 Jun 2006)
New Revision: 16609

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

Log:
Subtle one from Klocwork #2076. If multiple flags
are set in a winbindd request it might overwrite existing
state->response.extra_data.data values without freeing.
Jeremy.

Modified:
   trunk/source/nsswitch/winbindd_pam.c


Changeset:
Modified: trunk/source/nsswitch/winbindd_pam.c
===
--- trunk/source/nsswitch/winbindd_pam.c2006-06-28 04:30:51 UTC (rev 
16608)
+++ trunk/source/nsswitch/winbindd_pam.c2006-06-28 04:43:14 UTC (rev 
16609)
@@ -97,6 +97,7 @@
}
 
size = prs_data_size(&ps);
+   SAFE_FREE(state->response.extra_data.data);
state->response.extra_data.data = SMB_MALLOC(size);
if (!state->response.extra_data.data) {
prs_mem_free(&ps);
@@ -1365,6 +1366,7 @@
cell += 1;
 
/* Append an AFS token string */
+   SAFE_FREE(state->response.extra_data.data);
state->response.extra_data.data =
afs_createtoken_str(afsname, cell);
 
@@ -1614,6 +1616,7 @@
 
DEBUG(5, ("Setting unix username to [%s]\n", 
username_out));
 
+   SAFE_FREE(state->response.extra_data.data);
state->response.extra_data.data = 
SMB_STRDUP(username_out);
if (!state->response.extra_data.data) {
result = NT_STATUS_NO_MEMORY;



svn commit: samba r16608 - in branches/SAMBA_3_0/source/client: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 04:30:51 + (Wed, 28 Jun 2006)
New Revision: 16608

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

Log:
Klocwork #2035. Null deref (bit of a stretch... :-).
Jeremy.

Modified:
   branches/SAMBA_3_0/source/client/smbspool.c


Changeset:
Modified: branches/SAMBA_3_0/source/client/smbspool.c
===
--- branches/SAMBA_3_0/source/client/smbspool.c 2006-06-28 04:30:41 UTC (rev 
16607)
+++ branches/SAMBA_3_0/source/client/smbspool.c 2006-06-28 04:30:51 UTC (rev 
16608)
@@ -72,6 +72,7 @@
   struct cli_state *cli;   /* SMB interface */
   char null_str[1];
   int tries = 0;
+  const char *dev_uri;
 
   null_str[0] = '\0';
 
@@ -132,8 +133,9 @@
   * Find the URI...
   */
 
-  if (getenv("DEVICE_URI") != NULL)
-strncpy(uri, getenv("DEVICE_URI"), sizeof(uri) - 1);
+  dev_uri = getenv("DEVICE_URI");
+  if (dev_uri)
+strncpy(uri, dev_uri, sizeof(uri) - 1);
   else if (strncmp(argv[0], "smb://", 6) == 0)
 strncpy(uri, argv[0], sizeof(uri) - 1);
   else



svn commit: samba r16607 - in trunk/source/client: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 04:30:41 + (Wed, 28 Jun 2006)
New Revision: 16607

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

Log:
Klocwork #2035. Null deref (bit of a stretch... :-).
Jeremy.

Modified:
   trunk/source/client/smbspool.c


Changeset:
Modified: trunk/source/client/smbspool.c
===
--- trunk/source/client/smbspool.c  2006-06-28 04:27:43 UTC (rev 16606)
+++ trunk/source/client/smbspool.c  2006-06-28 04:30:41 UTC (rev 16607)
@@ -72,6 +72,7 @@
   struct cli_state *cli;   /* SMB interface */
   char null_str[1];
   int tries = 0;
+  const char *dev_uri;
 
   null_str[0] = '\0';
 
@@ -132,8 +133,9 @@
   * Find the URI...
   */
 
-  if (getenv("DEVICE_URI") != NULL)
-strncpy(uri, getenv("DEVICE_URI"), sizeof(uri) - 1);
+  dev_uri = getenv("DEVICE_URI");
+  if (dev_uri)
+strncpy(uri, dev_uri, sizeof(uri) - 1);
   else if (strncmp(argv[0], "smb://", 6) == 0)
 strncpy(uri, argv[0], sizeof(uri) - 1);
   else



svn commit: samba r16606 - in branches/SAMBA_3_0/source/libsmb: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 04:27:43 + (Wed, 28 Jun 2006)
New Revision: 16606

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

Log:
Klocwork #1990. Malloc the correct size.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/libsmb/clirap2.c


Changeset:
Modified: branches/SAMBA_3_0/source/libsmb/clirap2.c
===
--- branches/SAMBA_3_0/source/libsmb/clirap2.c  2006-06-28 04:27:37 UTC (rev 
16605)
+++ branches/SAMBA_3_0/source/libsmb/clirap2.c  2006-06-28 04:27:43 UTC (rev 
16606)
@@ -211,12 +211,21 @@
+WORDSIZE/* info level*/
+WORDSIZE];  /* reserved word */
 
-  char data[1024];
-
   /* offset into data of free format strings.  Will be updated */
   /* by PUTSTRINGP macro and end up with total data length.*/
   int soffset = RAP_GROUPNAME_LEN + 1 + DWORDSIZE; 
+  char *data;
+  size_t data_size;
 
+  /* Allocate data. */
+  data_size = MAX(soffset + strlen(grinfo->comment) + 1, 1024);
+
+  data = SMB_MALLOC(data_size);
+  if (!data) {
+DEBUG (1, ("Malloc fail\n"));
+return -1;
+  }
+
   /* now send a SMBtrans command with api WGroupAdd */
   
   p = make_header(param, RAP_WGroupAdd,
@@ -253,6 +262,7 @@
   DEBUG(4,("NetGroupAdd failed\n"));
 }
   
+  SAFE_FREE(data);
   SAFE_FREE(rparam);
   SAFE_FREE(rdata);
 



svn commit: samba r16605 - in trunk/source/libsmb: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 04:27:37 + (Wed, 28 Jun 2006)
New Revision: 16605

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

Log:
Klocwork #1990. Malloc the correct size.
Jeremy.

Modified:
   trunk/source/libsmb/clirap2.c


Changeset:
Modified: trunk/source/libsmb/clirap2.c
===
--- trunk/source/libsmb/clirap2.c   2006-06-28 03:46:25 UTC (rev 16604)
+++ trunk/source/libsmb/clirap2.c   2006-06-28 04:27:37 UTC (rev 16605)
@@ -211,12 +211,21 @@
+WORDSIZE/* info level*/
+WORDSIZE];  /* reserved word */
 
-  char data[1024];
-
   /* offset into data of free format strings.  Will be updated */
   /* by PUTSTRINGP macro and end up with total data length.*/
   int soffset = RAP_GROUPNAME_LEN + 1 + DWORDSIZE; 
+  char *data;
+  size_t data_size;
 
+  /* Allocate data. */
+  data_size = MAX(soffset + strlen(grinfo->comment) + 1, 1024);
+
+  data = SMB_MALLOC(data_size);
+  if (!data) {
+DEBUG (1, ("Malloc fail\n"));
+return -1;
+  }
+
   /* now send a SMBtrans command with api WGroupAdd */
   
   p = make_header(param, RAP_WGroupAdd,
@@ -253,6 +262,7 @@
   DEBUG(4,("NetGroupAdd failed\n"));
 }
   
+  SAFE_FREE(data);
   SAFE_FREE(rparam);
   SAFE_FREE(rdata);
 



svn commit: samba r16604 - in branches/SOC/bnh: . perl

2006-06-27 Thread brad
Author: brad
Date: 2006-06-28 03:46:25 + (Wed, 28 Jun 2006)
New Revision: 16604

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

Log:
Create a root directory for the perl files and add what i've done so far.

initial_setup.conf is a config file which has parameters used by the 
initial_setup.sh script. This script calls vm_setup.pl which (for now) contains 
a perl object to interact with a vmware guest using the VmPerl and vix APIs in 
a unified manner. The purpose of this script is to interact with the vmware 
server itself to take a guest snapshot, and perform the initial windows setup 
by copying windows scripts to the vm and executing them there.

These scripts use the VMware VmPerl and vix APIs. These come with the VMware 
console package. The version I used was 
VMware-server-linux-client-1.0.0-27828.zip.

After unzipping this file, the libraries can be installed by extracting the 
VMware-vix-e.x.p-27828.tar.gz and VMware-VmPerlAPI-e.x.p-27828.tar.gz archives 
and running the vmware-install.pl scripts inside their respective directories.


Added:
   branches/SOC/bnh/perl/
   branches/SOC/bnh/perl/initial_setup.conf
   branches/SOC/bnh/perl/initial_setup.sh
   branches/SOC/bnh/perl/vm_setup.pl


Changeset:
Added: branches/SOC/bnh/perl/initial_setup.conf
===
--- branches/SOC/bnh/perl/initial_setup.conf2006-06-28 02:22:28 UTC (rev 
16603)
+++ branches/SOC/bnh/perl/initial_setup.conf2006-06-28 03:46:25 UTC (rev 
16604)
@@ -0,0 +1,36 @@
+
+# Point these at the files that STDOUT and STDERR should be redirected to
+# during the setup, test and removal phases of the test.
+# These files are deleted when the setup begins its run.
+# Special files (devices, named pipes, etc) are not deleted.
+STDOUT_REDIR="initial_setup.stdout"
+STDERR_REDIR="initial_setup.stderr"
+
+# The path to the vmware image config file local to the vmware server.
+export VM_CFG_PATH="/var/lib/vmware/Virtual Machines/Windows Server 2003 EE 
-2/Windows Server 2003 EE -2.vmx"
+
+# The username and password of the administrative account to create on
+# the windows guest.
+export GUEST_USERNAME="tortureuser"
+export GUEST_PASSWORD="torturepass"
+
+# Where our setup scripts should be copied to on the windows guest.
+export GUEST_SCRIPT_PATH="C:\"
+
+# Where these scripts will be copied from on the unix host.
+# I don't know how this will work if the unix host is a different
+# system than the vmware server host.
+export LOCAL_SCRIPT_PATH="./windows-scripts"
+
+# These parameters are optional, and change the windows guest
+# hostname and workgroup if set.
+#export GUEST_HOSTNAME="tortureguest"
+#export GUEST_WORKGROUP="SMBTEST"
+
+# These parameters are optional. If not specified, the script tries to access
+# a local vmware server as the executing user.
+# logged-in user running the script are used.
+#export HOST_SERVER_NAME="localhost"
+#export HOST_SERVER_PORT=902
+#export HOST_USERNAME="vmwareuser"
+#export HOST_PASSWORD="password"

Added: branches/SOC/bnh/perl/initial_setup.sh
===
--- branches/SOC/bnh/perl/initial_setup.sh  2006-06-28 02:22:28 UTC (rev 
16603)
+++ branches/SOC/bnh/perl/initial_setup.sh  2006-06-28 03:46:25 UTC (rev 
16604)
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+# A shell script to connect to a VMware Server VM using their perl API,
+# take a snapshot,
+# copy visual basic scripts used for setup and testing,
+# and run the initial setup scripts.
+# Copyright Brad Henry <[EMAIL PROTECTED]> 2006
+# Released under the GNU GPL v2 or later.
+
+. initial_setup.conf
+
+vm_setup()
+{
+   echo -e "\nSetting up the windows environment." >> $STDOUT_REDIR
+   perl vm_setup.pl >> $STDOUT_REDIR 2>> $STDERR_REDIR
+   err_rtn=$?
+}
+
+display_output()
+{
+   cat $STDOUT_REDIR
+   cat $STDERR_REDIR
+}
+
+remove_files()
+{
+   # If these redirect to special files, we won't delete them.
+   for redir in $STDERR_REDIR \
+   $STDOUT_REDIR
+   do
+
+   if [ ! -b $redir \
+   -a ! -c $redir \
+   -a ! -p $redir ]
+   then
+   rm -f $redir
+   fi
+   done
+}
+
+create_files()
+{
+   touch $STDOUT_REDIR
+   touch $STDERR_REDIR
+}
+
+check_error()
+{
+   if [ $err_rtn -ne 0 ]
+   then
+   echo -e $err_str >> $err_redir
+   # Report output recieved so far.
+   display_output
+   # Exit in error
+   exit $err_rtn
+   else
+   echo -e $err_ok_str >> $err_redir
+   fi
+}
+
+# If we crashed on a previous run, we want to know that our log files are 
clean.
+remove_files
+
+# Create the local log files.
+create_files
+
+# Connect to the VM, get the ip, take a s

svn commit: samba r16603 - in branches/SAMBA_3_0/source/registry: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 02:22:28 + (Wed, 28 Jun 2006)
New Revision: 16603

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

Log:
Klockwork #2028. Fix null deref on error path.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/registry/reg_printing.c


Changeset:
Modified: branches/SAMBA_3_0/source/registry/reg_printing.c
===
--- branches/SAMBA_3_0/source/registry/reg_printing.c   2006-06-28 02:22:24 UTC 
(rev 16602)
+++ branches/SAMBA_3_0/source/registry/reg_printing.c   2006-06-28 02:22:28 UTC 
(rev 16603)
@@ -225,7 +225,9 @@
 
/* get information for a specific printer */

-   reg_split_path( printers_key, &printername, &printerdatakey );
+   if (!reg_split_path( printers_key, &printername, &printerdatakey )) {
+   return -1;
+   }
 
/* validate the printer name */
 
@@ -314,7 +316,9 @@
return add_printers_by_registry( subkeys );
}

-   reg_split_path( printers_key, &printername, &printerdatakey );
+   if (!reg_split_path( printers_key, &printername, &printerdatakey )) {
+   return False;
+   }

/* lookup the printer */

@@ -482,7 +486,10 @@

/* lookup the printer object */

-   reg_split_path( printers_key, &printername, &printerdatakey );
+   if (!reg_split_path( printers_key, &printername, &printerdatakey )) {
+   return -1;
+   }
+   
if ( !W_ERROR_IS_OK( get_a_printer(NULL, &printer, 2, printername) ) )
goto done;

@@ -672,7 +679,9 @@
return regdb_store_values( KEY_WINNT_PRINTERS, values );
}

-   reg_split_path( printers_key, &printername, &keyname );
+   if (!reg_split_path( printers_key, &printername, &keyname )) {
+   return False;
+   }
 
if ( !W_ERROR_IS_OK(get_a_printer(NULL, &printer, 2, printername) ) )
return False;
@@ -754,7 +763,9 @@

pstrcpy( key2, keystr );
keystr = key2;
-   reg_split_path( keystr, &base, &subkeypath );
+   if (!reg_split_path( keystr, &base, &subkeypath )) {
+   return -1;
+   }

/* sanity check */

@@ -777,7 +788,9 @@
/* more of the key path to process */

keystr = subkeypath;
-   reg_split_path( keystr, &base, &subkeypath );   
+   if (!reg_split_path( keystr, &base, &subkeypath )) {
+   return -1;
+   }

/* ...\Print\Environements\...\Drivers\ */

@@ -809,7 +822,9 @@
 
if ( strequal(base, "Print Processors") ) {
keystr = subkeypath;
-   reg_split_path( keystr, &base, &subkeypath );
+   if (!reg_split_path( keystr, &base, &subkeypath )) {
+   return -1;
+   }
 
/* no subkeys below this point */
 
@@ -824,7 +839,10 @@
/* only dealing with drivers from here on out */
 
keystr = subkeypath;
-   reg_split_path( keystr, &base, &subkeypath );
+   if (!reg_split_path( keystr, &base, &subkeypath )) {
+   return -1;
+   }
+
version = atoi(&base[strlen(base)-1]);

switch (env_index) {
@@ -947,7 +965,9 @@
NT_PRINTER_DRIVER_INFO_LEVELdriver_ctr;
WERROR  w_result;
 
-   reg_split_path( key, &base, &subkeypath );
+   if (!reg_split_path( key, &base, &subkeypath )) {
+   return -1;
+   }

/* no values in 'Environments\Drivers\Windows NT x86' */

@@ -964,7 +984,9 @@
fstrcpy( arch_environment, base );

keystr = subkeypath;
-   reg_split_path( keystr, &base, &subkeypath );
+   if (!reg_split_path( keystr, &base, &subkeypath )) {
+   return -1;
+   }
 
if ( strequal(base, "Print Processors") )
return 0;
@@ -981,7 +1003,9 @@
   The subkey name has to be Version-XX */

keystr = subkeypath;
-   reg_split_path( keystr, &base, &subkeypath );
+   if (!reg_split_path( keystr, &base, &subkeypath )) {
+   return -1;
+   }
 
if ( !subkeypath )
return 0;
@@ -991,7 +1015,9 @@
/* BEGIN PRINTER DRIVER NAME BLOCK */

keystr = subkeypath;
-   reg_split_path( keystr, &base, &subkeypath );
+   if (!reg_split_path( keystr, &base, &subkeypath )) {
+   return -1;
+   }

/* don't go any deeper for now */




svn commit: samba r16602 - in trunk/source/registry: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 02:22:24 + (Wed, 28 Jun 2006)
New Revision: 16602

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

Log:
Klockwork #2028. Fix null deref on error path.
Jeremy.

Modified:
   trunk/source/registry/reg_printing.c


Changeset:
Modified: trunk/source/registry/reg_printing.c
===
--- trunk/source/registry/reg_printing.c2006-06-28 02:12:53 UTC (rev 
16601)
+++ trunk/source/registry/reg_printing.c2006-06-28 02:22:24 UTC (rev 
16602)
@@ -225,7 +225,9 @@
 
/* get information for a specific printer */

-   reg_split_path( printers_key, &printername, &printerdatakey );
+   if (!reg_split_path( printers_key, &printername, &printerdatakey )) {
+   return -1;
+   }
 
/* validate the printer name */
 
@@ -314,7 +316,9 @@
return add_printers_by_registry( subkeys );
}

-   reg_split_path( printers_key, &printername, &printerdatakey );
+   if (!reg_split_path( printers_key, &printername, &printerdatakey )) {
+   return False;
+   }

/* lookup the printer */

@@ -482,7 +486,10 @@

/* lookup the printer object */

-   reg_split_path( printers_key, &printername, &printerdatakey );
+   if (!reg_split_path( printers_key, &printername, &printerdatakey )) {
+   return -1;
+   }
+   
if ( !W_ERROR_IS_OK( get_a_printer(NULL, &printer, 2, printername) ) )
goto done;

@@ -672,7 +679,9 @@
return regdb_store_values( KEY_WINNT_PRINTERS, values );
}

-   reg_split_path( printers_key, &printername, &keyname );
+   if (!reg_split_path( printers_key, &printername, &keyname )) {
+   return False;
+   }
 
if ( !W_ERROR_IS_OK(get_a_printer(NULL, &printer, 2, printername) ) )
return False;
@@ -754,7 +763,9 @@

pstrcpy( key2, keystr );
keystr = key2;
-   reg_split_path( keystr, &base, &subkeypath );
+   if (!reg_split_path( keystr, &base, &subkeypath )) {
+   return -1;
+   }

/* sanity check */

@@ -777,7 +788,9 @@
/* more of the key path to process */

keystr = subkeypath;
-   reg_split_path( keystr, &base, &subkeypath );   
+   if (!reg_split_path( keystr, &base, &subkeypath )) {
+   return -1;
+   }

/* ...\Print\Environements\...\Drivers\ */

@@ -809,7 +822,9 @@
 
if ( strequal(base, "Print Processors") ) {
keystr = subkeypath;
-   reg_split_path( keystr, &base, &subkeypath );
+   if (!reg_split_path( keystr, &base, &subkeypath )) {
+   return -1;
+   }
 
/* no subkeys below this point */
 
@@ -824,7 +839,10 @@
/* only dealing with drivers from here on out */
 
keystr = subkeypath;
-   reg_split_path( keystr, &base, &subkeypath );
+   if (!reg_split_path( keystr, &base, &subkeypath )) {
+   return -1;
+   }
+
version = atoi(&base[strlen(base)-1]);

switch (env_index) {
@@ -947,7 +965,9 @@
NT_PRINTER_DRIVER_INFO_LEVELdriver_ctr;
WERROR  w_result;
 
-   reg_split_path( key, &base, &subkeypath );
+   if (!reg_split_path( key, &base, &subkeypath )) {
+   return -1;
+   }

/* no values in 'Environments\Drivers\Windows NT x86' */

@@ -964,7 +984,9 @@
fstrcpy( arch_environment, base );

keystr = subkeypath;
-   reg_split_path( keystr, &base, &subkeypath );
+   if (!reg_split_path( keystr, &base, &subkeypath )) {
+   return -1;
+   }
 
if ( strequal(base, "Print Processors") )
return 0;
@@ -981,7 +1003,9 @@
   The subkey name has to be Version-XX */

keystr = subkeypath;
-   reg_split_path( keystr, &base, &subkeypath );
+   if (!reg_split_path( keystr, &base, &subkeypath )) {
+   return -1;
+   }
 
if ( !subkeypath )
return 0;
@@ -991,7 +1015,9 @@
/* BEGIN PRINTER DRIVER NAME BLOCK */

keystr = subkeypath;
-   reg_split_path( keystr, &base, &subkeypath );
+   if (!reg_split_path( keystr, &base, &subkeypath )) {
+   return -1;
+   }

/* don't go any deeper for now */




svn commit: samba r16600 - in trunk/source/rpc_parse: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 02:12:45 + (Wed, 28 Jun 2006)
New Revision: 16600

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

Log:
Klocwork #2038. Fix memleak on error path.
Jeremy.

Modified:
   trunk/source/rpc_parse/parse_eventlog.c


Changeset:
Modified: trunk/source/rpc_parse/parse_eventlog.c
===
--- trunk/source/rpc_parse/parse_eventlog.c 2006-06-28 02:02:26 UTC (rev 
16599)
+++ trunk/source/rpc_parse/parse_eventlog.c 2006-06-28 02:12:45 UTC (rev 
16600)
@@ -353,19 +353,19 @@
 
/* Now pad with whitespace until the end of the response buffer */
 
-   r_u->end_of_entries_padding =
-   SMB_CALLOC_ARRAY(uint8,
-q_u->max_read_size - r_u->num_bytes_in_resp);
+   if (q_u->max_read_size - r_u->num_bytes_in_resp) {
+   r_u->end_of_entries_padding = SMB_CALLOC_ARRAY(uint8, 
q_u->max_read_size - r_u->num_bytes_in_resp);
 
-   if(!(prs_uint8s(False, "end of entries padding", ps, 
-   depth, r_u->end_of_entries_padding,
-   (q_u->max_read_size - r_u->num_bytes_in_resp
-   {
-   return False;
+   if(!(prs_uint8s(False, "end of entries padding", ps, 
+   depth, r_u->end_of_entries_padding,
+   (q_u->max_read_size - 
r_u->num_bytes_in_resp {
+   free(r_u->end_of_entries_padding);
+   return False;
+   }
+
+   free(r_u->end_of_entries_padding);
}
 
-   free(r_u->end_of_entries_padding);
-
/* We had better be DWORD aligned here */
 
if(!(prs_uint32("sent size", ps, depth, &(r_u->sent_size



svn commit: samba r16601 - in branches/SAMBA_3_0/source/rpc_parse: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 02:12:53 + (Wed, 28 Jun 2006)
New Revision: 16601

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

Log:
Klocwork #2038. Fix memleak on error path.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/rpc_parse/parse_eventlog.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_parse/parse_eventlog.c
===
--- branches/SAMBA_3_0/source/rpc_parse/parse_eventlog.c2006-06-28 
02:12:45 UTC (rev 16600)
+++ branches/SAMBA_3_0/source/rpc_parse/parse_eventlog.c2006-06-28 
02:12:53 UTC (rev 16601)
@@ -353,19 +353,19 @@
 
/* Now pad with whitespace until the end of the response buffer */
 
-   r_u->end_of_entries_padding =
-   SMB_CALLOC_ARRAY(uint8,
-q_u->max_read_size - r_u->num_bytes_in_resp);
+   if (q_u->max_read_size - r_u->num_bytes_in_resp) {
+   r_u->end_of_entries_padding = SMB_CALLOC_ARRAY(uint8, 
q_u->max_read_size - r_u->num_bytes_in_resp);
 
-   if(!(prs_uint8s(False, "end of entries padding", ps, 
-   depth, r_u->end_of_entries_padding,
-   (q_u->max_read_size - r_u->num_bytes_in_resp
-   {
-   return False;
+   if(!(prs_uint8s(False, "end of entries padding", ps, 
+   depth, r_u->end_of_entries_padding,
+   (q_u->max_read_size - 
r_u->num_bytes_in_resp {
+   free(r_u->end_of_entries_padding);
+   return False;
+   }
+
+   free(r_u->end_of_entries_padding);
}
 
-   free(r_u->end_of_entries_padding);
-
/* We had better be DWORD aligned here */
 
if(!(prs_uint32("sent size", ps, depth, &(r_u->sent_size



svn commit: samba r16599 - in branches/SAMBA_3_0/source/printing: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 02:02:26 + (Wed, 28 Jun 2006)
New Revision: 16599

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

Log:
Make it clear to Klocwork we're not dereferencing. Issue #2026.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/printing/printing.c


Changeset:
Modified: branches/SAMBA_3_0/source/printing/printing.c
===
--- branches/SAMBA_3_0/source/printing/printing.c   2006-06-28 02:02:21 UTC 
(rev 16598)
+++ branches/SAMBA_3_0/source/printing/printing.c   2006-06-28 02:02:26 UTC 
(rev 16599)
@@ -1480,7 +1480,7 @@

/* get the length */
 
-   len = tdb_pack( buffer, len, "fdPP",
+   len = tdb_pack( NULL, 0, "fdPP",
sharename,
type,
lpqcommand, 



svn commit: samba r16598 - in trunk/source/printing: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 02:02:21 + (Wed, 28 Jun 2006)
New Revision: 16598

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

Log:
Make it clear to Klocwork we're not dereferencing. Issue #2026.
Jeremy.

Modified:
   trunk/source/printing/printing.c


Changeset:
Modified: trunk/source/printing/printing.c
===
--- trunk/source/printing/printing.c2006-06-28 01:59:04 UTC (rev 16597)
+++ trunk/source/printing/printing.c2006-06-28 02:02:21 UTC (rev 16598)
@@ -1490,7 +1490,7 @@

/* get the length */
 
-   len = tdb_pack( buffer, len, "fdPP",
+   len = tdb_pack( NULL, 0, "fdPP",
sharename,
type,
lpqcommand, 



svn commit: samba r16597 - in branches/SAMBA_3_0/source/web: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 01:59:04 + (Wed, 28 Jun 2006)
New Revision: 16597

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

Log:
Klocwork #2006. Fix possible null deref.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/web/neg_lang.c


Changeset:
Modified: branches/SAMBA_3_0/source/web/neg_lang.c
===
--- branches/SAMBA_3_0/source/web/neg_lang.c2006-06-28 01:58:59 UTC (rev 
16596)
+++ branches/SAMBA_3_0/source/web/neg_lang.c2006-06-28 01:59:04 UTC (rev 
16597)
@@ -86,6 +86,10 @@
lang_num++;
}
pl = SMB_MALLOC_ARRAY(struct pri_list, lang_num);
+   if (!pl) {
+   return;
+   }
+
for (i = 0; i < lang_num; i++) {
char *pri_code;
if ((pri_code=strstr(lang_list[i], ";q="))) {



svn commit: samba r16596 - in trunk/source/web: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 01:58:59 + (Wed, 28 Jun 2006)
New Revision: 16596

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

Log:
Klocwork #2006. Fix possible null deref.
Jeremy.

Modified:
   trunk/source/web/neg_lang.c


Changeset:
Modified: trunk/source/web/neg_lang.c
===
--- trunk/source/web/neg_lang.c 2006-06-28 01:56:41 UTC (rev 16595)
+++ trunk/source/web/neg_lang.c 2006-06-28 01:58:59 UTC (rev 16596)
@@ -86,6 +86,10 @@
lang_num++;
}
pl = SMB_MALLOC_ARRAY(struct pri_list, lang_num);
+   if (!pl) {
+   return;
+   }
+
for (i = 0; i < lang_num; i++) {
char *pri_code;
if ((pri_code=strstr(lang_list[i], ";q="))) {



svn commit: samba r16595 - in branches/SAMBA_3_0/source/lib: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 01:56:41 + (Wed, 28 Jun 2006)
New Revision: 16595

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

Log:
Klocwork #2067. Fix possible memleak on error exit.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/lib/util_str.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/util_str.c
===
--- branches/SAMBA_3_0/source/lib/util_str.c2006-06-28 01:56:36 UTC (rev 
16594)
+++ branches/SAMBA_3_0/source/lib/util_str.c2006-06-28 01:56:41 UTC (rev 
16595)
@@ -2402,6 +2402,9 @@
 
  error:
*len = -1;
+   if (mem_ctx == NULL) {
+   SAFE_FREE(*string);
+   }
*string = NULL;
 }
 



svn commit: samba r16594 - in trunk/source/lib: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 01:56:36 + (Wed, 28 Jun 2006)
New Revision: 16594

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

Log:
Klocwork #2067. Fix possible memleak on error exit.
Jeremy.

Modified:
   trunk/source/lib/util_str.c


Changeset:
Modified: trunk/source/lib/util_str.c
===
--- trunk/source/lib/util_str.c 2006-06-28 01:52:01 UTC (rev 16593)
+++ trunk/source/lib/util_str.c 2006-06-28 01:56:36 UTC (rev 16594)
@@ -2403,6 +2403,9 @@
 
  error:
*len = -1;
+   if (mem_ctx == NULL) {
+   SAFE_FREE(*string);
+   }
*string = NULL;
 }
 



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

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 01:52:01 + (Wed, 28 Jun 2006)
New Revision: 16593

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

Log:
Make the invarient explicit to Klocwork. Bug #2023.
Jeremy.

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


Changeset:
Modified: branches/SAMBA_3_0/source/passdb/passdb.c
===
--- branches/SAMBA_3_0/source/passdb/passdb.c   2006-06-28 01:51:56 UTC (rev 
16592)
+++ branches/SAMBA_3_0/source/passdb/passdb.c   2006-06-28 01:52:01 UTC (rev 
16593)
@@ -1329,6 +1329,7 @@
 
len = init_buffer_from_sam_v3(&buf, src, False);
if (len == -1 || !buf) {
+   SAFE_FREE(buf);
return False;
}
 



svn commit: samba r16592 - in trunk/source/passdb: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 01:51:56 + (Wed, 28 Jun 2006)
New Revision: 16592

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

Log:
Make the invarient explicit to Klocwork. Bug #2023.
Jeremy.

Modified:
   trunk/source/passdb/passdb.c


Changeset:
Modified: trunk/source/passdb/passdb.c
===
--- trunk/source/passdb/passdb.c2006-06-28 01:25:29 UTC (rev 16591)
+++ trunk/source/passdb/passdb.c2006-06-28 01:51:56 UTC (rev 16592)
@@ -1331,6 +1331,7 @@
 
len = init_buffer_from_sam_v3(&buf, src, False);
if (len == -1 || !buf) {
+   SAFE_FREE(buf);
return False;
}
 



svn commit: samba r16591 - in branches/SAMBA_3_0/source/smbd: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 01:25:29 + (Wed, 28 Jun 2006)
New Revision: 16591

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

Log:
Belt and braces approach to shut Klocwork up - bug #2001.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/smbd/map_username.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/map_username.c
===
--- branches/SAMBA_3_0/source/smbd/map_username.c   2006-06-28 01:25:24 UTC 
(rev 16590)
+++ branches/SAMBA_3_0/source/smbd/map_username.c   2006-06-28 01:25:29 UTC 
(rev 16591)
@@ -82,7 +82,7 @@
 
/* should be either no lines or a single line with the mapped 
username */
 
-   if (numlines) {
+   if (numlines && qlines) {
DEBUG(3,("Mapped user %s to %s\n", user, qlines[0] ));
fstrcpy( user, qlines[0] );
}



svn commit: samba r16590 - in trunk/source/smbd: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 01:25:24 + (Wed, 28 Jun 2006)
New Revision: 16590

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

Log:
Belt and braces approach to shut Klocwork up - bug #2001.
Jeremy.

Modified:
   trunk/source/smbd/map_username.c


Changeset:
Modified: trunk/source/smbd/map_username.c
===
--- trunk/source/smbd/map_username.c2006-06-28 01:21:54 UTC (rev 16589)
+++ trunk/source/smbd/map_username.c2006-06-28 01:25:24 UTC (rev 16590)
@@ -82,7 +82,7 @@
 
/* should be either no lines or a single line with the mapped 
username */
 
-   if (numlines) {
+   if (numlines && qlines) {
DEBUG(3,("Mapped user %s to %s\n", user, qlines[0] ));
fstrcpy( user, qlines[0] );
}



svn commit: samba r16589 - in branches/SAMBA_3_0/source/libads: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 01:21:54 + (Wed, 28 Jun 2006)
New Revision: 16589

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

Log:
Fix Klocwork #1999. Although it should be impossible to
get duplicate OID's returned in the oids_out list it is
still good programming practice to clear out a malloc'ed
string before re-writing it (especially in a loop).
Jeremy

Modified:
   branches/SAMBA_3_0/source/libads/ldap_schema.c


Changeset:
Modified: branches/SAMBA_3_0/source/libads/ldap_schema.c
===
--- branches/SAMBA_3_0/source/libads/ldap_schema.c  2006-06-28 01:21:49 UTC 
(rev 16588)
+++ branches/SAMBA_3_0/source/libads/ldap_schema.c  2006-06-28 01:21:54 UTC 
(rev 16589)
@@ -283,22 +283,27 @@
 
if (strequal(ADS_ATTR_RFC2307_UIDNUMBER_OID, oids_out[i]) ||
strequal(ADS_ATTR_SFU_UIDNUMBER_OID, oids_out[i])) {
+   SAFE_FREE(ads->schema.posix_uidnumber_attr);
ads->schema.posix_uidnumber_attr = 
SMB_STRDUP(names_out[i]);
}
if (strequal(ADS_ATTR_RFC2307_GIDNUMBER_OID, oids_out[i]) ||
strequal(ADS_ATTR_SFU_GIDNUMBER_OID, oids_out[i])) {
+   SAFE_FREE(ads->schema.posix_gidnumber_attr);
ads->schema.posix_gidnumber_attr = 
SMB_STRDUP(names_out[i]);
}
if (strequal(ADS_ATTR_RFC2307_HOMEDIR_OID, oids_out[i]) ||
strequal(ADS_ATTR_SFU_HOMEDIR_OID, oids_out[i])) {
+   SAFE_FREE(ads->schema.posix_homedir_attr);
ads->schema.posix_homedir_attr = 
SMB_STRDUP(names_out[i]);
}
if (strequal(ADS_ATTR_RFC2307_SHELL_OID, oids_out[i]) ||
strequal(ADS_ATTR_SFU_SHELL_OID, oids_out[i])) {
+   SAFE_FREE(ads->schema.posix_shell_attr);
ads->schema.posix_shell_attr = SMB_STRDUP(names_out[i]);
}
if (strequal(ADS_ATTR_RFC2307_GECOS_OID, oids_out[i]) ||
strequal(ADS_ATTR_SFU_GECOS_OID, oids_out[i])) {
+   SAFE_FREE(ads->schema.posix_gecos_attr);
ads->schema.posix_gecos_attr = SMB_STRDUP(names_out[i]);
}
}



svn commit: samba r16588 - in trunk/source/libads: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 01:21:49 + (Wed, 28 Jun 2006)
New Revision: 16588

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

Log:
Fix Klocwork #1999. Although it should be impossible to
get duplicate OID's returned in the oids_out list it is
still good programming practice to clear out a malloc'ed
string before re-writing it (especially in a loop).
Jeremy

Modified:
   trunk/source/libads/ldap_schema.c


Changeset:
Modified: trunk/source/libads/ldap_schema.c
===
--- trunk/source/libads/ldap_schema.c   2006-06-28 01:11:17 UTC (rev 16587)
+++ trunk/source/libads/ldap_schema.c   2006-06-28 01:21:49 UTC (rev 16588)
@@ -283,22 +283,27 @@
 
if (strequal(ADS_ATTR_RFC2307_UIDNUMBER_OID, oids_out[i]) ||
strequal(ADS_ATTR_SFU_UIDNUMBER_OID, oids_out[i])) {
+   SAFE_FREE(ads->schema.posix_uidnumber_attr);
ads->schema.posix_uidnumber_attr = 
SMB_STRDUP(names_out[i]);
}
if (strequal(ADS_ATTR_RFC2307_GIDNUMBER_OID, oids_out[i]) ||
strequal(ADS_ATTR_SFU_GIDNUMBER_OID, oids_out[i])) {
+   SAFE_FREE(ads->schema.posix_gidnumber_attr);
ads->schema.posix_gidnumber_attr = 
SMB_STRDUP(names_out[i]);
}
if (strequal(ADS_ATTR_RFC2307_HOMEDIR_OID, oids_out[i]) ||
strequal(ADS_ATTR_SFU_HOMEDIR_OID, oids_out[i])) {
+   SAFE_FREE(ads->schema.posix_homedir_attr);
ads->schema.posix_homedir_attr = 
SMB_STRDUP(names_out[i]);
}
if (strequal(ADS_ATTR_RFC2307_SHELL_OID, oids_out[i]) ||
strequal(ADS_ATTR_SFU_SHELL_OID, oids_out[i])) {
+   SAFE_FREE(ads->schema.posix_shell_attr);
ads->schema.posix_shell_attr = SMB_STRDUP(names_out[i]);
}
if (strequal(ADS_ATTR_RFC2307_GECOS_OID, oids_out[i]) ||
strequal(ADS_ATTR_SFU_GECOS_OID, oids_out[i])) {
+   SAFE_FREE(ads->schema.posix_gecos_attr);
ads->schema.posix_gecos_attr = SMB_STRDUP(names_out[i]);
}
}



svn commit: samba r16587 - in branches/SAMBA_3_0/source/client: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 01:11:17 + (Wed, 28 Jun 2006)
New Revision: 16587

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

Log:
Fix Klocwork #1987. Memleak on reusing x_dbf.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/client/client.c
   branches/SAMBA_3_0/source/client/smbctool.c


Changeset:
Modified: branches/SAMBA_3_0/source/client/client.c
===
--- branches/SAMBA_3_0/source/client/client.c   2006-06-28 01:11:12 UTC (rev 
16586)
+++ branches/SAMBA_3_0/source/client/client.c   2006-06-28 01:11:17 UTC (rev 
16587)
@@ -3464,6 +3464,9 @@
}
break;
case 'E':
+   if (dbf) {
+   x_fclose(dbf);
+   }
dbf = x_stderr;
display_set_stderr();
break;

Modified: branches/SAMBA_3_0/source/client/smbctool.c
===
--- branches/SAMBA_3_0/source/client/smbctool.c 2006-06-28 01:11:12 UTC (rev 
16586)
+++ branches/SAMBA_3_0/source/client/smbctool.c 2006-06-28 01:11:17 UTC (rev 
16587)
@@ -3605,6 +3605,9 @@
}
break;
case 'E':
+   if (dbf) {
+   x_fclose(dbf);
+   }
dbf = x_stderr;
display_set_stderr();
break;



svn commit: samba r16586 - in trunk/source/client: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 01:11:12 + (Wed, 28 Jun 2006)
New Revision: 16586

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

Log:
Fix Klocwork #1987. Memleak on reusing x_dbf.
Jeremy.

Modified:
   trunk/source/client/client.c
   trunk/source/client/smbctool.c


Changeset:
Modified: trunk/source/client/client.c
===
--- trunk/source/client/client.c2006-06-28 01:00:48 UTC (rev 16585)
+++ trunk/source/client/client.c2006-06-28 01:11:12 UTC (rev 16586)
@@ -3464,6 +3464,9 @@
}
break;
case 'E':
+   if (dbf) {
+   x_fclose(dbf);
+   }
dbf = x_stderr;
display_set_stderr();
break;

Modified: trunk/source/client/smbctool.c
===
--- trunk/source/client/smbctool.c  2006-06-28 01:00:48 UTC (rev 16585)
+++ trunk/source/client/smbctool.c  2006-06-28 01:11:12 UTC (rev 16586)
@@ -3605,6 +3605,9 @@
}
break;
case 'E':
+   if (dbf) {
+   x_fclose(dbf);
+   }
dbf = x_stderr;
display_set_stderr();
break;



svn commit: samba r16585 - in branches/SAMBA_3_0/source/libmsrpc: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 01:00:48 + (Wed, 28 Jun 2006)
New Revision: 16585

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

Log:
Fix Klocwork #1976. Possible null deref.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/libmsrpc/cac_winreg.c


Changeset:
Modified: branches/SAMBA_3_0/source/libmsrpc/cac_winreg.c
===
--- branches/SAMBA_3_0/source/libmsrpc/cac_winreg.c 2006-06-28 01:00:44 UTC 
(rev 16584)
+++ branches/SAMBA_3_0/source/libmsrpc/cac_winreg.c 2006-06-28 01:00:48 UTC 
(rev 16585)
@@ -65,6 +65,7 @@
key = talloc(mem_ctx, POLICY_HND);
if(!key) {
   hnd->status = NT_STATUS_NO_MEMORY;
+  return CAC_FAILURE;
}
 
err = rpccli_reg_connect( pipe_hnd, mem_ctx, op->in.root, op->in.access, 
key);



svn commit: samba r16584 - in trunk/source/libmsrpc: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 01:00:44 + (Wed, 28 Jun 2006)
New Revision: 16584

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

Log:
Fix Klocwork #1976. Possible null deref.
Jeremy.

Modified:
   trunk/source/libmsrpc/cac_winreg.c


Changeset:
Modified: trunk/source/libmsrpc/cac_winreg.c
===
--- trunk/source/libmsrpc/cac_winreg.c  2006-06-28 00:51:21 UTC (rev 16583)
+++ trunk/source/libmsrpc/cac_winreg.c  2006-06-28 01:00:44 UTC (rev 16584)
@@ -65,6 +65,7 @@
key = talloc(mem_ctx, POLICY_HND);
if(!key) {
   hnd->status = NT_STATUS_NO_MEMORY;
+  return CAC_FAILURE;
}
 
err = rpccli_reg_connect( pipe_hnd, mem_ctx, op->in.root, op->in.access, 
key);



svn commit: samba r16583 - in trunk/source: lib libsmb passdb printing rpc_server smbd

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 00:51:21 + (Wed, 28 Jun 2006)
New Revision: 16583

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

Log:
Fix Klocwork #1997 and all generic class of problems
where we don't correctly check the return from memdup.
Jeremy.

Modified:
   trunk/source/lib/interface.c
   trunk/source/libsmb/clirap.c
   trunk/source/passdb/pdb_tdb.c
   trunk/source/printing/nt_printing.c
   trunk/source/rpc_server/srv_pipe.c
   trunk/source/smbd/sec_ctx.c


Changeset:
Modified: trunk/source/lib/interface.c
===
--- trunk/source/lib/interface.c2006-06-28 00:50:14 UTC (rev 16582)
+++ trunk/source/lib/interface.c2006-06-28 00:51:21 UTC (rev 16583)
@@ -188,6 +188,10 @@
 
if (total_probed > 0) {
probed_ifaces = memdup(ifaces, sizeof(ifaces[0])*total_probed);
+   if (!probed_ifaces) {
+   DEBUG(0,("ERROR: memdup failed\n"));
+   exit(1);
+   }
}
 
/* if we don't have a interfaces line then use all broadcast capable 

Modified: trunk/source/libsmb/clirap.c
===
--- trunk/source/libsmb/clirap.c2006-06-28 00:50:14 UTC (rev 16582)
+++ trunk/source/libsmb/clirap.c2006-06-28 00:51:21 UTC (rev 16583)
@@ -848,6 +848,12 @@
}
 
*poutdata = memdup(rdata, data_len);
+   if (!*poutdata) {
+   SAFE_FREE(rdata);
+   SAFE_FREE(rparam);
+   return False;
+   }
+
*poutlen = data_len;
 
SAFE_FREE(rdata);

Modified: trunk/source/passdb/pdb_tdb.c
===
--- trunk/source/passdb/pdb_tdb.c   2006-06-28 00:50:14 UTC (rev 16582)
+++ trunk/source/passdb/pdb_tdb.c   2006-06-28 00:51:21 UTC (rev 16583)
@@ -913,6 +913,12 @@
/* save a copy of the key */

ptr->key.dptr = memdup( key.dptr, key.dsize );
+   if (!ptr->key.dptr) {
+   DEBUG(0,("tdbsam_traverse_setpwent: memdup failed\n"));
+   /* just return 0 and let the traversal continue */
+   return 0;
+   }
+
ptr->key.dsize = key.dsize;

DLIST_ADD( tdbsam_pwent_list, ptr );

Modified: trunk/source/printing/nt_printing.c
===
--- trunk/source/printing/nt_printing.c 2006-06-28 00:50:14 UTC (rev 16582)
+++ trunk/source/printing/nt_printing.c 2006-06-28 00:51:21 UTC (rev 16583)
@@ -738,6 +738,9 @@
 int get_builtin_ntforms(nt_forms_struct **list)
 {
*list = (nt_forms_struct *)memdup(&default_forms[0], 
sizeof(default_forms));
+   if (!*list) {
+   return 0;
+   }
return sizeof(default_forms) / sizeof(default_forms[0]);
 }
 
@@ -2081,6 +2084,10 @@
fstrcpy(info.dependentfiles[0], "");
 
*info_ptr = memdup(&info, sizeof(info));
+   if (!*info_ptr) {
+   SAFE_FREE(info.dependentfiles);
+   return WERR_NOMEM;
+   }

return WERR_OK;
 }
@@ -2155,6 +2162,10 @@
}
 
*info_ptr = (NT_PRINTER_DRIVER_INFO_LEVEL_3 *)memdup(&driver, 
sizeof(driver));
+   if (!*info_ptr) {
+   SAFE_FREE(driver.dependentfiles);
+   return WERR_NOMEM;
+   }
 
return WERR_OK;
 }
@@ -2655,6 +2666,10 @@
}
 
*nt_devmode = (NT_DEVICEMODE *)memdup(&devmode, sizeof(devmode));
+   if (!*nt_devmode) {
+   SAFE_FREE(devmode.nt_dev_private);
+   return -1;
+   }
 
DEBUG(8,("Unpacked devicemode [%s](%s)\n", devmode.devicename, 
devmode.formname));
if (devmode.nt_dev_private)

Modified: trunk/source/rpc_server/srv_pipe.c
===
--- trunk/source/rpc_server/srv_pipe.c  2006-06-28 00:50:14 UTC (rev 16582)
+++ trunk/source/rpc_server/srv_pipe.c  2006-06-28 00:51:21 UTC (rev 16583)
@@ -678,12 +678,26 @@
if (p->pipe_user.ut.ngroups) {
if (!(p->pipe_user.ut.groups = memdup(a->server_info->groups,
sizeof(gid_t) * 
p->pipe_user.ut.ngroups))) {
-   DEBUG(0,("failed to memdup group list to 
p->pipe_user.groups\n"));
+   DEBUG(0,("pipe_ntlmssp_verify_final: failed to memdup 
group list to p->pipe_user.groups\n"));
+   data_blob_free(&p->session_key);
return False;
}
}
 
+   if (!a->server_info->ptok) {
+   DEBUG(1,("pipe_ntlmssp_verify_final: Error: Authmodule failed 
to provide nt_user_token\n"));
+   data_blob_free(&p->session_key);
+   SAFE_FREE(p->pipe_user.ut.groups);
+ 

svn commit: samba r16582 - in branches/SAMBA_3_0/source: lib libsmb passdb printing rpc_server smbd

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 00:50:14 + (Wed, 28 Jun 2006)
New Revision: 16582

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

Log:
Fix Klocwork #1997 and all generic class of problems
where we don't correctly check the return from memdup.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/lib/interface.c
   branches/SAMBA_3_0/source/libsmb/clirap.c
   branches/SAMBA_3_0/source/passdb/pdb_tdb.c
   branches/SAMBA_3_0/source/printing/nt_printing.c
   branches/SAMBA_3_0/source/rpc_server/srv_pipe.c
   branches/SAMBA_3_0/source/smbd/sec_ctx.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/interface.c
===
--- branches/SAMBA_3_0/source/lib/interface.c   2006-06-28 00:07:53 UTC (rev 
16581)
+++ branches/SAMBA_3_0/source/lib/interface.c   2006-06-28 00:50:14 UTC (rev 
16582)
@@ -188,6 +188,10 @@
 
if (total_probed > 0) {
probed_ifaces = memdup(ifaces, sizeof(ifaces[0])*total_probed);
+   if (!probed_ifaces) {
+   DEBUG(0,("ERROR: memdup failed\n"));
+   exit(1);
+   }
}
 
/* if we don't have a interfaces line then use all broadcast capable 

Modified: branches/SAMBA_3_0/source/libsmb/clirap.c
===
--- branches/SAMBA_3_0/source/libsmb/clirap.c   2006-06-28 00:07:53 UTC (rev 
16581)
+++ branches/SAMBA_3_0/source/libsmb/clirap.c   2006-06-28 00:50:14 UTC (rev 
16582)
@@ -848,6 +848,12 @@
}
 
*poutdata = memdup(rdata, data_len);
+   if (!*poutdata) {
+   SAFE_FREE(rdata);
+   SAFE_FREE(rparam);
+   return False;
+   }
+
*poutlen = data_len;
 
SAFE_FREE(rdata);

Modified: branches/SAMBA_3_0/source/passdb/pdb_tdb.c
===
--- branches/SAMBA_3_0/source/passdb/pdb_tdb.c  2006-06-28 00:07:53 UTC (rev 
16581)
+++ branches/SAMBA_3_0/source/passdb/pdb_tdb.c  2006-06-28 00:50:14 UTC (rev 
16582)
@@ -902,6 +902,12 @@
/* save a copy of the key */

ptr->key.dptr = memdup( key.dptr, key.dsize );
+   if (!ptr->key.dptr) {
+   DEBUG(0,("tdbsam_traverse_setpwent: memdup failed\n"));
+   /* just return 0 and let the traversal continue */
+   return 0;
+   }
+
ptr->key.dsize = key.dsize;

DLIST_ADD( tdbsam_pwent_list, ptr );

Modified: branches/SAMBA_3_0/source/printing/nt_printing.c
===
--- branches/SAMBA_3_0/source/printing/nt_printing.c2006-06-28 00:07:53 UTC 
(rev 16581)
+++ branches/SAMBA_3_0/source/printing/nt_printing.c2006-06-28 00:50:14 UTC 
(rev 16582)
@@ -738,6 +738,9 @@
 int get_builtin_ntforms(nt_forms_struct **list)
 {
*list = (nt_forms_struct *)memdup(&default_forms[0], 
sizeof(default_forms));
+   if (!*list) {
+   return 0;
+   }
return sizeof(default_forms) / sizeof(default_forms[0]);
 }
 
@@ -2078,6 +2081,10 @@
fstrcpy(info.dependentfiles[0], "");
 
*info_ptr = memdup(&info, sizeof(info));
+   if (!*info_ptr) {
+   SAFE_FREE(info.dependentfiles);
+   return WERR_NOMEM;
+   }

return WERR_OK;
 }
@@ -2152,6 +2159,10 @@
}
 
*info_ptr = (NT_PRINTER_DRIVER_INFO_LEVEL_3 *)memdup(&driver, 
sizeof(driver));
+   if (!*info_ptr) {
+   SAFE_FREE(driver.dependentfiles);
+   return WERR_NOMEM;
+   }
 
return WERR_OK;
 }
@@ -2652,6 +2663,10 @@
}
 
*nt_devmode = (NT_DEVICEMODE *)memdup(&devmode, sizeof(devmode));
+   if (!*nt_devmode) {
+   SAFE_FREE(devmode.nt_dev_private);
+   return -1;
+   }
 
DEBUG(8,("Unpacked devicemode [%s](%s)\n", devmode.devicename, 
devmode.formname));
if (devmode.nt_dev_private)

Modified: branches/SAMBA_3_0/source/rpc_server/srv_pipe.c
===
--- branches/SAMBA_3_0/source/rpc_server/srv_pipe.c 2006-06-28 00:07:53 UTC 
(rev 16581)
+++ branches/SAMBA_3_0/source/rpc_server/srv_pipe.c 2006-06-28 00:50:14 UTC 
(rev 16582)
@@ -679,7 +679,8 @@
if (p->pipe_user.ut.ngroups) {
if (!(p->pipe_user.ut.groups = memdup(a->server_info->groups,
sizeof(gid_t) * 
p->pipe_user.ut.ngroups))) {
-   DEBUG(0,("failed to memdup group list to 
p->pipe_user.groups\n"));
+   DEBUG(0,("pipe_ntlmssp_verify_final: failed to memdup 
group list to p->pipe_user.groups\n"));
+   data_blob_free(&p->session_key);
return False;
}
  

svn commit: samba r16581 - in branches/SAMBA_3_0/source/nmbd: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 00:07:53 + (Wed, 28 Jun 2006)
New Revision: 16581

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

Log:
Fix Klocwork #2017. Possible null deref.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/nmbd/nmbd_subnetdb.c


Changeset:
Modified: branches/SAMBA_3_0/source/nmbd/nmbd_subnetdb.c
===
--- branches/SAMBA_3_0/source/nmbd/nmbd_subnetdb.c  2006-06-28 00:07:48 UTC 
(rev 16580)
+++ branches/SAMBA_3_0/source/nmbd/nmbd_subnetdb.c  2006-06-28 00:07:53 UTC 
(rev 16581)
@@ -203,6 +203,11 @@
for (i = 0 ; i < num_interfaces; i++) {
struct interface *iface = get_interface(i);
 
+   if (!iface) {
+   DEBUG(2,("create_subnets: can't get interface %d.\n", i 
));
+   continue;
+   }
+
/*
 * We don't want to add a loopback interface, in case
 * someone has added 127.0.0.1 for smbd, nmbd needs to



svn commit: samba r16580 - in trunk/source/nmbd: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 00:07:48 + (Wed, 28 Jun 2006)
New Revision: 16580

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

Log:
Fix Klocwork #2017. Possible null deref.
Jeremy.

Modified:
   trunk/source/nmbd/nmbd_subnetdb.c


Changeset:
Modified: trunk/source/nmbd/nmbd_subnetdb.c
===
--- trunk/source/nmbd/nmbd_subnetdb.c   2006-06-28 00:05:53 UTC (rev 16579)
+++ trunk/source/nmbd/nmbd_subnetdb.c   2006-06-28 00:07:48 UTC (rev 16580)
@@ -203,6 +203,11 @@
for (i = 0 ; i < num_interfaces; i++) {
struct interface *iface = get_interface(i);
 
+   if (!iface) {
+   DEBUG(2,("create_subnets: can't get interface %d.\n", i 
));
+   continue;
+   }
+
/*
 * We don't want to add a loopback interface, in case
 * someone has added 127.0.0.1 for smbd, nmbd needs to



svn commit: samba r16579 - in branches/SAMBA_3_0/source/nmbd: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 00:05:53 + (Wed, 28 Jun 2006)
New Revision: 16579

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

Log:
Fix Klocwork #2016. Possible null deref.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/nmbd/nmbd_serverlistdb.c


Changeset:
Modified: branches/SAMBA_3_0/source/nmbd/nmbd_serverlistdb.c
===
--- branches/SAMBA_3_0/source/nmbd/nmbd_serverlistdb.c  2006-06-28 00:05:48 UTC 
(rev 16578)
+++ branches/SAMBA_3_0/source/nmbd/nmbd_serverlistdb.c  2006-06-28 00:05:53 UTC 
(rev 16579)
@@ -214,7 +214,7 @@
struct work_record *iwork;
 
/* Go through all the subnets we have already seen. */
-   for (ssub = FIRST_SUBNET; ssub != subrec; ssub = 
NEXT_SUBNET_INCLUDING_UNICAST(ssub)) {
+   for (ssub = FIRST_SUBNET; ssub && (ssub != subrec); ssub = 
NEXT_SUBNET_INCLUDING_UNICAST(ssub)) {
for(iwork = ssub->workgrouplist; iwork; iwork = iwork->next) {
if(find_server_in_workgroup( iwork, servrec->serv.name) 
!= NULL) {
/*



svn commit: samba r16578 - in trunk/source/nmbd: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 00:05:48 + (Wed, 28 Jun 2006)
New Revision: 16578

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

Log:
Fix Klocwork #2016. Possible null deref.
Jeremy.

Modified:
   trunk/source/nmbd/nmbd_serverlistdb.c


Changeset:
Modified: trunk/source/nmbd/nmbd_serverlistdb.c
===
--- trunk/source/nmbd/nmbd_serverlistdb.c   2006-06-28 00:01:43 UTC (rev 
16577)
+++ trunk/source/nmbd/nmbd_serverlistdb.c   2006-06-28 00:05:48 UTC (rev 
16578)
@@ -214,7 +214,7 @@
struct work_record *iwork;
 
/* Go through all the subnets we have already seen. */
-   for (ssub = FIRST_SUBNET; ssub != subrec; ssub = 
NEXT_SUBNET_INCLUDING_UNICAST(ssub)) {
+   for (ssub = FIRST_SUBNET; ssub && (ssub != subrec); ssub = 
NEXT_SUBNET_INCLUDING_UNICAST(ssub)) {
for(iwork = ssub->workgrouplist; iwork; iwork = iwork->next) {
if(find_server_in_workgroup( iwork, servrec->serv.name) 
!= NULL) {
/*



svn commit: samba r16577 - in trunk/source/nmbd: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 00:01:43 + (Wed, 28 Jun 2006)
New Revision: 16577

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

Log:
Fix Klocwork #2015. Possible null deref.
Jeremy.

Modified:
   trunk/source/nmbd/nmbd.c


Changeset:
Modified: trunk/source/nmbd/nmbd.c
===
--- trunk/source/nmbd/nmbd.c2006-06-28 00:01:28 UTC (rev 16576)
+++ trunk/source/nmbd/nmbd.c2006-06-28 00:01:43 UTC (rev 16577)
@@ -173,6 +173,11 @@
for (n=iface_count() - 1; n >= 0; n--) {
struct interface *iface = get_interface(n);
 
+   if (!iface) {
+   DEBUG(2,("reload_interfaces: failed to get interface 
%d\n", n));
+   continue;
+   }
+
/*
 * We don't want to add a loopback interface, in case
 * someone has added 127.0.0.1 for smbd, nmbd needs to



svn commit: samba r16576 - in branches/SAMBA_3_0/source/nmbd: .

2006-06-27 Thread jra
Author: jra
Date: 2006-06-28 00:01:28 + (Wed, 28 Jun 2006)
New Revision: 16576

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

Log:
Fix Klocwork #2015. Possible null deref.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/nmbd/nmbd.c


Changeset:
Modified: branches/SAMBA_3_0/source/nmbd/nmbd.c
===
--- branches/SAMBA_3_0/source/nmbd/nmbd.c   2006-06-27 23:36:49 UTC (rev 
16575)
+++ branches/SAMBA_3_0/source/nmbd/nmbd.c   2006-06-28 00:01:28 UTC (rev 
16576)
@@ -173,6 +173,11 @@
for (n=iface_count() - 1; n >= 0; n--) {
struct interface *iface = get_interface(n);
 
+   if (!iface) {
+   DEBUG(2,("reload_interfaces: failed to get interface 
%d\n", n));
+   continue;
+   }
+
/*
 * We don't want to add a loopback interface, in case
 * someone has added 127.0.0.1 for smbd, nmbd needs to



Build status as of Wed Jun 28 00:00:02 2006

2006-06-27 Thread build
URL: http://build.samba.org/

--- /home/build/master/cache/broken_results.txt.old 2006-06-27 
00:01:17.0 +
+++ /home/build/master/cache/broken_results.txt 2006-06-28 00:00:39.0 
+
@@ -1,4 +1,4 @@
-Build status as of Tue Jun 27 00:00:02 2006
+Build status as of Wed Jun 28 00:00:02 2006
 
 Build counts:
 Tree Total  Broken Panic 
@@ -8,11 +8,11 @@
 lorikeet-heimdal 0  0  0 
 ppp  19 0  0 
 rsync34 0  0 
-samba31 8  0 
+samba31 9  0 
 samba-docs   0  0  0 
-samba4   43 33 4 
-samba_3_040 17 6 
+samba4   43 33 6 
+samba_3_040 14 0 
 smb-build29 1  0 
-talloc   27 11 0 
-tdb  26 4  0 
+talloc   25 9  0 
+tdb  25 4  0 
 


svn commit: samba r16575 - in branches/SOC/mkhl: .

2006-06-27 Thread mkhl
Author: mkhl
Date: 2006-06-27 23:36:49 + (Tue, 27 Jun 2006)
New Revision: 16575

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

Log:

Include necessary headers to let samba3sam compile.
Adapt `ldb_samba3sam_module_init' to the fixed ldb_map init code.

Martin

Added:
   branches/SOC/mkhl/samba3sam.c-adapt-to-ldb_map.patch


Changeset:
Added: branches/SOC/mkhl/samba3sam.c-adapt-to-ldb_map.patch
===
--- branches/SOC/mkhl/samba3sam.c-adapt-to-ldb_map.patch2006-06-27 
23:27:53 UTC (rev 16574)
+++ branches/SOC/mkhl/samba3sam.c-adapt-to-ldb_map.patch2006-06-27 
23:36:49 UTC (rev 16575)
@@ -0,0 +1,48 @@
+Index: dsdb/samdb/ldb_modules/samba3sam.c
+===
+--- dsdb/samdb/ldb_modules/samba3sam.c (revision 16565)
 dsdb/samdb/ldb_modules/samba3sam.c (working copy)
+@@ -5,11 +5,17 @@
+ */
+ 
+ #include "includes.h"
+-#include "ldb/modules/ldb_map.h"
+ #include "ldb/include/ldb.h"
+ #include "ldb/include/ldb_private.h"
++#include "ldb/include/ldb_errors.h"
++#include "ldb/modules/ldb_map.h"
+ #include "system/passwd.h"
+ 
++#include "librpc/gen_ndr/ndr_security.h"
++#include "librpc/ndr/libndr.h"
++#include "libcli/security/security.h"
++#include "libcli/security/proto.h"
++
+ /* 
+  * sambaSID -> member  (dn!)
+  * sambaSIDList -> member (dn!) 
+@@ -855,8 +861,23 @@
+   }
+ };
+ 
++/* the context init function */
++static int samba3sam_init(struct ldb_module *module)
++{
++int ret;
++
++  ret = ldb_map_init(module, samba3_attributes, samba3_objectclasses, 
"samba3sam");
++if (ret != LDB_SUCCESS)
++return ret;
++
++return ldb_next_init(module);
++}
++
+ /* the init function */
+ int ldb_samba3sam_module_init(void)
+ {
+-  return ldb_map_init(ldb, samba3_attributes, samba3_objectclasses, 
"samba3sam");
++struct ldb_module_ops ops = ldb_map_get_ops();
++ops.init_context = samba3sam_init;
++
++return ldb_register_module(&ops);
+ }



svn commit: samba r16574 - in branches/SOC/mkhl/ldb-map/modules: .

2006-06-27 Thread mkhl
Author: mkhl
Date: 2006-06-27 23:27:53 + (Tue, 27 Jun 2006)
New Revision: 16574

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

Log:

Adapt initialization so ldb_map can be used by other modules:

Split `ldb_map_init' into `ldb_map_init', to be called from a using
modules `init_context' op, and `ldb_map_get_ops', to be called from a
using modules initialization function.

Expose `ldb_map_init' and `ldb_map_get_ops' in the header.

Martin

Modified:
   branches/SOC/mkhl/ldb-map/modules/ldb_map.c
   branches/SOC/mkhl/ldb-map/modules/ldb_map.h


Changeset:
Modified: branches/SOC/mkhl/ldb-map/modules/ldb_map.c
===
--- branches/SOC/mkhl/ldb-map/modules/ldb_map.c 2006-06-27 22:16:36 UTC (rev 
16573)
+++ branches/SOC/mkhl/ldb-map/modules/ldb_map.c 2006-06-27 23:27:53 UTC (rev 
16574)
@@ -2740,38 +2740,31 @@
 }
 
 
-/* Initialize a module that performs the specified mappings.
+/* Get a copy of this modules ops. */
+struct ldb_module_ops
+ldb_map_get_ops(void)
+{
+   return map_ops;
+}
 
-   Should be called from the init function of the module that defines
-   these mappings. */
-struct ldb_module *
-ldb_map_init(struct ldb_context *ldb,
+/* Initialize private data. */
+int
+ldb_map_init(struct ldb_module *module,
 const struct ldb_map_attribute *attrs,
 const struct ldb_map_objectclass *ocls,
 const char *name)
 {
-   struct ldb_module *module;
struct map_private *data;
int ret;
 
-   /* prepare the module structure */
-   module = talloc(ldb, struct ldb_module);
-   if (module == NULL) {
-   ldb_oom(ldb);
-   return NULL;
-   }
-
-   /* and private data */
+   /* prepare private data */
data = talloc(module, struct map_private);
if (data == NULL) {
-   ldb_oom(ldb);
+   ldb_oom(module->ldb);
 goto failed;
}
 
module->private_data = data;
-   module->ldb = ldb;
-   module->prev = module->next = NULL;
-   module->ops = &map_ops;
 
/* store local and remote baseDNs */
ret = map_init_dns(module, name);
@@ -2781,9 +2774,28 @@
/* store list of attribute and objectClass maps */
map_init_maps(module, attrs, ocls);
 
-   return module;
+   return LDB_SUCCESS;
 
 failed:
-   talloc_free(module);
-   return NULL;
+   talloc_free(data);
+   return LDB_ERR_OPERATIONS_ERROR;
 }
+
+/* Ussage note for initialization of this module:
+
+   ldb_map is meant to be used from a different module that sets up
+   the mappings and gets registered in LDB.
+
+   'ldb_map_init' initializes the private data of this module and
+   stores the attribute and objectClass maps in there.  It also looks
+   up the '@MAP' special DN so requests can be redirected to the
+   remote partition.
+
+   This function should be called from the 'init_context' op of the
+   module using ldb_map.
+
+   'ldb_map_get_ops' returns a copy of ldb_maps module operations.
+
+   It should be called from the initialize function of the using
+   module, which should then override the 'init_context' op with a
+   function making the appropriate calls to 'ldb_map_init'. */

Modified: branches/SOC/mkhl/ldb-map/modules/ldb_map.h
===
--- branches/SOC/mkhl/ldb-map/modules/ldb_map.h 2006-06-27 22:16:36 UTC (rev 
16573)
+++ branches/SOC/mkhl/ldb-map/modules/ldb_map.h 2006-06-27 23:27:53 UTC (rev 
16574)
@@ -146,5 +146,15 @@
const struct ldb_dn *remote_base_dn;
 };
 
+/* initialization function */
+int
+ldb_map_init(struct ldb_module *module,
+const struct ldb_map_attribute *attrs,
+const struct ldb_map_objectclass *ocls,
+const char *name);
 
+/* get copy of map_ops */
+struct ldb_module_ops
+ldb_map_get_ops(void);
+
 #endif /* __LDB_MAP_H__ */



svn commit: samba r16573 - in branches/SAMBA_4_0/source/libnet: .

2006-06-27 Thread mimir
Author: mimir
Date: 2006-06-27 22:16:36 + (Tue, 27 Jun 2006)
New Revision: 16573

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

Log:
Fixes in comments.


rafal


Modified:
   branches/SAMBA_4_0/source/libnet/libnet_domain.c


Changeset:
Modified: branches/SAMBA_4_0/source/libnet/libnet_domain.c
===
--- branches/SAMBA_4_0/source/libnet/libnet_domain.c2006-06-27 20:46:23 UTC 
(rev 16572)
+++ branches/SAMBA_4_0/source/libnet/libnet_domain.c2006-06-27 22:16:36 UTC 
(rev 16573)
@@ -236,7 +236,7 @@
 
 
 /**
- * Sends asynchronous domain_open request
+ * Sends asynchronous DomainOpen request
  *
  * @param ctx initialised libnet context
  * @param io arguments and results of the call
@@ -327,9 +327,9 @@
 
 
 /**
- * Waits for and receives result of asynchronous domain_open call
+ * Waits for and receives result of asynchronous DomainOpen call
  * 
- * @param c composite context returned by asynchronous domain_open call
+ * @param c composite context returned by asynchronous DomainOpen call
  * @param ctx initialised libnet context
  * @param mem_ctx memory context of the call
  * @param io pointer to results (and arguments) of the call
@@ -362,7 +362,7 @@
 
 
 /**
- * Synchronous version of domain_open call
+ * Synchronous version of DomainOpen call
  *
  * @param ctx initialised libnet context
  * @param mem_ctx memory context for the call



svn commit: samba r16572 - in branches/SAMBA_4_0/source/libnet: .

2006-06-27 Thread mimir
Author: mimir
Date: 2006-06-27 20:46:23 + (Tue, 27 Jun 2006)
New Revision: 16572

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

Log:
More comments and simple refactoring of one condition.


rafal


Modified:
   branches/SAMBA_4_0/source/libnet/libnet_user.c


Changeset:
Modified: branches/SAMBA_4_0/source/libnet/libnet_user.c
===
--- branches/SAMBA_4_0/source/libnet/libnet_user.c  2006-06-27 17:58:57 UTC 
(rev 16571)
+++ branches/SAMBA_4_0/source/libnet/libnet_user.c  2006-06-27 20:46:23 UTC 
(rev 16572)
@@ -101,6 +101,15 @@
 static void continue_domain_open_create(struct composite_context *ctx);
 
 
+/**
+ * Sends request to create user account
+ *
+ * @param ctx initialised libnet context
+ * @param mem_ctx memory context of the call
+ * @param r pointer to a structure containing arguments and results of the call
+ * @param monitor pointer to monitor function
+ * @return compostite context of the request
+ */
 struct composite_context* libnet_CreateUser_send(struct libnet_context *ctx,
 TALLOC_CTX *mem_ctx,
 struct libnet_CreateUser *r,
@@ -111,6 +120,7 @@
struct composite_context *create_req;
struct composite_context *prereq_ctx;
 
+   /* composite context allocation and setup */
c = talloc_zero(mem_ctx, struct composite_context);
if (c == NULL) return NULL;
 
@@ -121,25 +131,34 @@
c->private_data = s;
c->event_ctx = ctx->event_ctx;
 
+   /* store arguments in the state structure */
s->ctx = ctx;
s->r   = *r;
ZERO_STRUCT(s->r.out);
 
+   /* prerequisite: make sure the domain is opened */
prereq_ctx = domain_opened(ctx, s->r.in.domain_name, c, &s->domain_open,
   continue_domain_open_create, monitor);
if (prereq_ctx) return prereq_ctx;
-   
+
+   /* prepare arguments for useradd call */
s->user_add.in.username   = r->in.user_name;
s->user_add.in.domain_handle  = ctx->domain.handle;
 
+   /* send the request */
create_req = libnet_rpc_useradd_send(ctx->samr_pipe, &s->user_add, 
monitor);
if (composite_nomem(create_req, c)) return c;
 
+   /* set the next stage */
composite_continue(c, create_req, continue_rpc_useradd, c);
return c;
 }
 
 
+/*
+ * Stage 0.5 (optional): receive result of domain open request
+ * and send useradd request
+ */
 static void continue_domain_open_create(struct composite_context *ctx)
 {
struct composite_context *c;
@@ -150,21 +169,29 @@
c = talloc_get_type(ctx->async.private_data, struct composite_context);
s = talloc_get_type(c->private_data, struct create_user_state);
 
+   /* receive result of DomainOpen call */
c->status = libnet_DomainOpen_recv(ctx, s->ctx, c, &s->domain_open);
if (!composite_is_ok(c)) return;
 
+   /* send monitor message */
if (s->monitor_fn) s->monitor_fn(&msg);

+   /* prepare arguments for useradd call */
s->user_add.in.username   = s->r.in.user_name;
s->user_add.in.domain_handle  = s->ctx->domain.handle;
 
+   /* send the request */
create_req = libnet_rpc_useradd_send(s->ctx->samr_pipe, &s->user_add, 
s->monitor_fn);
if (composite_nomem(create_req, c)) return;
-   
+
+   /* set the next stage */
composite_continue(c, create_req, continue_rpc_useradd, c);
 }
 
 
+/*
+ * Stage 1: receive result of useradd call
+ */
 static void continue_rpc_useradd(struct composite_context *ctx)
 {
struct composite_context *c;
@@ -173,15 +200,27 @@
 
c = talloc_get_type(ctx->async.private_data, struct composite_context);
s = talloc_get_type(c->private_data, struct create_user_state);
-
+   
+   /* receive result of the call */
c->status = libnet_rpc_useradd_recv(ctx, c, &s->user_add);
if (!composite_is_ok(c)) return;
 
+   /* send monitor message */
if (s->monitor_fn) s->monitor_fn(&msg);
+
+   /* we're done */
composite_done(c);
 }
 
 
+/**
+ * Receive result of CreateUser call
+ *
+ * @param c composite context returned by send request routine
+ * @param mem_ctx memory context of the call
+ * @param r pointer to a structure containing arguments and result of the call
+ * @return nt status
+ */
 NTSTATUS libnet_CreateUser_recv(struct composite_context *c, TALLOC_CTX 
*mem_ctx,
struct libnet_CreateUser *r)
 {
@@ -190,10 +229,9 @@
 
r->out.error_string = NULL;
 
+   /* wait for completion and check possible errors */
status = composite_wait(c);
-   if (NT_STATUS_IS_OK(status)) {
-   r->out.error_string = NULL;
-   } else {
+   if (!NT_STATUS_IS_OK(status)) {
s = talloc_get_type(c->priva

svn commit: samba r16571 - in branches/SAMBA_4_0/source/lib/charset: .

2006-06-27 Thread metze
Author: metze
Date: 2006-06-27 17:58:57 + (Tue, 27 Jun 2006)
New Revision: 16571

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

Log:
- make push/pull_ascii()/_ucs() functions static,
  callers should use push/pull_string() functions with STR_ASCII or STR_UNICODE
- make the push/pull_ascii/ucs2/utf8_talloc() functions complete
  (they should be reduced to pull/push_string_talloc() later...)

metze
Modified:
   branches/SAMBA_4_0/source/lib/charset/charcnv.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/charset/charcnv.c
===
--- branches/SAMBA_4_0/source/lib/charset/charcnv.c 2006-06-27 17:58:55 UTC 
(rev 16570)
+++ branches/SAMBA_4_0/source/lib/charset/charcnv.c 2006-06-27 17:58:57 UTC 
(rev 16571)
@@ -286,7 +286,7 @@
  * @param dest_len the maximum length in bytes allowed in the
  * destination.  If @p dest_len is -1 then no maximum is used.
  **/
-_PUBLIC_ ssize_t push_ascii(void *dest, const char *src, size_t dest_len, int 
flags)
+static ssize_t push_ascii(void *dest, const char *src, size_t dest_len, int 
flags)
 {
size_t src_len;
ssize_t ret;
@@ -321,7 +321,6 @@
 _PUBLIC_ ssize_t push_ascii_talloc(TALLOC_CTX *ctx, char **dest, const char 
*src)
 {
size_t src_len = strlen(src)+1;
-
*dest = NULL;
return convert_string_talloc(ctx, CH_UNIX, CH_DOS, src, src_len, (void 
**)dest);
 }
@@ -342,7 +341,7 @@
  * @param src_len is the length of the source area in bytes.
  * @returns the number of bytes occupied by the string in @p src.
  **/
-_PUBLIC_ ssize_t pull_ascii(char *dest, const void *src, size_t dest_len, 
size_t src_len, int flags)
+static ssize_t pull_ascii(char *dest, const void *src, size_t dest_len, size_t 
src_len, int flags)
 {
size_t ret;
 
@@ -381,7 +380,7 @@
  * @param dest_len is the maximum length allowed in the
  * destination. If dest_len is -1 then no maxiumum is used.
  **/
-_PUBLIC_ ssize_t push_ucs2(void *dest, const char *src, size_t dest_len, int 
flags)
+static ssize_t push_ucs2(void *dest, const char *src, size_t dest_len, int 
flags)
 {
size_t len=0;
size_t src_len = strlen(src);
@@ -449,7 +448,6 @@
 _PUBLIC_ ssize_t push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char 
*src)
 {
size_t src_len = strlen(src)+1;
-
*dest = NULL;
return convert_string_talloc(ctx, CH_UNIX, CH_UTF8, src, src_len, (void 
**)dest);
 }
@@ -465,7 +463,7 @@
  The resulting string in "dest" is always null terminated.
 **/
 
-_PUBLIC_ size_t pull_ucs2(char *dest, const void *src, size_t dest_len, size_t 
src_len, int flags)
+static size_t pull_ucs2(char *dest, const void *src, size_t dest_len, size_t 
src_len, int flags)
 {
size_t ret;
 
@@ -495,6 +493,21 @@
 }
 
 /**
+ * Copy a string from a ASCII src to a unix char * destination, allocating a 
buffer using talloc
+ *
+ * @param dest always set at least to NULL 
+ *
+ * @returns The number of bytes occupied by the string in the destination
+ **/
+
+_PUBLIC_ ssize_t pull_ascii_talloc(TALLOC_CTX *ctx, char **dest, const char 
*src)
+{
+   size_t src_len = strlen(src)+1;
+   *dest = NULL;
+   return convert_string_talloc(ctx, CH_DOS, CH_UNIX, src, src_len, (void 
**)dest);
+}
+
+/**
  * Copy a string from a UCS2 src to a unix char * destination, allocating a 
buffer using talloc
  *
  * @param dest always set at least to NULL 



svn commit: samba r16570 - in branches/SAMBA_3_0/source/param: .

2006-06-27 Thread crh
Author: crh
Date: 2006-06-27 17:58:55 + (Tue, 27 Jun 2006)
New Revision: 16570

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

Log:
Corrected the copyright notice.  I had requested and received permission
from my management at the University to release under my own copyright.
My mistake for entering the wrong info.

Modified:
   branches/SAMBA_3_0/source/param/params.c


Changeset:
Modified: branches/SAMBA_3_0/source/param/params.c
===
--- branches/SAMBA_3_0/source/param/params.c2006-06-27 17:55:02 UTC (rev 
16569)
+++ branches/SAMBA_3_0/source/param/params.c2006-06-27 17:58:55 UTC (rev 
16570)
@@ -3,9 +3,9 @@
  *
  * This module Copyright (C) 1990-1998 Karl Auer
  *
- * Rewritten almost completely by Christopher R. Hertel
- * at the University of Minnesota, September, 1997.
- * This module Copyright (C) 1997-1998 by the University of Minnesota
+ * Rewritten almost completely by Christopher R. Hertel, 1997.
+ * This module Copyright (C) 1997-1998 by Christopher R. Hertel
+ * 
  * -- 
**
  *
  * This program is free software; you can redistribute it and/or modify



svn commit: samba r16569 - in branches/SAMBA_4_0/source: auth/ntlmssp libcli/auth torture/rap

2006-06-27 Thread metze
Author: metze
Date: 2006-06-27 17:55:02 + (Tue, 27 Jun 2006)
New Revision: 16569

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

Log:
- use push_string()

metze
Modified:
   branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp_parse.c
   branches/SAMBA_4_0/source/libcli/auth/smbencrypt.c
   branches/SAMBA_4_0/source/torture/rap/rap.c


Changeset:
Modified: branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp_parse.c
===
--- branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp_parse.c  2006-06-27 
17:46:57 UTC (rev 16568)
+++ branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp_parse.c  2006-06-27 
17:55:02 UTC (rev 16569)
@@ -238,8 +238,8 @@
return False;
 
if (0 < len1) {
-   pull_ucs2(p, blob->data + ptr, 
sizeof(p), 
-   len1, STR_NOALIGN);
+   pull_string(p, blob->data + ptr, 
sizeof(p), 
+   len1, 
STR_UNICODE|STR_NOALIGN);
(*ps) = talloc_strdup(mem_ctx, p);
if (!(*ps)) {
return False;
@@ -268,8 +268,8 @@
return False;   
 
if (0 < len1) {
-   pull_ascii(p, blob->data + ptr, 
sizeof(p), 
-   len1, STR_NOALIGN);
+   pull_string(p, blob->data + ptr, 
sizeof(p), 
+   len1, 
STR_ASCII|STR_NOALIGN);
(*ps) = talloc_strdup(mem_ctx, p);
if (!(*ps)) {
return False;

Modified: branches/SAMBA_4_0/source/libcli/auth/smbencrypt.c
===
--- branches/SAMBA_4_0/source/libcli/auth/smbencrypt.c  2006-06-27 17:46:57 UTC 
(rev 16568)
+++ branches/SAMBA_4_0/source/libcli/auth/smbencrypt.c  2006-06-27 17:55:02 UTC 
(rev 16569)
@@ -91,10 +91,10 @@
BOOL ret = True;
fstring dospwd; 
ZERO_STRUCT(dospwd);
-   
+
/* Password must be converted to DOS charset - null terminated, 
uppercase. */
-   push_ascii(dospwd, passwd, sizeof(dospwd), STR_UPPER|STR_TERMINATE);
-   
+   push_string(dospwd, passwd, sizeof(dospwd), 
STR_ASCII|STR_UPPER|STR_TERMINATE);
+
/* Only the fisrt 14 chars are considered, password need not be null 
terminated. */
E_P16((const uint8_t *)dospwd, p16);
 

Modified: branches/SAMBA_4_0/source/torture/rap/rap.c
===
--- branches/SAMBA_4_0/source/torture/rap/rap.c 2006-06-27 17:46:57 UTC (rev 
16568)
+++ branches/SAMBA_4_0/source/torture/rap/rap.c 2006-06-27 17:55:02 UTC (rev 
16569)
@@ -151,7 +151,7 @@
return NT_STATUS_INVALID_PARAMETER;
 
*dest = talloc_zero_size(mem_ctx, len+1);
-   pull_ascii(*dest, p, len+1, len, 0);
+   pull_string(*dest, p, len+1, len, STR_ASCII);
 
return NT_STATUS_OK;
 }



svn commit: samba r16568 - in branches/SAMBA_4_0/source/smb_server/smb2: .

2006-06-27 Thread metze
Author: metze
Date: 2006-06-27 17:46:57 + (Tue, 27 Jun 2006)
New Revision: 16568

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

Log:
add parsing code for SMB2 SetInfo

metze
Modified:
   branches/SAMBA_4_0/source/smb_server/smb2/fileinfo.c


Changeset:
Modified: branches/SAMBA_4_0/source/smb_server/smb2/fileinfo.c
===
--- branches/SAMBA_4_0/source/smb_server/smb2/fileinfo.c2006-06-27 
17:34:28 UTC (rev 16567)
+++ branches/SAMBA_4_0/source/smb_server/smb2/fileinfo.c2006-06-27 
17:46:57 UTC (rev 16568)
@@ -225,7 +225,71 @@
SMB2SRV_CALL_NTVFS_BACKEND(smb2srv_getinfo_backend(op));
 }
 
+struct smb2srv_setinfo_op {
+   struct smb2srv_request *req;
+   struct smb2_setinfo *info;
+};
+
+static void smb2srv_setinfo_send(struct ntvfs_request *ntvfs)
+{
+   struct smb2srv_setinfo_op *op;
+   struct smb2srv_request *req;
+
+   /*
+* SMB2 uses NT_STATUS_INVALID_INFO_CLASS
+* so we need to translated it here
+*/
+   if (NT_STATUS_EQUAL(NT_STATUS_INVALID_LEVEL, 
ntvfs->async_states->status)) {
+   ntvfs->async_states->status = NT_STATUS_INVALID_INFO_CLASS;
+   }
+
+   SMB2SRV_CHECK_ASYNC_STATUS(op, struct smb2srv_setinfo_op);
+
+   SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x02, False, 0));
+
+   smb2srv_send_reply(req);
+}
+
+static NTSTATUS smb2srv_setinfo_backend(struct smb2srv_setinfo_op *op)
+{
+   uint8_t smb2_class;
+   /*uint8_t smb2_level;*/
+
+   smb2_class = 0xFF & op->info->in.level;
+   /*smb2_level = 0xFF & (op->info->in.level>>8);*/
+
+   switch (smb2_class) {
+   case SMB2_GETINFO_FILE:
+   return NT_STATUS_NOT_IMPLEMENTED;
+
+   case SMB2_GETINFO_FS:
+   return NT_STATUS_NOT_IMPLEMENTED;
+
+   case SMB2_GETINFO_SECURITY:
+   return NT_STATUS_NOT_IMPLEMENTED;
+   }
+
+   return NT_STATUS_FOOBAR;
+}
+
 void smb2srv_setinfo_recv(struct smb2srv_request *req)
 {
-   smb2srv_send_error(req, NT_STATUS_NOT_IMPLEMENTED);
+   struct smb2_setinfo *info;
+   struct smb2srv_setinfo_op *op;
+
+   SMB2SRV_CHECK_BODY_SIZE(req, 0x20, True);
+   SMB2SRV_TALLOC_IO_PTR(info, struct smb2_setinfo);
+   /* this overwrites req->io_ptr !*/
+   SMB2SRV_TALLOC_IO_PTR(op, struct smb2srv_setinfo_op);
+   op->req = req;
+   op->info= info;
+   SMB2SRV_SETUP_NTVFS_REQUEST(smb2srv_setinfo_send, 
NTVFS_ASYNC_STATE_MAY_ASYNC);
+
+   info->in.level  = SVAL(req->in.body, 0x02);
+   SMB2SRV_CHECK(smb2_pull_s32o32_blob(&req->in, info, req->in.body+0x04, 
&info->in.blob));
+   info->in.flags  = IVAL(req->in.body, 0x0C);
+   info->in.file.ntvfs = smb2srv_pull_handle(req, 
req->in.body, 0x10);
+
+   SMB2SRV_CHECK_FILE_HANDLE(info->in.file.ntvfs);
+   SMB2SRV_CALL_NTVFS_BACKEND(smb2srv_setinfo_backend(op));
 }



svn commit: samba r16567 - in branches/SOC/sree: .

2006-06-27 Thread sree
Author: sree
Date: 2006-06-27 17:34:28 + (Tue, 27 Jun 2006)
New Revision: 16567

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

Log:
added code for userAccountControl flags in user_add()

new function user_profile_set() sets profile information


Modified:
   branches/SOC/sree/test.js
   branches/SOC/sree/usermgmt.js


Changeset:
Modified: branches/SOC/sree/test.js
===
--- branches/SOC/sree/test.js   2006-06-27 17:16:14 UTC (rev 16566)
+++ branches/SOC/sree/test.js   2006-06-27 17:34:28 UTC (rev 16567)
@@ -26,6 +26,14 @@
 
 printVars(user_get(sam, "sreetest", new Array("useraccountcontrol")));
 
+if(user_profile_set(sam, "sreetest", "profiles\\sreetest", 
"someserver\\logon.bat", "homes\\sreetest", "z:")){
+print("Successfully set profile parameters\n");
+
+printVars(user_get(sam, "sreetest", new Array("profilePath", "scriptPath", 
"homeDirectory", "homeDrive")));
+}
+else
+print("Failed to set user profile properties");
+
 if(user_delete(sam, "sreetest"))
 print("User successfully deleted!\n");
 else

Modified: branches/SOC/sree/usermgmt.js
===
--- branches/SOC/sree/usermgmt.js   2006-06-27 17:16:14 UTC (rev 16566)
+++ branches/SOC/sree/usermgmt.js   2006-06-27 17:34:28 UTC (rev 16567)
@@ -9,9 +9,9 @@
 libinclude("base.js");
 
 // userAccountFlags constants, decl here for now
-var UF_ACCOUNTDISABLE = 0x2;
-var UF_PASSWORD_CANT_CHANGE = 0x40;
-var UF_DONT_EXPIRE_PASSWORD = 0x1;
+UF_ACCOUNTDISABLE = 0x2;
+UF_PASSWORD_CANT_CHANGE = 0x40;
+UF_DONT_EXPIRE_PASSWORD = 0x1;
 
 // initialize user functions, and return opaque value to be used by
 // other functions
@@ -102,6 +102,8 @@
 // add a user
 function user_add(sam, username, fullname, description, password, flags, 
unixname)
 {
+var sys = sys_init();
+
 var aldif = new Array();
 
 var user_dn = sprintf("CN=%s,CN=Users,%s", 
@@ -152,10 +154,24 @@
}
 
 var userAccountControl = user['userAccountControl'];
+
+userAccountControl = 0 + userAccountControl; // conversion to number
 
-//TODO: Finish up mapping flags and uac, without bitwise operators
-//:-(
+//to handle default account created with the disabled bit set
+if(sys.bitAND(userAccountControl, UF_ACCOUNTDISABLE))
+   userAccountControl = userAccountControl - UF_ACCOUNTDISABLE;
 
+if(sys.bitAND(flags, UF_ACCOUNTDISABLE))
+   userAccountControl = sys.bitOR(userAccountControl, UF_ACCOUNTDISABLE);
+if(sys.bitAND(flags, UF_DONT_EXPIRE_PASSWORD))
+   userAccountControl = sys.bitOR(userAccountControl, 
UF_DONT_EXPIRE_PASSWORD);
+
+if(sys.bitAND(flags, UF_PASSWORD_CANT_CHANGE))
+   userAccountControl = sys.bitOR(userAccountControl, 
UF_PASSWORD_CANT_CHANGE);
+
+//TODO: User must change password at next logon
+// Account is locked out
+
 ldifmod = sprintf("
 dn: %s
 changetype: modify
@@ -274,3 +290,81 @@
 
 return(sam.ldb.transaction_commit());
 }
+
+// set user's profile settings
+// null parameters will leave existing untouched, while "" will erase
+// current values
+function user_profile_set(sam, username, profilepath, logonscript, homepath, 
homedrive)
+{
+var user_dn = sprintf("CN=%s,CN=Users,%s", 
+ username, sam.domain_dn);
+
+sam.ldb.transaction_start();
+
+user = user_get(sam, username, new Array("sAMAccount"));
+
+if(user == false)
+   {
+   print("Failed to get user's groups, no such user?\n");
+   sam.ldb.transaction_cancel();
+   return false;   
+   }
+
+var k = 0;
+var profile = new Array();
+
+if(profilepath != null) 
+   {
+   if(profilepath == "")
+   profile[k] = "delete: profilePath";
+   else
+   profile[k] = "replace: profilePath\nprofilePath: " + 
profilepath;
+   k = k + 1;
+   }
+
+if(logonscript != null) 
+   {
+   if(logonscript == "")
+   profile[k] = "delete: scriptPath";
+   else
+   profile[k] = "replace: scriptPath\nscriptPath: " + logonscript;
+   k = k + 1;
+   }
+
+if(homepath != null) 
+   {
+   if(homepath == "")
+   profile[k] = "delete: homeDirectory";
+   else
+   profile[k] = "replace: homeDirectory\nhomeDirectory: " + 
homepath;
+   k = k + 1;
+   }
+
+// if set, then homepath should specify a network location
+if(homedrive != null) 
+   {
+   if(homedrive == "")
+   profile[k] = "delete: homeDrive";
+   else
+   profile[k] = "replace: homeDrive\nhomeDrive: " + homedrive;
+   k = k + 1;
+   }
+
+if(k == 0)
+   {
+   print("No profile details provided\n");
+   sam.ldb.transaction_cancel();
+   return fals

svn commit: samba r16566 - in branches/SAMBA_4_0/source/libcli/smb2: .

2006-06-27 Thread metze
Author: metze
Date: 2006-06-27 17:16:14 + (Tue, 27 Jun 2006)
New Revision: 16566

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

Log:
add pull function for a site32/offset32 blob

metze
Modified:
   branches/SAMBA_4_0/source/libcli/smb2/request.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/smb2/request.c
===
--- branches/SAMBA_4_0/source/libcli/smb2/request.c 2006-06-27 15:59:33 UTC 
(rev 16565)
+++ branches/SAMBA_4_0/source/libcli/smb2/request.c 2006-06-27 17:16:14 UTC 
(rev 16566)
@@ -509,6 +509,30 @@
 }
 
 /*
+  pull a uint32_t length/ uint32_t ofs/blob triple from a data blob
+  the ptr points to the start of the offset/length pair
+*/
+NTSTATUS smb2_pull_s32o32_blob(struct smb2_request_buffer *buf, TALLOC_CTX 
*mem_ctx, uint8_t *ptr, DATA_BLOB *blob)
+{
+   uint32_t ofs, size;
+   if (smb2_oob(buf, ptr, 8)) {
+   return NT_STATUS_BUFFER_TOO_SMALL;
+   }
+   size = IVAL(ptr, 0);
+   ofs  = IVAL(ptr, 4);
+   if (ofs == 0 || size == 0) {
+   *blob = data_blob(NULL, 0);
+   return NT_STATUS_OK;
+   }
+   if (smb2_oob(buf, buf->hdr + ofs, size)) {
+   return NT_STATUS_BUFFER_TOO_SMALL;
+   }
+   *blob = data_blob_talloc(mem_ctx, buf->hdr + ofs, size);
+   NT_STATUS_HAVE_NO_MEMORY(blob->data);
+   return NT_STATUS_OK;
+}
+
+/*
   pull a string in a uint16_t ofs/ uint16_t length/blob format
   UTF-16 without termination
 */



svn commit: samba r16565 - in branches/tmp/vl-messaging/source/lib: .

2006-06-27 Thread ab
Author: ab
Date: 2006-06-27 15:59:33 + (Tue, 27 Jun 2006)
New Revision: 16565

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

Log:
Extending messaging API to allow dispatching messages with the specified
 message type mask. It's necessary for the lockd part.
Modified:
   branches/tmp/vl-messaging/source/lib/messages.c
   branches/tmp/vl-messaging/source/lib/messages_socket.c
   branches/tmp/vl-messaging/source/lib/messages_tdb.c


Changeset:
Modified: branches/tmp/vl-messaging/source/lib/messages.c
===
--- branches/tmp/vl-messaging/source/lib/messages.c 2006-06-27 15:14:56 UTC 
(rev 16564)
+++ branches/tmp/vl-messaging/source/lib/messages.c 2006-06-27 15:59:33 UTC 
(rev 16565)
@@ -59,6 +59,8 @@
 fd_set *rfds, fd_set *wfds);
 static unsigned int (*message_receive_func)(fd_set *rfds, fd_set *wfds);
 static BOOL (*retrieve_all_messages_func)(struct message_list **list);
+static BOOL (*retrieve_mask_messages_func)(unsigned int mask,
+   
   struct message_list **list);
 
 /* we have a linked list of dispatch handlers */
 static struct dispatch_fns {
@@ -110,6 +112,7 @@
message_select_setup_func = NULL;
message_receive_func = NULL;
retrieve_all_messages_func = retrieve_all_messages_tdb;
+   retrieve_mask_messages_func = retrieve_mask_messages_tdb;
if(!message_init_tdb()) return False;
break;
case MESSAGING_TYPE_DGRAM:
@@ -119,6 +122,7 @@
message_select_setup_func = message_select_setup_socket;
message_receive_func = message_receive_socket;
retrieve_all_messages_func = retrieve_all_messages_socket;
+   retrieve_mask_messages_func = retrieve_mask_messages_socket;
if(!message_init_socket()) return False;
break;
default:
@@ -169,7 +173,9 @@
 
message_send_pid_func = NULL;
message_select_setup_func = NULL;
+   message_receive_func = NULL;
retrieve_all_messages_func = NULL;
+   retrieve_mask_messages_func = NULL;
 
return True;
 }
@@ -241,6 +247,17 @@
 }
 
 /
+ Retrieve all messages for the current process with the specified types mask.
+/
+
+static BOOL retrieve_mask_messages(unsigned int mask,
+  struct 
message_list **list)
+{
+   SMB_ASSERT(retrieve_mask_messages_func != NULL);
+   return retrieve_mask_messages_func(mask, list);
+}
+
+/
  Set selectors for messaging sockets
 /
 
@@ -266,6 +283,84 @@
 }
 
 /
+ Converts message type to message type mask
+/
+
+BOOL message_type_mask(unsigned int msg_type, unsigned int *msg_mask)
+{
+   BOOL result = True;
+
+   if (msg_type < 1000)
+   *msg_mask = FLAG_MSG_GENERAL;
+   else if (msg_type > 1000 && msg_type < 2000)
+   *msg_mask = FLAG_MSG_NMBD;
+   else if (msg_type > 2000 && msg_type < 2100)
+   *msg_mask = FLAG_MSG_PRINT_NOTIFY;
+   else if (msg_type > 2100 && msg_type < 3000)
+   *msg_mask = FLAG_MSG_PRINT_GENERAL;
+   else if (msg_type > 3000 && msg_type < 4000)
+   *msg_mask = FLAG_MSG_SMBD;
+   else {
+   result = False;
+   }
+
+   return result;
+}
+
+/
+ Receive and dispatch any messages pending for this process with the
+ specified types mask
+/
+
+void message_dispatch_mask(unsigned int mask)
+{
+   struct message_list *list = NULL, *p;
+   struct dispatch_fns *dfn;
+   int n_handled;
+
+   if (!retrieve_mask_messages(mask, &list))
+   return ;
+
+   DEBUG(10,("A couple of messages received\n"));
+
+   for (p = list; p; p = p->next) {
+   struct message_rec* msg = p->msg;   
+   DEBUG(10,("message_dispatch: received msg_type=%d "
+ "src_pid=%u\n", msg->msg_type,
+ (unsigned int) procid_to_pid(&msg->src)));
+   n_handled = 0;
+   for (dfn = dispatch_fns; dfn; dfn = dfn->next) {
+   if (dfn->msg_type != msg->msg_type) {
+   continue;
+  

svn commit: samba r16564 - in branches/tmp/vl-messaging/source/lib: .

2006-06-27 Thread jmcd
Author: jmcd
Date: 2006-06-27 15:14:56 + (Tue, 27 Jun 2006)
New Revision: 16564

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

Log:
Whoops, forgot to add these two files.


Added:
   branches/tmp/vl-messaging/source/lib/dbwrap.c
   branches/tmp/vl-messaging/source/lib/dbwrap_msg.c


Changeset:
Added: branches/tmp/vl-messaging/source/lib/dbwrap.c
===
--- branches/tmp/vl-messaging/source/lib/dbwrap.c   2006-06-27 14:34:31 UTC 
(rev 16563)
+++ branches/tmp/vl-messaging/source/lib/dbwrap.c   2006-06-27 15:14:56 UTC 
(rev 16564)
@@ -0,0 +1,43 @@
+/* 
+   Unix SMB/CIFS implementation.
+   Database interface wrapper
+   Copyright (C) Jim McDonough <[EMAIL PROTECTED]> 2006
+
+   Major code contributions from Aleksey Fedoseev ([EMAIL PROTECTED])
+   
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+
+struct db_context *db_open(TALLOC_CTX *mem_ctx, const char *name,
+  int hash_size, int tdb_flags,
+  int open_flags, mode_t mode)
+{
+   switch((enum locking_type)lp_locking_type()) {
+   case LOCKING_TYPE_TDB:
+   return db_open_tdb(mem_ctx, name, hash_size, tdb_flags,
+  open_flags, mode);
+   case LOCKING_TYPE_FILES:
+   return db_open_file(mem_ctx, name, hash_size, tdb_flags,
+   open_flags, mode);  

+   case LOCKING_TYPE_MESSAGES:
+   return db_open_msg(mem_ctx, name, hash_size, tdb_flags,
+  open_flags, mode);
+   default:
+   DEBUG(0,("Bad locking type %d\n", lp_locking_type()));
+   return NULL;
+   }
+}

Added: branches/tmp/vl-messaging/source/lib/dbwrap_msg.c
===
--- branches/tmp/vl-messaging/source/lib/dbwrap_msg.c   2006-06-27 14:34:31 UTC 
(rev 16563)
+++ branches/tmp/vl-messaging/source/lib/dbwrap_msg.c   2006-06-27 15:14:56 UTC 
(rev 16564)
@@ -0,0 +1,30 @@
+/* 
+   Unix SMB/CIFS implementation.
+   Database interface using messages
+   Copyright (C) Jim McDonough <[EMAIL PROTECTED]> 2006
+
+   Major code contributions from Aleksey Fedoseev ([EMAIL PROTECTED])
+   
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+
+struct db_context *db_open_msg(TALLOC_CTX *mem_ctx, const char *name,
+   int hash_size, int tdb_flags,
+   int open_flags, mode_t mode)
+{
+   return NULL;
+}



svn commit: samba r16563 - in branches/tmp/vl-messaging/examples/clusterwide: .

2006-06-27 Thread ab
Author: ab
Date: 2006-06-27 14:34:31 + (Tue, 27 Jun 2006)
New Revision: 16563

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

Log:
update README to include stub for locking type options
Modified:
   branches/tmp/vl-messaging/examples/clusterwide/README


Changeset:
Modified: branches/tmp/vl-messaging/examples/clusterwide/README
===
--- branches/tmp/vl-messaging/examples/clusterwide/README   2006-06-27 
14:24:25 UTC (rev 16562)
+++ branches/tmp/vl-messaging/examples/clusterwide/README   2006-06-27 
14:34:31 UTC (rev 16563)
@@ -29,6 +29,21 @@
 'messaging network'. This parameters is used only if clusterwide
 messaging has been compiled in (see below).
 
+'locking' type options:
+
+locking type = one of (tdb, files, messages)
+
+  * tdb - old tbd-based implementation.
+  * files - storing locks in one large filesystem directory.
+  * messages - all locking operations go through the locking daemon,
+communications are performed with messages.
+
+'messages' type options:
+
+locking address = ip address [default is 127.0.0.1]
+
+IP-address of the locking daemon - the machine that stores locking database.
+
 2) Compile-time options
 
 --with-clusterwide-messaging



svn commit: samba r16562 - in branches/tmp/vl-messaging/source: . include lib locking param

2006-06-27 Thread jmcd
Author: jmcd
Date: 2006-06-27 14:24:25 + (Tue, 27 Jun 2006)
New Revision: 16562

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

Log:
Aleksey's changes to put in dbwrapper to later enable messaging.

Modified:
   branches/tmp/vl-messaging/source/Makefile.in
   branches/tmp/vl-messaging/source/include/smb.h
   branches/tmp/vl-messaging/source/lib/dbwrap_file.c
   branches/tmp/vl-messaging/source/lib/dbwrap_tdb.c
   branches/tmp/vl-messaging/source/locking/brlock.c
   branches/tmp/vl-messaging/source/locking/locking.c
   branches/tmp/vl-messaging/source/param/loadparm.c


Changeset:
Modified: branches/tmp/vl-messaging/source/Makefile.in
===
--- branches/tmp/vl-messaging/source/Makefile.in2006-06-27 11:07:55 UTC 
(rev 16561)
+++ branches/tmp/vl-messaging/source/Makefile.in2006-06-27 14:24:25 UTC 
(rev 16562)
@@ -182,7 +182,7 @@
tdb/lock.o tdb/open.o tdb/transaction.o tdb/traverse.o
 
 TDB_OBJ = $(TDBBASE_OBJ) tdb/tdbutil.o tdb/tdbback.o \
-   lib/dbwrap_tdb.o lib/dbwrap_file.o
+   lib/dbwrap.o lib/dbwrap_tdb.o lib/dbwrap_file.o lib/dbwrap_msg.o
 
 SMBLDAP_OBJ = @SMBLDAP@ @SMBLDAPUTIL@
 

Modified: branches/tmp/vl-messaging/source/include/smb.h
===
--- branches/tmp/vl-messaging/source/include/smb.h  2006-06-27 11:07:55 UTC 
(rev 16561)
+++ branches/tmp/vl-messaging/source/include/smb.h  2006-06-27 14:24:25 UTC 
(rev 16562)
@@ -713,6 +713,7 @@
BOOL initial_delete_on_close;
BOOL fresh;
BOOL modified;
+   struct db_record *record;
 };
 
 /*
@@ -862,6 +863,7 @@
BOOL modified;
struct lock_key key;
void *lock_data;
+   struct db_record *record;
 };
 
 #define BRLOCK_FN_CAST() \
@@ -1512,6 +1514,9 @@
 enum messaging_type {MESSAGING_TYPE_TDB, MESSAGING_TYPE_DGRAM,
 MESSAGING_TYPE_STREAM, 
MESSAGING_TYPE_DISPATCHER};
 
+/* locking types */
+enum locking_type {LOCKING_TYPE_TDB, LOCKING_TYPE_FILES, 
LOCKING_TYPE_MESSAGES};
+
 /*
  * Global value meaing that the smb_uid field should be
  * ingored (in share level security and protocol level == CORE)

Modified: branches/tmp/vl-messaging/source/lib/dbwrap_file.c
===
--- branches/tmp/vl-messaging/source/lib/dbwrap_file.c  2006-06-27 11:07:55 UTC 
(rev 16561)
+++ branches/tmp/vl-messaging/source/lib/dbwrap_file.c  2006-06-27 14:24:25 UTC 
(rev 16562)
@@ -123,7 +123,10 @@
return NULL;
}
 
+   become_root();
file->fd = open(file->path, O_RDWR|O_CREAT, 0644);
+   unbecome_root();
+
if (file->fd < 0) {
DEBUG(3, ("Could not open/create %s: %s\n",
  file->path, strerror(errno)));
@@ -221,11 +224,14 @@
talloc_get_type_abort(rec->private_data,
  struct db_locked_file);
 
+   become_root();
if (unlink(file->path) != 0) {
+   unbecome_root();
DEBUG(3, ("unlink(%s) failed: %s\n", file->path,
  strerror(errno)));
return -1;
}
+   unbecome_root();
 
return 0;
 }

Modified: branches/tmp/vl-messaging/source/lib/dbwrap_tdb.c
===
--- branches/tmp/vl-messaging/source/lib/dbwrap_tdb.c   2006-06-27 11:07:55 UTC 
(rev 16561)
+++ branches/tmp/vl-messaging/source/lib/dbwrap_tdb.c   2006-06-27 14:24:25 UTC 
(rev 16562)
@@ -165,7 +165,7 @@
return 0;
 }
 
-struct db_context *db_open(TALLOC_CTX *mem_ctx, const char *name,
+struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx, const char *name,
   int hash_size, int tdb_flags,
   int open_flags, mode_t mode)
 {

Modified: branches/tmp/vl-messaging/source/locking/brlock.c
===
--- branches/tmp/vl-messaging/source/locking/brlock.c   2006-06-27 11:07:55 UTC 
(rev 16561)
+++ branches/tmp/vl-messaging/source/locking/brlock.c   2006-06-27 14:24:25 UTC 
(rev 16562)
@@ -57,7 +57,7 @@
 
 /* The open brlock.tdb database. */
 
-static TDB_CONTEXT *tdb;
+static struct db_context *brlock_db;
 
 /
  Debug info at level 10 for lock struct.
@@ -267,14 +267,14 @@
 
 void brl_init(int read_only)
 {
-   if (tdb) {
+   if (brlock_db) {
return;
}
-   tdb = tdb_open_log(lock_path("brlock.tdb"),
-   lp_open_files_db_hash_size(),
-   TDB_DEFAULT|(read_only?0x0:TDB_CLEAR_IF_FIRST),
-   read_only?O_RDONLY:(O_RDWR|O_CREAT), 0644 );
-   if (!tdb) {
+   brlock_db = db_open(NULL, lock_path("brlock.tdb"),
+   

svn commit: samba r16561 - in branches/SAMBA_4_0/source: .

2006-06-27 Thread metze
Author: metze
Date: 2006-06-27 11:07:55 + (Tue, 27 Jun 2006)
New Revision: 16561

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

Log:
- create version.h relative to srcdir
- let version.h depend on VERSION
- add a rule to manualy regenerate version.h
  e.g. after a svn up

metze
Modified:
   branches/SAMBA_4_0/source/main.mk


Changeset:
Modified: branches/SAMBA_4_0/source/main.mk
===
--- branches/SAMBA_4_0/source/main.mk   2006-06-27 10:55:19 UTC (rev 16560)
+++ branches/SAMBA_4_0/source/main.mk   2006-06-27 11:07:55 UTC (rev 16561)
@@ -217,9 +217,12 @@
@echo "You need to rerun ./autogen.sh and ./configure"
@/bin/false
 
-$(srcdir)/version.h:
-   @$(SHELL) script/mkversion.sh VERSION version.h $(srcdir)/
+$(srcdir)/version.h: $(srcdir)/VERSION
+   @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
 
+regen_version:
+   @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
+
 clean_pch:
@echo "Removing precompiled headers"
@-rm -f include/includes.h.gch



svn commit: samba r16560 - in branches/SAMBA_4_0/source/script: .

2006-06-27 Thread metze
Author: metze
Date: 2006-06-27 10:55:19 + (Tue, 27 Jun 2006)
New Revision: 16560

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

Log:
print out the correct value

metze
Modified:
   branches/SAMBA_4_0/source/script/mkversion.sh


Changeset:
Modified: branches/SAMBA_4_0/source/script/mkversion.sh
===
--- branches/SAMBA_4_0/source/script/mkversion.sh   2006-06-27 08:43:10 UTC 
(rev 16559)
+++ branches/SAMBA_4_0/source/script/mkversion.sh   2006-06-27 10:55:19 UTC 
(rev 16560)
@@ -124,6 +124,6 @@
 
 echo "#define SAMBA_VERSION_STRING \"${SAMBA_VERSION_STRING}\"" >> $OUTPUT_FILE
 
-echo "$0: 'version.h' created for Samba(\"${SAMBA_VERSION_STRING}\")"
+echo "$0: '$OUTPUT_FILE' created for Samba(\"${SAMBA_VERSION_STRING}\")"
 
 exit 0



svn commit: samba r16559 - in branches/tmp/vl-messaging: examples/libsmbclient examples/misc source source/auth source/include source/lib source/libmsrpc source/libsmb source/locking source/nsswitch s

2006-06-27 Thread ab
Author: ab
Date: 2006-06-27 08:43:10 + (Tue, 27 Jun 2006)
New Revision: 16559

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

Log:
Merge -r 16458:16558 with trunk
Added:
   branches/tmp/vl-messaging/source/lib/util_reg.c
Modified:
   branches/tmp/vl-messaging/examples/libsmbclient/testbrowse.c
   branches/tmp/vl-messaging/examples/misc/adssearch.pl
   branches/tmp/vl-messaging/source/Makefile.in
   branches/tmp/vl-messaging/source/auth/auth_util.c
   branches/tmp/vl-messaging/source/configure.in
   branches/tmp/vl-messaging/source/include/ads.h
   branches/tmp/vl-messaging/source/include/libsmbclient.h
   branches/tmp/vl-messaging/source/include/rpc_reg.h
   branches/tmp/vl-messaging/source/include/smb_macros.h
   branches/tmp/vl-messaging/source/lib/util_str.c
   branches/tmp/vl-messaging/source/libmsrpc/libmsrpc_internal.c
   branches/tmp/vl-messaging/source/libsmb/clilist.c
   branches/tmp/vl-messaging/source/libsmb/libsmbclient.c
   branches/tmp/vl-messaging/source/locking/brlock.c
   branches/tmp/vl-messaging/source/locking/locking.c
   branches/tmp/vl-messaging/source/nsswitch/winbindd_cm.c
   branches/tmp/vl-messaging/source/nsswitch/winbindd_dual.c
   branches/tmp/vl-messaging/source/nsswitch/winbindd_pam.c
   branches/tmp/vl-messaging/source/popt/popt.c
   branches/tmp/vl-messaging/source/registry/reg_shares.c
   branches/tmp/vl-messaging/source/rpc_server/srv_eventlog_lib.c
   branches/tmp/vl-messaging/source/rpc_server/srv_eventlog_nt.c
   branches/tmp/vl-messaging/source/rpc_server/srv_samr_nt.c
   branches/tmp/vl-messaging/source/rpcclient/cmd_spoolss.c
   branches/tmp/vl-messaging/source/sam/nss_info.c
   branches/tmp/vl-messaging/source/smbd/dir.c
   branches/tmp/vl-messaging/source/smbd/fake_file.c
   branches/tmp/vl-messaging/source/smbd/open.c
   branches/tmp/vl-messaging/source/utils/net.c
   branches/tmp/vl-messaging/source/utils/net_rpc_printer.c
   branches/tmp/vl-messaging/source/utils/net_rpc_registry.c


Changeset:
Sorry, the patch is too large (1148 lines) to include; please use WebSVN to see 
it!
WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16559