svn commit: samba r14232 - branches/SAMBA_3_0/source/rpc_parse trunk/source/rpc_parse

2006-03-12 Thread vlendec
Author: vlendec
Date: 2006-03-12 10:44:19 + (Sun, 12 Mar 2006)
New Revision: 14232

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14232

Log:
Fix Coverity Bug # 218
Modified:
   branches/SAMBA_3_0/source/rpc_parse/parse_spoolss.c
   trunk/source/rpc_parse/parse_spoolss.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_parse/parse_spoolss.c
===
--- branches/SAMBA_3_0/source/rpc_parse/parse_spoolss.c 2006-03-12 04:25:35 UTC 
(rev 14231)
+++ branches/SAMBA_3_0/source/rpc_parse/parse_spoolss.c 2006-03-12 10:44:19 UTC 
(rev 14232)
@@ -3740,7 +3740,7 @@
 
q_u-level = level;
q_u-info.level = level;
-   q_u-info.info_ptr = (info != NULL) ? 1 : 0;
+   q_u-info.info_ptr = 1; /* Info is != NULL, see above */
switch (level) {
 
  /* There's no such thing as a setprinter level 1 */

Modified: trunk/source/rpc_parse/parse_spoolss.c
===
--- trunk/source/rpc_parse/parse_spoolss.c  2006-03-12 04:25:35 UTC (rev 
14231)
+++ trunk/source/rpc_parse/parse_spoolss.c  2006-03-12 10:44:19 UTC (rev 
14232)
@@ -3740,7 +3740,7 @@
 
q_u-level = level;
q_u-info.level = level;
-   q_u-info.info_ptr = (info != NULL) ? 1 : 0;
+   q_u-info.info_ptr = 1; /* Info is != NULL, see above */
switch (level) {
 
  /* There's no such thing as a setprinter level 1 */



svn commit: samba r14233 - branches/SAMBA_3_0/source/rpc_server trunk/source/rpc_server

2006-03-12 Thread vlendec
Author: vlendec
Date: 2006-03-12 10:47:02 + (Sun, 12 Mar 2006)
New Revision: 14233

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14233

Log:
Fix Coverity bug # 206
Modified:
   branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
   trunk/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
===
--- branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c   2006-03-12 
10:44:19 UTC (rev 14232)
+++ branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c   2006-03-12 
10:47:02 UTC (rev 14233)
@@ -4823,8 +4823,10 @@
if((printer=SMB_MALLOC_P(PRINTER_INFO_4))==NULL)
return WERR_NOMEM;
 
-   if (!construct_printer_info_4(print_hnd, printer, snum))
+   if (!construct_printer_info_4(print_hnd, printer, snum)) {
+   SAFE_FREE(printer);
return WERR_NOMEM;
+   }

/* check the required size. */  
*needed += spoolss_size_printer_info_4(printer);

Modified: trunk/source/rpc_server/srv_spoolss_nt.c
===
--- trunk/source/rpc_server/srv_spoolss_nt.c2006-03-12 10:44:19 UTC (rev 
14232)
+++ trunk/source/rpc_server/srv_spoolss_nt.c2006-03-12 10:47:02 UTC (rev 
14233)
@@ -4823,8 +4823,10 @@
if((printer=SMB_MALLOC_P(PRINTER_INFO_4))==NULL)
return WERR_NOMEM;
 
-   if (!construct_printer_info_4(print_hnd, printer, snum))
+   if (!construct_printer_info_4(print_hnd, printer, snum)) {
+   SAFE_FREE(printer);
return WERR_NOMEM;
+   }

/* check the required size. */  
*needed += spoolss_size_printer_info_4(printer);



svn commit: samba r14234 - branches/SAMBA_3_0/source/libsmb trunk/source/libsmb

2006-03-12 Thread vlendec
Author: vlendec
Date: 2006-03-12 10:52:56 + (Sun, 12 Mar 2006)
New Revision: 14234

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14234

Log:
Fix Coverity bug # 93
Modified:
   branches/SAMBA_3_0/source/libsmb/libsmbclient.c
   trunk/source/libsmb/libsmbclient.c


Changeset:
Modified: branches/SAMBA_3_0/source/libsmb/libsmbclient.c
===
--- branches/SAMBA_3_0/source/libsmb/libsmbclient.c 2006-03-12 10:47:02 UTC 
(rev 14233)
+++ branches/SAMBA_3_0/source/libsmb/libsmbclient.c 2006-03-12 10:52:56 UTC 
(rev 14234)
@@ -5784,6 +5784,7 @@
 
 context-internal = SMB_MALLOC_P(struct smbc_internal_data);
 if (!context-internal) {
+   SAFE_FREE(context);
 errno = ENOMEM;
 return NULL;
 }

Modified: trunk/source/libsmb/libsmbclient.c
===
--- trunk/source/libsmb/libsmbclient.c  2006-03-12 10:47:02 UTC (rev 14233)
+++ trunk/source/libsmb/libsmbclient.c  2006-03-12 10:52:56 UTC (rev 14234)
@@ -5784,6 +5784,7 @@
 
 context-internal = SMB_MALLOC_P(struct smbc_internal_data);
 if (!context-internal) {
+   SAFE_FREE(context);
 errno = ENOMEM;
 return NULL;
 }



svn commit: samba r14236 - branches/SAMBA_3_0/source/libsmb trunk/source/libsmb

2006-03-12 Thread vlendec
Author: vlendec
Date: 2006-03-12 11:00:06 + (Sun, 12 Mar 2006)
New Revision: 14236

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14236

Log:
Fix Coverity bug # 90
Modified:
   branches/SAMBA_3_0/source/libsmb/libsmbclient.c
   trunk/source/libsmb/libsmbclient.c


Changeset:
Modified: branches/SAMBA_3_0/source/libsmb/libsmbclient.c
===
--- branches/SAMBA_3_0/source/libsmb/libsmbclient.c 2006-03-12 10:57:42 UTC 
(rev 14235)
+++ branches/SAMBA_3_0/source/libsmb/libsmbclient.c 2006-03-12 11:00:06 UTC 
(rev 14236)
@@ -1070,6 +1070,7 @@
if (!cli_resolve_path( , srv-cli, path, targetcli, 
targetpath))
{
d_printf(Could not resolve %s\n, path);
+   SAFE_FREE(file);
return NULL;
}
/*d_printf(open: resolved %s as %s\n, path, targetpath);*/

Modified: trunk/source/libsmb/libsmbclient.c
===
--- trunk/source/libsmb/libsmbclient.c  2006-03-12 10:57:42 UTC (rev 14235)
+++ trunk/source/libsmb/libsmbclient.c  2006-03-12 11:00:06 UTC (rev 14236)
@@ -1070,6 +1070,7 @@
if (!cli_resolve_path( , srv-cli, path, targetcli, 
targetpath))
{
d_printf(Could not resolve %s\n, path);
+   SAFE_FREE(file);
return NULL;
}
/*d_printf(open: resolved %s as %s\n, path, targetpath);*/



svn commit: samba r14237 - in branches/SAMBA_4_0/source/build/smb_build: .

2006-03-12 Thread metze
Author: metze
Date: 2006-03-12 13:10:26 + (Sun, 12 Mar 2006)
New Revision: 14237

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14237

Log:
fix the summary output (step 1)

metze
Modified:
   branches/SAMBA_4_0/source/build/smb_build/summary.pm


Changeset:
Modified: branches/SAMBA_4_0/source/build/smb_build/summary.pm
===
--- branches/SAMBA_4_0/source/build/smb_build/summary.pm2006-03-12 
11:00:06 UTC (rev 14236)
+++ branches/SAMBA_4_0/source/build/smb_build/summary.pm2006-03-12 
13:10:26 UTC (rev 14237)
@@ -20,7 +20,7 @@
}
 
print Support for $desc: ;
-   if ($#need  0) {
+   if ($#need = 0) {
print no (install  . join(',',@need) . )\n;
} else {
print yes\n;
@@ -30,13 +30,16 @@
 sub show($$)
 {
my ($output,$config) = @_;
+
print Summary:\n\n;
showitem($output, GTK+ frontends, [gtk,gconf]);
showitem($output, SSL in SWAT, [GNUTLS]);
-   showitem($output, threads in smbd, [PTHREAD]);
+   showitem($output, threads in smbd (see --with-pthread), [PTHREAD]);
showitem($output, intelligent command line editing, [READLINE]);
-   showitem($output, changing process titles, [SETPROCTITLE]);
+   showitem($output, changing process titles (see --with-setproctitle), 
[SETPROCTITLE]);
showitem($output, using extended attributes, [XATTR]);
+   showitem($output, using libblkid, [BLKID]);
+   showitem($output, using pam, [PAM]);
print Using external popt: $output-{EXT_LIB_POPT}-{ENABLE}\n;
print Using shared libraries internally (experimental): ;
 



svn commit: samba r14238 - in branches/SAMBA_4_0/source/librpc/rpc: .

2006-03-12 Thread mimir
Author: mimir
Date: 2006-03-12 13:11:46 + (Sun, 12 Mar 2006)
New Revision: 14238

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14238

Log:
This is not needed anymore, as the state structure is zeroed
right after allocation.


rafal


Modified:
   branches/SAMBA_4_0/source/librpc/rpc/dcerpc_util.c


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc_util.c
===
--- branches/SAMBA_4_0/source/librpc/rpc/dcerpc_util.c  2006-03-12 13:10:26 UTC 
(rev 14237)
+++ branches/SAMBA_4_0/source/librpc/rpc/dcerpc_util.c  2006-03-12 13:11:46 UTC 
(rev 14238)
@@ -794,9 +794,6 @@
c-status = dcerpc_pipe_connect_b_recv(ctx, c, s-pipe);
if (!composite_is_ok(c)) return;
 
-   ZERO_STRUCT(s-handle);
-   ZERO_STRUCT(s-guid);
-
/* prepare requested binding parameters */
s-binding-object = s-table-uuid;
s-binding-object_version = s-table-if_version;



svn commit: samba r14239 - in branches/SAMBA_4_0/source/libcli/composite: .

2006-03-12 Thread mimir
Author: mimir
Date: 2006-03-12 13:14:21 + (Sun, 12 Mar 2006)
New Revision: 14239

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14239

Log:
Fix indentation.


rafal


Modified:
   branches/SAMBA_4_0/source/libcli/composite/composite.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/composite/composite.c
===
--- branches/SAMBA_4_0/source/libcli/composite/composite.c  2006-03-12 
13:11:46 UTC (rev 14238)
+++ branches/SAMBA_4_0/source/libcli/composite/composite.c  2006-03-12 
13:14:21 UTC (rev 14239)
@@ -115,9 +115,9 @@
 }
 
 _PUBLIC_ void composite_continue(struct composite_context *ctx,
-   struct composite_context *new_ctx,
-   void (*continuation)(struct composite_context *),
-   void *private_data)
+struct composite_context *new_ctx,
+void (*continuation)(struct composite_context 
*),
+void *private_data)
 {
if (composite_nomem(new_ctx, ctx)) return;
new_ctx-async.fn = continuation;
@@ -125,9 +125,9 @@
 }
 
 _PUBLIC_ void composite_continue_rpc(struct composite_context *ctx,
-   struct rpc_request *new_req,
-   void (*continuation)(struct rpc_request *),
-   void *private_data)
+struct rpc_request *new_req,
+void (*continuation)(struct rpc_request *),
+void *private_data)
 {
if (composite_nomem(new_req, ctx)) return;
new_req-async.callback = continuation;
@@ -135,9 +135,9 @@
 }
 
 _PUBLIC_ void composite_continue_irpc(struct composite_context *ctx,
-struct irpc_request *new_req,
-void (*continuation)(struct irpc_request *),
-void *private_data)
+ struct irpc_request *new_req,
+ void (*continuation)(struct irpc_request 
*),
+ void *private_data)
 {
if (composite_nomem(new_req, ctx)) return;
new_req-async.fn = continuation;
@@ -145,9 +145,9 @@
 }
 
 _PUBLIC_ void composite_continue_smb(struct composite_context *ctx,
-   struct smbcli_request *new_req,
-   void (*continuation)(struct smbcli_request *),
-   void *private_data)
+struct smbcli_request *new_req,
+void (*continuation)(struct smbcli_request 
*),
+void *private_data)
 {
if (composite_nomem(new_req, ctx)) return;
new_req-async.fn = continuation;
@@ -155,9 +155,9 @@
 }
 
 _PUBLIC_ void composite_continue_nbt(struct composite_context *ctx,
-   struct nbt_name_request *new_req,
-   void (*continuation)(struct nbt_name_request *),
-   void *private_data)
+struct nbt_name_request *new_req,
+void (*continuation)(struct 
nbt_name_request *),
+void *private_data)
 {
if (composite_nomem(new_req, ctx)) return;
new_req-async.fn = continuation;



svn commit: samba r14240 - in branches/SAMBA_4_0/source: build/smb_build lib/popt lib/replace ntvfs/posix

2006-03-12 Thread metze
Author: metze
Date: 2006-03-12 13:36:08 + (Sun, 12 Mar 2006)
New Revision: 14240

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14240

Log:
fix summary output (step 2)

we now need to explicit enable external libraries in
*.m4 files again...

metze
Modified:
   branches/SAMBA_4_0/source/build/smb_build/input.pm
   branches/SAMBA_4_0/source/lib/popt/config.m4
   branches/SAMBA_4_0/source/lib/replace/readline.m4
   branches/SAMBA_4_0/source/ntvfs/posix/config.m4


Changeset:
Modified: branches/SAMBA_4_0/source/build/smb_build/input.pm
===
--- branches/SAMBA_4_0/source/build/smb_build/input.pm  2006-03-12 13:14:21 UTC 
(rev 14239)
+++ branches/SAMBA_4_0/source/build/smb_build/input.pm  2006-03-12 13:36:08 UTC 
(rev 14240)
@@ -175,7 +175,11 @@
}

unless(defined($part-{ENABLE})) {
-   $part-{ENABLE} = YES;
+   if ($part-{TYPE} eq EXT_LIB) {
+   $part-{ENABLE} = NO;
+   } else {
+   $part-{ENABLE} = YES;
+   }
}
}
 

Modified: branches/SAMBA_4_0/source/lib/popt/config.m4
===
--- branches/SAMBA_4_0/source/lib/popt/config.m42006-03-12 13:14:21 UTC 
(rev 14239)
+++ branches/SAMBA_4_0/source/lib/popt/config.m42006-03-12 13:36:08 UTC 
(rev 14240)
@@ -35,6 +35,7 @@
[],
[EXT_LIB_POPT])
SMB_EXT_LIB(POPT, [${TMP_LIBPOPT_LIBS}])
+   SMB_EXT_LIB_ENABLE(POPT,YES)
AC_MSG_RESULT(no)
 fi
 

Modified: branches/SAMBA_4_0/source/lib/replace/readline.m4
===
--- branches/SAMBA_4_0/source/lib/replace/readline.m4   2006-03-12 13:14:21 UTC 
(rev 14239)
+++ branches/SAMBA_4_0/source/lib/replace/readline.m4   2006-03-12 13:36:08 UTC 
(rev 14240)
@@ -2,6 +2,7 @@
 # Readline included by default unless explicitly asked not to
 test ${with_readline+set} != set  with_readline=yes
 
+EXTERNAL_READLINE=no
 # test for where we get readline() from
 AC_MSG_CHECKING(whether to use readline)
 AC_ARG_WITH(readline,
@@ -19,7 +20,7 @@
   done
   AC_CHECK_LIB(readline, rl_callback_handler_install,
[TERMLIBS=-lreadline $TERMLIBS
-   AC_DEFINE(HAVE_LIBREADLINE,1,[Whether the system has readline])
+   EXTERNAL_READLINE=yes
break], [TERMLIBS=], $TERMLIBS)])
 ;;
   no)
@@ -50,7 +51,7 @@
LDFLAGS=-L$with_readline/lib $LDFLAGS
CPPFLAGS=-I$with_readline/include $CPPFLAGS
TERMLIBS=-lreadline $TERMLIBS
-   AC_DEFINE(HAVE_LIBREADLINE,1,[Whether the system has readline])
+   EXTERNAL_READLINE=yes
break], [TERMLIBS= CPPFLAGS=$_cppflags], $TERMLIBS)])
 
 ;;
@@ -67,6 +68,18 @@
 [],
 [$TERMLIBS])
 
-SMB_EXT_LIB(READLINE, [${TERMLIBS}])
-
-SMB_SUBSYSTEM(LIBREADLINE, [lib/replace/readline.o], [EXT_LIB_READLINE])
+AC_MSG_CHECKING(whether to use extern readline)
+if test x$EXTERNAL_READLINE = xyes; then
+   AC_MSG_RESULT(yes)
+   AC_DEFINE(HAVE_LIBREADLINE,1,[Whether the system has readline])
+   SMB_SUBSYSTEM(LIBREADLINE,
+   [lib/replace/readline.o],
+   [EXT_LIB_READLINE])
+   SMB_EXT_LIB(READLINE, [${TERMLIBS}])
+   SMB_EXT_LIB_ENABLE(READLINE,YES)
+else
+   SMB_SUBSYSTEM(LIBREADLINE,
+   [lib/replace/readline.o],
+   [])
+   AC_MSG_RESULT(no)
+fi

Modified: branches/SAMBA_4_0/source/ntvfs/posix/config.m4
===
--- branches/SAMBA_4_0/source/ntvfs/posix/config.m4 2006-03-12 13:14:21 UTC 
(rev 14239)
+++ branches/SAMBA_4_0/source/ntvfs/posix/config.m4 2006-03-12 13:36:08 UTC 
(rev 14240)
@@ -30,6 +30,7 @@
 
SMB_EXT_LIB(XATTR,[${XATTR_LIBS}],[${XATTR_CFLAGS}],[${XATTR_CPPFLAGS}],[${XATTR_LDFLAGS}])
 if test x$ac_cv_func_ext_flistxattr = xyes; then
AC_DEFINE(HAVE_XATTR_SUPPORT,1,[Whether we have xattr support])
+   SMB_EXT_LIB_ENABLE(XATTR,YES)
 fi
 
 AC_CHECK_HEADERS(blkid/blkid.h)
@@ -38,4 +39,5 @@
 
SMB_EXT_LIB(BLKID,[${BLKID_LIBS}],[${BLKID_CFLAGS}],[${BLKID_CPPFLAGS}],[${BLKID_LDFLAGS}])
 if test x$ac_cv_func_ext_blkid_get_cache = xyes; then
AC_DEFINE(HAVE_LIBBLKID,1,[Whether we have blkid support (e2fsprogs)])
+   SMB_EXT_LIB_ENABLE(BLKID,YES)
 fi



svn commit: samba r14241 - branches/SAMBA_3_0/source/libsmb trunk/source/libsmb

2006-03-12 Thread vlendec
Author: vlendec
Date: 2006-03-12 17:18:26 + (Sun, 12 Mar 2006)
New Revision: 14241

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14241

Log:
Fix Coverity bug # 146
Modified:
   branches/SAMBA_3_0/source/libsmb/libsmbclient.c
   trunk/source/libsmb/libsmbclient.c


Changeset:
Modified: branches/SAMBA_3_0/source/libsmb/libsmbclient.c
===
--- branches/SAMBA_3_0/source/libsmb/libsmbclient.c 2006-03-12 13:36:08 UTC 
(rev 14240)
+++ branches/SAMBA_3_0/source/libsmb/libsmbclient.c 2006-03-12 17:18:26 UTC 
(rev 14241)
@@ -1200,7 +1200,7 @@
  * the call to cli_read() instead of file-offset fixes a problem
  * retrieving data at an offset greater than 4GB.
  */
-off_t offset = file-offset;
+off_t offset;
 
if (!context || !context-internal ||
!context-internal-_initialized) {
@@ -1219,6 +1219,8 @@
 
}
 
+   offset = file-offset;
+
/* Check that the buffer exists ... */
 
if (buf == NULL) {

Modified: trunk/source/libsmb/libsmbclient.c
===
--- trunk/source/libsmb/libsmbclient.c  2006-03-12 13:36:08 UTC (rev 14240)
+++ trunk/source/libsmb/libsmbclient.c  2006-03-12 17:18:26 UTC (rev 14241)
@@ -1200,7 +1200,7 @@
  * the call to cli_read() instead of file-offset fixes a problem
  * retrieving data at an offset greater than 4GB.
  */
-off_t offset = file-offset;
+off_t offset;
 
if (!context || !context-internal ||
!context-internal-_initialized) {
@@ -1219,6 +1219,8 @@
 
}
 
+   offset = file-offset;
+
/* Check that the buffer exists ... */
 
if (buf == NULL) {



svn commit: samba r14242 - branches/SAMBA_3_0/source/client trunk/source/client

2006-03-12 Thread vlendec
Author: vlendec
Date: 2006-03-12 17:24:10 + (Sun, 12 Mar 2006)
New Revision: 14242

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14242

Log:
Fix Coverity bug # 82
Modified:
   branches/SAMBA_3_0/source/client/clitar.c
   trunk/source/client/clitar.c


Changeset:
Modified: branches/SAMBA_3_0/source/client/clitar.c
===
--- branches/SAMBA_3_0/source/client/clitar.c   2006-03-12 17:18:26 UTC (rev 
14241)
+++ branches/SAMBA_3_0/source/client/clitar.c   2006-03-12 17:24:10 UTC (rev 
14242)
@@ -523,6 +523,8 @@
 
if ((partpath == NULL) || (ffname == NULL)){
DEBUG(0, (Out of memory in ensurepath: %s\n, fname));
+   SAFE_FREE(partpath);
+   SAFE_FREE(ffname);
return(False);
}
 

Modified: trunk/source/client/clitar.c
===
--- trunk/source/client/clitar.c2006-03-12 17:18:26 UTC (rev 14241)
+++ trunk/source/client/clitar.c2006-03-12 17:24:10 UTC (rev 14242)
@@ -523,6 +523,8 @@
 
if ((partpath == NULL) || (ffname == NULL)){
DEBUG(0, (Out of memory in ensurepath: %s\n, fname));
+   SAFE_FREE(partpath);
+   SAFE_FREE(ffname);
return(False);
}
 



svn commit: samba r14243 - branches/SAMBA_3_0/source/rpc_client trunk/source/rpc_client

2006-03-12 Thread vlendec
Author: vlendec
Date: 2006-03-12 17:26:56 + (Sun, 12 Mar 2006)
New Revision: 14243

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14243

Log:
Fix Coverity bug # 143
Modified:
   branches/SAMBA_3_0/source/rpc_client/cli_spoolss.c
   trunk/source/rpc_client/cli_spoolss.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_client/cli_spoolss.c
===
--- branches/SAMBA_3_0/source/rpc_client/cli_spoolss.c  2006-03-12 17:24:10 UTC 
(rev 14242)
+++ branches/SAMBA_3_0/source/rpc_client/cli_spoolss.c  2006-03-12 17:26:56 UTC 
(rev 14243)
@@ -361,7 +361,7 @@
uint32 i;
 
*jobs = TALLOC_ARRAY(mem_ctx, JOB_INFO_2, num_jobs);
-   if (!jobs) {
+   if (*jobs == NULL) {
return False;
}
prs_set_offset(buffer-prs,0);

Modified: trunk/source/rpc_client/cli_spoolss.c
===
--- trunk/source/rpc_client/cli_spoolss.c   2006-03-12 17:24:10 UTC (rev 
14242)
+++ trunk/source/rpc_client/cli_spoolss.c   2006-03-12 17:26:56 UTC (rev 
14243)
@@ -361,7 +361,7 @@
uint32 i;
 
*jobs = TALLOC_ARRAY(mem_ctx, JOB_INFO_2, num_jobs);
-   if (!jobs) {
+   if (*jobs == NULL) {
return False;
}
prs_set_offset(buffer-prs,0);



svn commit: samba r14244 - branches/SAMBA_3_0/source/rpc_client trunk/source/rpc_client

2006-03-12 Thread vlendec
Author: vlendec
Date: 2006-03-12 17:29:42 + (Sun, 12 Mar 2006)
New Revision: 14244

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14244

Log:
Okay, had not seen that this happened twice.

Fix Coverity bug # 142.

Volker
Modified:
   branches/SAMBA_3_0/source/rpc_client/cli_spoolss.c
   trunk/source/rpc_client/cli_spoolss.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_client/cli_spoolss.c
===
--- branches/SAMBA_3_0/source/rpc_client/cli_spoolss.c  2006-03-12 17:26:56 UTC 
(rev 14243)
+++ branches/SAMBA_3_0/source/rpc_client/cli_spoolss.c  2006-03-12 17:29:42 UTC 
(rev 14244)
@@ -338,7 +338,7 @@
uint32 i;
 
*jobs = TALLOC_ARRAY(mem_ctx, JOB_INFO_1, num_jobs);
-   if (!jobs) {
+   if (*jobs == NULL) {
return False;
}
prs_set_offset(buffer-prs,0);

Modified: trunk/source/rpc_client/cli_spoolss.c
===
--- trunk/source/rpc_client/cli_spoolss.c   2006-03-12 17:26:56 UTC (rev 
14243)
+++ trunk/source/rpc_client/cli_spoolss.c   2006-03-12 17:29:42 UTC (rev 
14244)
@@ -338,7 +338,7 @@
uint32 i;
 
*jobs = TALLOC_ARRAY(mem_ctx, JOB_INFO_1, num_jobs);
-   if (!jobs) {
+   if (*jobs == NULL) {
return False;
}
prs_set_offset(buffer-prs,0);



svn commit: samba r14245 - branches/SAMBA_3_0/source/rpcclient trunk/source/rpcclient

2006-03-12 Thread vlendec
Author: vlendec
Date: 2006-03-12 17:44:00 + (Sun, 12 Mar 2006)
New Revision: 14245

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14245

Log:
We've dereferenced argv before, no point in checking.

Fix Coverity bug # 144.

Volker
Modified:
   branches/SAMBA_3_0/source/rpcclient/rpcclient.c
   trunk/source/rpcclient/rpcclient.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpcclient/rpcclient.c
===
--- branches/SAMBA_3_0/source/rpcclient/rpcclient.c 2006-03-12 17:29:42 UTC 
(rev 14244)
+++ branches/SAMBA_3_0/source/rpcclient/rpcclient.c 2006-03-12 17:44:00 UTC 
(rev 14245)
@@ -663,13 +663,11 @@
}
 */
 
-   if (argv) {
-   /* NOTE: popt allocates the whole argv, including the
-* strings, as a single block.  So a single free is
-* enough to release it -- we don't free the
-* individual strings.  rtfm. */
-   free(argv);
-   }
+   /* NOTE: popt allocates the whole argv, including the
+* strings, as a single block.  So a single free is
+* enough to release it -- we don't free the
+* individual strings.  rtfm. */
+   free(argv);

return result;
 }

Modified: trunk/source/rpcclient/rpcclient.c
===
--- trunk/source/rpcclient/rpcclient.c  2006-03-12 17:29:42 UTC (rev 14244)
+++ trunk/source/rpcclient/rpcclient.c  2006-03-12 17:44:00 UTC (rev 14245)
@@ -665,13 +665,11 @@
}
 */
 
-   if (argv) {
-   /* NOTE: popt allocates the whole argv, including the
-* strings, as a single block.  So a single free is
-* enough to release it -- we don't free the
-* individual strings.  rtfm. */
-   free(argv);
-   }
+   /* NOTE: popt allocates the whole argv, including the
+* strings, as a single block.  So a single free is
+* enough to release it -- we don't free the
+* individual strings.  rtfm. */
+   free(argv);

return result;
 }



svn commit: samba r14246 - branches/SAMBA_3_0/source/client trunk/source/client

2006-03-12 Thread vlendec
Author: vlendec
Date: 2006-03-12 17:48:51 + (Sun, 12 Mar 2006)
New Revision: 14246

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14246

Log:
Fix Coverity bug # 85
Modified:
   branches/SAMBA_3_0/source/client/clitar.c
   trunk/source/client/clitar.c


Changeset:
Modified: branches/SAMBA_3_0/source/client/clitar.c
===
--- branches/SAMBA_3_0/source/client/clitar.c   2006-03-12 17:44:00 UTC (rev 
14245)
+++ branches/SAMBA_3_0/source/client/clitar.c   2006-03-12 17:48:51 UTC (rev 
14246)
@@ -1112,6 +1112,7 @@
/* Get us to the next block, or the first block first time 
around */
if (next_block(tarbuf, buffer_p, tbufsiz) = 0) {
DEBUG(0, (Empty file, short tar file, or read error: 
%s\n, strerror(errno)));
+   SAFE_FREE(longfilename);
return;
}
 
@@ -1183,6 +1184,7 @@
}
break;
case 'L':
+   SAFE_FREE(longfilename);
longfilename = get_longfilename(finfo);
if (!longfilename) {
DEBUG(0, (abandoning restore\n));

Modified: trunk/source/client/clitar.c
===
--- trunk/source/client/clitar.c2006-03-12 17:44:00 UTC (rev 14245)
+++ trunk/source/client/clitar.c2006-03-12 17:48:51 UTC (rev 14246)
@@ -,6 +,7 @@
/* Get us to the next block, or the first block first time 
around */
if (next_block(tarbuf, buffer_p, tbufsiz) = 0) {
DEBUG(0, (Empty file, short tar file, or read error: 
%s\n, strerror(errno)));
+   SAFE_FREE(longfilename);
return;
}
 
@@ -1182,6 +1183,7 @@
}
break;
case 'L':
+   SAFE_FREE(longfilename);
longfilename = get_longfilename(finfo);
if (!longfilename) {
DEBUG(0, (abandoning restore\n));



svn commit: samba r14247 - branches/SAMBA_3_0/source/registry trunk/source/registry

2006-03-12 Thread vlendec
Author: vlendec
Date: 2006-03-12 17:53:57 + (Sun, 12 Mar 2006)
New Revision: 14247

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14247

Log:
Fix Coverity bug # 136
Modified:
   branches/SAMBA_3_0/source/registry/reg_db.c
   trunk/source/registry/reg_db.c


Changeset:
Modified: branches/SAMBA_3_0/source/registry/reg_db.c
===
--- branches/SAMBA_3_0/source/registry/reg_db.c 2006-03-12 17:48:51 UTC (rev 
14246)
+++ branches/SAMBA_3_0/source/registry/reg_db.c 2006-03-12 17:53:57 UTC (rev 
14247)
@@ -525,11 +525,13 @@
int len = 0;
int i;
REGISTRY_VALUE  *val;
-   int num_values = regval_ctr_numvals( values );
+   int num_values;
 
if ( !values )
return 0;
 
+   num_values = regval_ctr_numvals( values );
+
/* pack the number of values first */

len += tdb_pack( buf+len, buflen-len, d, num_values );

Modified: trunk/source/registry/reg_db.c
===
--- trunk/source/registry/reg_db.c  2006-03-12 17:48:51 UTC (rev 14246)
+++ trunk/source/registry/reg_db.c  2006-03-12 17:53:57 UTC (rev 14247)
@@ -525,11 +525,13 @@
int len = 0;
int i;
REGISTRY_VALUE  *val;
-   int num_values = regval_ctr_numvals( values );
+   int num_values;
 
if ( !values )
return 0;
 
+   num_values = regval_ctr_numvals( values );
+
/* pack the number of values first */

len += tdb_pack( buf+len, buflen-len, d, num_values );



svn commit: samba r14248 - branches/SAMBA_3_0/source/client trunk/source/client

2006-03-12 Thread vlendec
Author: vlendec
Date: 2006-03-12 17:57:05 + (Sun, 12 Mar 2006)
New Revision: 14248

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14248

Log:
Fix Coverity bug # 84
Modified:
   branches/SAMBA_3_0/source/client/clitar.c
   trunk/source/client/clitar.c


Changeset:
Modified: branches/SAMBA_3_0/source/client/clitar.c
===
--- branches/SAMBA_3_0/source/client/clitar.c   2006-03-12 17:53:57 UTC (rev 
14247)
+++ branches/SAMBA_3_0/source/client/clitar.c   2006-03-12 17:57:05 UTC (rev 
14248)
@@ -1724,6 +1724,7 @@
 
if ((tmpstr = (char 
*)SMB_MALLOC(strlen(cliplist[clipcount])+1)) == NULL) {
DEBUG(0, (Could not allocate space for a 
cliplist item, # %i\n, clipcount));
+   SAFE_FREE(tmplist);
return 0;
}
 

Modified: trunk/source/client/clitar.c
===
--- trunk/source/client/clitar.c2006-03-12 17:53:57 UTC (rev 14247)
+++ trunk/source/client/clitar.c2006-03-12 17:57:05 UTC (rev 14248)
@@ -1723,6 +1723,7 @@
 
if ((tmpstr = (char 
*)SMB_MALLOC(strlen(cliplist[clipcount])+1)) == NULL) {
DEBUG(0, (Could not allocate space for a 
cliplist item, # %i\n, clipcount));
+   SAFE_FREE(tmplist);
return 0;
}
 



svn commit: samba r14249 - branches/SAMBA_3_0/source/lib trunk/source/lib

2006-03-12 Thread vlendec
Author: vlendec
Date: 2006-03-12 18:01:36 + (Sun, 12 Mar 2006)
New Revision: 14249

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14249

Log:
We've dereferenced the_acl before, no point in checking.

Fix Coverity bug # 128.

Volker
Modified:
   branches/SAMBA_3_0/source/lib/secdesc.c
   trunk/source/lib/secdesc.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/secdesc.c
===
--- branches/SAMBA_3_0/source/lib/secdesc.c 2006-03-12 17:57:05 UTC (rev 
14248)
+++ branches/SAMBA_3_0/source/lib/secdesc.c 2006-03-12 18:01:36 UTC (rev 
14249)
@@ -433,7 +433,7 @@
if (!(new_ace_list = TALLOC_ARRAY(ctx, SEC_ACE, the_acl-num_aces))) 
return NULL;
 
-   for (i = 0; the_acl  i  the_acl-num_aces; i++) {
+   for (i = 0; i  the_acl-num_aces; i++) {
SEC_ACE *ace = the_acl-ace[i];
SEC_ACE *new_ace = new_ace_list[new_ace_list_ndx];
uint8 new_flags = 0;

Modified: trunk/source/lib/secdesc.c
===
--- trunk/source/lib/secdesc.c  2006-03-12 17:57:05 UTC (rev 14248)
+++ trunk/source/lib/secdesc.c  2006-03-12 18:01:36 UTC (rev 14249)
@@ -433,7 +433,7 @@
if (!(new_ace_list = TALLOC_ARRAY(ctx, SEC_ACE, the_acl-num_aces))) 
return NULL;
 
-   for (i = 0; the_acl  i  the_acl-num_aces; i++) {
+   for (i = 0; i  the_acl-num_aces; i++) {
SEC_ACE *ace = the_acl-ace[i];
SEC_ACE *new_ace = new_ace_list[new_ace_list_ndx];
uint8 new_flags = 0;



svn commit: samba r14250 - in branches/SAMBA_3_0/source/rpc_server: .

2006-03-12 Thread jra
Author: jra
Date: 2006-03-12 19:16:45 + (Sun, 12 Mar 2006)
New Revision: 14250

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14250

Log:
Fix coverity bug #107. Resource leak on error path.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
===
--- branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c   2006-03-12 
18:01:36 UTC (rev 14249)
+++ branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c   2006-03-12 
19:16:45 UTC (rev 14250)
@@ -4862,8 +4862,10 @@
if((printer=SMB_MALLOC_P(PRINTER_INFO_5))==NULL)
return WERR_NOMEM;
 
-   if (!construct_printer_info_5(print_hnd, printer, snum))
+   if (!construct_printer_info_5(print_hnd, printer, snum)) {
+   free_printer_info_5(printer);
return WERR_NOMEM;
+   }

/* check the required size. */  
*needed += spoolss_size_printer_info_5(printer);



svn commit: samba r14251 - in trunk/source/rpc_server: .

2006-03-12 Thread jra
Author: jra
Date: 2006-03-12 19:16:57 + (Sun, 12 Mar 2006)
New Revision: 14251

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14251

Log:
Fix coverity bug #107. Resource leak on error path.
Jeremy.

Modified:
   trunk/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: trunk/source/rpc_server/srv_spoolss_nt.c
===
--- trunk/source/rpc_server/srv_spoolss_nt.c2006-03-12 19:16:45 UTC (rev 
14250)
+++ trunk/source/rpc_server/srv_spoolss_nt.c2006-03-12 19:16:57 UTC (rev 
14251)
@@ -4862,8 +4862,10 @@
if((printer=SMB_MALLOC_P(PRINTER_INFO_5))==NULL)
return WERR_NOMEM;
 
-   if (!construct_printer_info_5(print_hnd, printer, snum))
+   if (!construct_printer_info_5(print_hnd, printer, snum)) {
+   free_printer_info_5(printer);
return WERR_NOMEM;
+   }

/* check the required size. */  
*needed += spoolss_size_printer_info_5(printer);



svn commit: samba r14252 - branches/SAMBA_3_0/source/libads trunk/source/libads

2006-03-12 Thread jmcd
Author: jmcd
Date: 2006-03-12 19:56:10 + (Sun, 12 Mar 2006)
New Revision: 14252

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14252

Log:
Fix Coverity #72: free alloc'ed storage before return.  Also found one
more that coverity didn't find from asprintf.

Modified:
   branches/SAMBA_3_0/source/libads/ldap.c
   trunk/source/libads/ldap.c


Changeset:
Modified: branches/SAMBA_3_0/source/libads/ldap.c
===
--- branches/SAMBA_3_0/source/libads/ldap.c 2006-03-12 19:16:57 UTC (rev 
14251)
+++ branches/SAMBA_3_0/source/libads/ldap.c 2006-03-12 19:56:10 UTC (rev 
14252)
@@ -1914,7 +1914,10 @@
 * we have to bail out before prs_init */
ps_wire.is_dynamic = False;
 
-   if (!ads) return ADS_ERROR(LDAP_SERVER_DOWN);
+   if (!ads) {
+   SAFE_FREE(escaped_hostname);
+   return ADS_ERROR(LDAP_SERVER_DOWN);
+   }
 
ret = ADS_ERROR(LDAP_SUCCESS);
 
@@ -1932,6 +1935,8 @@
 
ret = ads_search(ads, (void *) res, expr, attrs);
 
+   SAFE_FREE(expr);
+
if (!ADS_ERR_OK(ret)) return ret;
 
if ( !(msg = ads_first_entry(ads, res) )) {

Modified: trunk/source/libads/ldap.c
===
--- trunk/source/libads/ldap.c  2006-03-12 19:16:57 UTC (rev 14251)
+++ trunk/source/libads/ldap.c  2006-03-12 19:56:10 UTC (rev 14252)
@@ -1914,7 +1914,10 @@
 * we have to bail out before prs_init */
ps_wire.is_dynamic = False;
 
-   if (!ads) return ADS_ERROR(LDAP_SERVER_DOWN);
+   if (!ads) {
+   SAFE_FREE(escaped_hostname);
+   return ADS_ERROR(LDAP_SERVER_DOWN);
+   }
 
ret = ADS_ERROR(LDAP_SUCCESS);
 
@@ -1932,6 +1935,8 @@
 
ret = ads_search(ads, (void *) res, expr, attrs);
 
+   SAFE_FREE(expr);
+
if (!ADS_ERR_OK(ret)) return ret;
 
if ( !(msg = ads_first_entry(ads, res) )) {



svn commit: samba r14253 - in trunk/source: include param web

2006-03-12 Thread idra
Author: idra
Date: 2006-03-12 21:28:11 + (Sun, 12 Mar 2006)
New Revision: 14253

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14253

Log:

fix trunk !
revert jpeach's patch 



Modified:
   trunk/source/include/smb.h
   trunk/source/param/loadparm.c
   trunk/source/web/swat.c


Changeset:
Modified: trunk/source/include/smb.h
===
--- trunk/source/include/smb.h  2006-03-12 19:56:10 UTC (rev 14252)
+++ trunk/source/include/smb.h  2006-03-12 21:28:11 UTC (rev 14253)
@@ -760,7 +760,7 @@
 /* the following are used by loadparm for option lists */
 typedef enum {
P_BOOL,P_BOOLREV,P_CHAR,P_INTEGER,P_OCTAL,P_LIST,
-   P_STRING,P_USTRING,P_ENUM,P_SEP
+   P_STRING,P_USTRING,P_GSTRING,P_UGSTRING,P_ENUM,P_SEP
 } parm_type;
 
 typedef enum {

Modified: trunk/source/param/loadparm.c
===
--- trunk/source/param/loadparm.c   2006-03-12 19:56:10 UTC (rev 14252)
+++ trunk/source/param/loadparm.c   2006-03-12 21:28:11 UTC (rev 14253)
@@ -1022,7 +1022,7 @@
{max open files, P_INTEGER, P_GLOBAL, Globals.max_open_files, NULL, 
NULL, FLAG_ADVANCED}, 
{min print space, P_INTEGER, P_LOCAL, sDefault.iMinPrintSpace, NULL, 
NULL, FLAG_ADVANCED | FLAG_PRINT}, 
 
-   {socket options, P_STRING, P_GLOBAL, user_socket_options, NULL, NULL, 
FLAG_ADVANCED}, 
+   {socket options, P_GSTRING, P_GLOBAL, user_socket_options, NULL, 
NULL, FLAG_ADVANCED}, 
{strict allocate, P_BOOL, P_LOCAL, sDefault.bStrictAllocate, NULL, 
NULL, FLAG_ADVANCED | FLAG_SHARE}, 
{strict sync, P_BOOL, P_LOCAL, sDefault.bStrictSync, NULL, NULL, 
FLAG_ADVANCED | FLAG_SHARE}, 
{sync always, P_BOOL, P_LOCAL, sDefault.bSyncAlways, NULL, NULL, 
FLAG_ADVANCED | FLAG_SHARE}, 
@@ -2722,8 +2722,8 @@
BOOL hadFlag;
const char *section_names[] = { local, global, NULL};
const char *type[] = { P_BOOL, P_BOOLREV, P_CHAR, P_INTEGER,
-   P_OCTAL, P_LIST, P_STRING, P_USTRING,
-   P_ENUM, P_SEP};
+   P_OCTAL, P_LIST, P_STRING, P_USTRING, P_GSTRING,
+   P_UGSTRING, P_ENUM, P_SEP};
unsigned flags[] = { FLAG_BASIC, FLAG_SHARE, FLAG_PRINT, FLAG_GLOBAL,
FLAG_WIZARD, FLAG_ADVANCED, FLAG_DEVELOPER, FLAG_DEPRECATED,
FLAG_HIDE, FLAG_DOS_STRING};
@@ -3518,6 +3518,15 @@
strupper_m(*(char **)parm_ptr);
break;
 
+   case P_GSTRING:
+   pstrcpy((char *)parm_ptr, pszParmValue);
+   break;
+
+   case P_UGSTRING:
+   pstrcpy((char *)parm_ptr, pszParmValue);
+   strupper_m((char *)parm_ptr);
+   break;
+
case P_ENUM:
lp_set_enum_parm( parm_table[parmnum], pszParmValue, 
(int*)parm_ptr );
break;
@@ -3596,6 +3605,13 @@
}
break;
 
+   case P_GSTRING:
+   case P_UGSTRING:
+   if ((char *)ptr) {
+   fprintf(f, %s, (char *)ptr);
+   }
+   break;
+
case P_STRING:
case P_USTRING:
if (*(char **)ptr) {
@@ -3629,6 +3645,16 @@
case P_LIST:
return str_list_compare(*(char ***)ptr1, *(char 
***)ptr2);
 
+   case P_GSTRING:
+   case P_UGSTRING:
+   {
+   char *p1 = (char *)ptr1, *p2 = (char *)ptr2;
+   if (p1  !*p1)
+   p1 = NULL;
+   if (p2  !*p2)
+   p2 = NULL;
+   return (p1 == p2 || strequal(p1, p2));
+   }
case P_STRING:
case P_USTRING:
{
@@ -3722,6 +3748,10 @@
case P_USTRING:
return strequal(parm_table[i].def.svalue,
*(char **)parm_table[i].ptr);
+   case P_GSTRING:
+   case P_UGSTRING:
+   return strequal(parm_table[i].def.svalue,
+   (char *)parm_table[i].ptr);
case P_BOOL:
case P_BOOLREV:
return parm_table[i].def.bvalue ==
@@ -4084,6 +4114,14 @@
parm_table[i].def.svalue = NULL;
}
break;
+   case P_GSTRING:
+   case P_UGSTRING:
+   if (parm_table[i].ptr) {
+   parm_table[i].def.svalue = 
SMB_STRDUP((char *)parm_table[i].ptr);
+  

svn commit: samba r14254 - in trunk/source: include passdb

2006-03-12 Thread idra
Author: idra
Date: 2006-03-12 21:40:53 + (Sun, 12 Mar 2006)
New Revision: 14254

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14254

Log:
Some more pdb_ldap talloc-ification

Simo.


Modified:
   trunk/source/include/smbldap.h
   trunk/source/passdb/pdb_ldap.c
   trunk/source/passdb/pdb_nds.c


Changeset:
Sorry, the patch is too large (958 lines) to include; please use WebSVN to see 
it!
WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14254


svn commit: samba r14255 - in branches/SAMBA_3_0/source: include param web

2006-03-12 Thread jpeach
Author: jpeach
Date: 2006-03-12 22:27:01 + (Sun, 12 Mar 2006)
New Revision: 14255

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14255

Log:
Revert r14204 which was horribly broken.

Modified:
   branches/SAMBA_3_0/source/include/smb.h
   branches/SAMBA_3_0/source/param/loadparm.c
   branches/SAMBA_3_0/source/web/swat.c


Changeset:
Modified: branches/SAMBA_3_0/source/include/smb.h
===
--- branches/SAMBA_3_0/source/include/smb.h 2006-03-12 21:40:53 UTC (rev 
14254)
+++ branches/SAMBA_3_0/source/include/smb.h 2006-03-12 22:27:01 UTC (rev 
14255)
@@ -758,7 +758,7 @@
 /* the following are used by loadparm for option lists */
 typedef enum {
P_BOOL,P_BOOLREV,P_CHAR,P_INTEGER,P_OCTAL,P_LIST,
-   P_STRING,P_USTRING,P_ENUM,P_SEP
+   P_STRING,P_USTRING,P_GSTRING,P_UGSTRING,P_ENUM,P_SEP
 } parm_type;
 
 typedef enum {

Modified: branches/SAMBA_3_0/source/param/loadparm.c
===
--- branches/SAMBA_3_0/source/param/loadparm.c  2006-03-12 21:40:53 UTC (rev 
14254)
+++ branches/SAMBA_3_0/source/param/loadparm.c  2006-03-12 22:27:01 UTC (rev 
14255)
@@ -1022,7 +1022,7 @@
{max open files, P_INTEGER, P_GLOBAL, Globals.max_open_files, NULL, 
NULL, FLAG_ADVANCED}, 
{min print space, P_INTEGER, P_LOCAL, sDefault.iMinPrintSpace, NULL, 
NULL, FLAG_ADVANCED | FLAG_PRINT}, 
 
-   {socket options, P_STRING, P_GLOBAL, user_socket_options, NULL, NULL, 
FLAG_ADVANCED}, 
+   {socket options, P_GSTRING, P_GLOBAL, user_socket_options, NULL, 
NULL, FLAG_ADVANCED}, 
{strict allocate, P_BOOL, P_LOCAL, sDefault.bStrictAllocate, NULL, 
NULL, FLAG_ADVANCED | FLAG_SHARE}, 
{strict sync, P_BOOL, P_LOCAL, sDefault.bStrictSync, NULL, NULL, 
FLAG_ADVANCED | FLAG_SHARE}, 
{sync always, P_BOOL, P_LOCAL, sDefault.bSyncAlways, NULL, NULL, 
FLAG_ADVANCED | FLAG_SHARE}, 
@@ -2722,8 +2722,8 @@
BOOL hadFlag;
const char *section_names[] = { local, global, NULL};
const char *type[] = { P_BOOL, P_BOOLREV, P_CHAR, P_INTEGER,
-   P_OCTAL, P_LIST, P_STRING, P_USTRING,
-   P_ENUM, P_SEP};
+   P_OCTAL, P_LIST, P_STRING, P_USTRING, P_GSTRING,
+   P_UGSTRING, P_ENUM, P_SEP};
unsigned flags[] = { FLAG_BASIC, FLAG_SHARE, FLAG_PRINT, FLAG_GLOBAL,
FLAG_WIZARD, FLAG_ADVANCED, FLAG_DEVELOPER, FLAG_DEPRECATED,
FLAG_HIDE, FLAG_DOS_STRING};
@@ -3518,6 +3518,15 @@
strupper_m(*(char **)parm_ptr);
break;
 
+   case P_GSTRING:
+   pstrcpy((char *)parm_ptr, pszParmValue);
+   break;
+
+   case P_UGSTRING:
+   pstrcpy((char *)parm_ptr, pszParmValue);
+   strupper_m((char *)parm_ptr);
+   break;
+
case P_ENUM:
lp_set_enum_parm( parm_table[parmnum], pszParmValue, 
(int*)parm_ptr );
break;
@@ -3596,6 +3605,13 @@
}
break;
 
+   case P_GSTRING:
+   case P_UGSTRING:
+   if ((char *)ptr) {
+   fprintf(f, %s, (char *)ptr);
+   }
+   break;
+
case P_STRING:
case P_USTRING:
if (*(char **)ptr) {
@@ -3629,6 +3645,16 @@
case P_LIST:
return str_list_compare(*(char ***)ptr1, *(char 
***)ptr2);
 
+   case P_GSTRING:
+   case P_UGSTRING:
+   {
+   char *p1 = (char *)ptr1, *p2 = (char *)ptr2;
+   if (p1  !*p1)
+   p1 = NULL;
+   if (p2  !*p2)
+   p2 = NULL;
+   return (p1 == p2 || strequal(p1, p2));
+   }
case P_STRING:
case P_USTRING:
{
@@ -3722,6 +3748,10 @@
case P_USTRING:
return strequal(parm_table[i].def.svalue,
*(char **)parm_table[i].ptr);
+   case P_GSTRING:
+   case P_UGSTRING:
+   return strequal(parm_table[i].def.svalue,
+   (char *)parm_table[i].ptr);
case P_BOOL:
case P_BOOLREV:
return parm_table[i].def.bvalue ==
@@ -4084,6 +4114,14 @@
parm_table[i].def.svalue = NULL;
}
break;
+   case P_GSTRING:
+   case P_UGSTRING:
+   if (parm_table[i].ptr) {
+   

Re: svn commit: samba r14253 - in trunk/source: include param web

2006-03-12 Thread James Peach
On Sun, 2006-03-12 at 21:28 +, [EMAIL PROTECTED] wrote:
 Author: idra
 Date: 2006-03-12 21:28:11 + (Sun, 12 Mar 2006)
 New Revision: 14253
 
 WebSVN: 
 http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14253
 
 Log:
 
 fix trunk !
 revert jpeach's patch 

Sorry about that. That'll teach me to make a checkin before being away
from email :)

I'll pull this from branches/SAMBA_3_0

-- 
James Peach | [EMAIL PROTECTED]



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

2006-03-12 Thread idra
Author: idra
Date: 2006-03-12 23:09:31 + (Sun, 12 Mar 2006)
New Revision: 14257

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14257

Log:

commit some fixes to the previous patch as Volker pointed out some flaws.


Modified:
   trunk/source/passdb/pdb_ldap.c


Changeset:
Modified: trunk/source/passdb/pdb_ldap.c
===
--- trunk/source/passdb/pdb_ldap.c  2006-03-12 22:48:25 UTC (rev 14256)
+++ trunk/source/passdb/pdb_ldap.c  2006-03-12 23:09:31 UTC (rev 14257)
@@ -1365,35 +1365,46 @@
int count;
const char ** attr_list;
int rc;
+   TALLOC_CTX *mem_ctx;
+
+   mem_ctx = talloc_new(user);
+   if (mem_ctx == NULL) {
+   DEBUG(0,(ldapsam_setsampwent: Out of memory!\n));
+   return NT_STATUS_NO_MEMORY;
+   }

-   attr_list = get_userattr_list( user, ldap_state-schema_ver );
-   append_attr(user, attr_list,
+   attr_list = get_userattr_list(mem_ctx, ldap_state-schema_ver );
+   append_attr(mem_ctx, attr_list,
get_userattr_key2string(ldap_state-schema_ver,
LDAP_ATTR_MOD_TIMESTAMP));
-   append_attr(user, attr_list, uidNumber);
-   rc = ldapsam_search_suffix_by_name(ldap_state, user, sname, result,
+   append_attr(mem_ctx, attr_list, uidNumber);
+   rc = ldapsam_search_suffix_by_name(ldap_state, mem_ctx, sname, result,
   attr_list);
-   TALLOC_FREE( attr_list );
 
-   if ( rc != LDAP_SUCCESS ) 
+   if ( rc != LDAP_SUCCESS ) {
+   talloc_free(mem_ctx);
return NT_STATUS_NO_SUCH_USER;
-   
+   }
+
count = ldap_count_entries(ldap_state-smbldap_state-ldap_struct, 
result);

if (count  1) {
DEBUG(4, (ldapsam_getsampwnam: Unable to locate user [%s] 
count=%d\n, sname, count));
+   talloc_free(mem_ctx);
ldap_msgfree(result);
return NT_STATUS_NO_SUCH_USER;
} else if (count  1) {
DEBUG(1, (ldapsam_getsampwnam: Duplicate entries for this user 
[%s] Failing. count=%d\n, sname, count));
+   talloc_free(mem_ctx);
ldap_msgfree(result);
return NT_STATUS_NO_SUCH_USER;
}
 
-   entry = ldap_first_entry(ldap_state-smbldap_state-ldap_struct, 
result);
+   entry = ldap_first_entry(priv2ld(ldap_state), result);
if (entry) {
if (!init_sam_from_ldap(ldap_state, user, entry)) {
DEBUG(1,(ldapsam_getsampwnam: init_sam_from_ldap 
failed for user '%s'!\n, sname));
+   talloc_free(mem_ctx);
ldap_msgfree(result);
return NT_STATUS_NO_SUCH_USER;
}
@@ -1404,6 +1415,8 @@
} else {
ldap_msgfree(result);
}
+
+   talloc_free(mem_ctx);
return ret;
 }
 
@@ -1753,6 +1766,7 @@
attr_list = get_userattr_list(mem_ctx, ldap_state-schema_ver);
rc = ldapsam_search_suffix_by_name(ldap_state, mem_ctx, 
pdb_get_username(newpwd), result, attr_list );
if (rc != LDAP_SUCCESS) {
+   talloc_free(mem_ctx);
return NT_STATUS_UNSUCCESSFUL;
}
pdb_set_backend_private_data(newpwd, result, NULL,
@@ -1890,35 +1904,34 @@
const char *dn = NULL;
char *filter;
 
+   if (!username || !*username) {
+   DEBUG(0, (ldapsam_add_sam_account: Cannot add user without a 
username!\n));
+   return NT_STATUS_INVALID_PARAMETER;
+   }
+
mem_ctx = talloc_new(newpwd);
if (mem_ctx == NULL) {
DEBUG(0, (talloc_new failed\n));
return NT_STATUS_NO_MEMORY;
}
 
-   if (!username || !*username) {
-   DEBUG(0, (ldapsam_add_sam_account: Cannot add user without a 
username!\n));
-   return NT_STATUS_INVALID_PARAMETER;
-   }
-
/* free this list after the second search or in case we exit on failure 
*/
attr_list = get_userattr_list(mem_ctx, ldap_state-schema_ver);
 
rc = ldapsam_search_suffix_by_name (ldap_state, mem_ctx, username, 
result, attr_list);
-
if (rc != LDAP_SUCCESS) {
talloc_free(mem_ctx);
return NT_STATUS_UNSUCCESSFUL;
}
 
+   talloc_autofree_ldapmsg(mem_ctx, result);
+
if (ldap_count_entries(priv2ld(ldap_state), result) != 0) {
DEBUG(0,(ldapsam_add_sam_account: User '%s' already in the 
base, with samba attributes\n, 
 username));
-   ldap_msgfree(result);
talloc_free(mem_ctx);
return NT_STATUS_UNSUCCESSFUL;
}
-   ldap_msgfree(result);
result = NULL;
 
if 

Re: svn commit: samba r14173 - (fnum and smb_file change)

2006-03-12 Thread Stefan (metze) Metzmacher
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

[EMAIL PROTECTED] schrieb:
 I'd much rather go back to the old structures, although it might be OK
 to change uint16_t fnum to smb_handle fnum, and make smb_handle be
 a union of uint16 and a smb2_handle. I'm not certain that is a good
 idea though, as the structures for the smb and smb2 calls are
 distinct, so having a common file handle doesn't really seem to buy us
 anything? Instead the ntvfs_generic layer could have a mapping
 function between smb2_handle and uint16_t.

Hi Tridge,

are you ok with r14256?

the idea with this is that I'll later add struct ntvfs_handle *ntvfs to
smb_handle, so that the ntvfs subsystem doesn't need to know about fnum
or smb2_handle.

and as the handle allocation will be moved out of the modules to the
main ntvfs context (this is needed for allowing multiple to allocate
handles in the same id space).

modules will call

struct ntvfs_handle *ntvfs_handle_new(struct ntvfs_context *ctx);

and the smb_server/smb/ smb_server/smb2/ code will act a bit like
the current req_fnum() and will search the struct ntvfs_handle in the
pool using the protocol specific key and then pass the ntvfs_handle
to the backends.

This makes it also easy possible to let multiple modules to hang private
data on a file handle...

metze
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEFKo9m70gjA5TCD8RAuAVAKDIS4qrAblBU+v/HTmlt2Ns8bef7QCeKj8n
MautpL2A7V9JZxZuiAG1g1U=
=lRn3
-END PGP SIGNATURE-



Re: svn commit: samba r14257 - in trunk/source/passdb: .

2006-03-12 Thread Jeremy Allison
On Sun, Mar 12, 2006 at 11:09:32PM +, [EMAIL PROTECTED] wrote:
 Author: idra
 Date: 2006-03-12 23:09:31 + (Sun, 12 Mar 2006)
 New Revision: 14257
 
 WebSVN: 
 http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14257
 
 Log:
 
 commit some fixes to the previous patch as Volker pointed out some flaws.

Still has problems. *Never* use talloc_free, always use TALLOC_FREE.
If you're using talloc_free you need to be re-examining your
patch.

Jeremy.


Build status as of Mon Mar 13 00:00:02 2006

2006-03-12 Thread build
URL: http://build.samba.org/

--- /home/build/master/cache/broken_results.txt.old 2006-03-12 
00:00:23.0 +
+++ /home/build/master/cache/broken_results.txt 2006-03-13 00:00:04.0 
+
@@ -1,17 +1,17 @@
-Build status as of Sun Mar 12 00:00:02 2006
+Build status as of Mon Mar 13 00:00:02 2006
 
 Build counts:
 Tree Total  Broken Panic 
-ccache   11 2  0 
-distcc   12 3  0 
-lorikeet-heimdal 31 31 0 
+ccache   9  2  0 
+distcc   10 3  0 
+lorikeet-heimdal 29 29 0 
 ppp  15 0  0 
-rsync32 2  0 
+rsync31 2  0 
 samba2  0  0 
 samba-docs   0  0  0 
-samba4   33 22 2 
-samba_3_033 7  0 
-smb-build24 5  0 
-talloc   32 15 0 
-tdb  32 3  0 
+samba4   31 25 2 
+samba_3_032 6  0 
+smb-build23 4  0 
+talloc   30 14 0 
+tdb  8  3  0 
 


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

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 00:00:46 + (Mon, 13 Mar 2006)
New Revision: 14258

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14258

Log:
This file is very out-of-sync with 3.0. Steve, looks
like the SAMBA_3_0 branch is more current. Please
keep these up to date.
Jeremy.

Modified:
   trunk/source/client/mount.cifs.c


Changeset:
Modified: trunk/source/client/mount.cifs.c
===
--- trunk/source/client/mount.cifs.c2006-03-12 23:09:31 UTC (rev 14257)
+++ trunk/source/client/mount.cifs.c2006-03-13 00:00:46 UTC (rev 14258)
@@ -756,7 +756,7 @@
 
if(length  3) {
/* BB add code to find DFS root here */
-   printf(\nMounting the DFS root for domain not implemented 
yet);
+   printf(\nMounting the DFS root for domain not implemented 
yet\n);
return NULL;
} else {
if(strncmp(unc_name,//,2)  strncmp(unc_name,,2)) {
@@ -863,7 +863,7 @@
char * share_name = NULL;
char * ipaddr = NULL;
char * uuid = NULL;
-   char * mountpoint;
+   char * mountpoint = NULL;
char * options;
char * resolved_path;
char * temp;
@@ -887,7 +887,11 @@
 
if(argc  argv) {
thisprogram = argv[0];
+   } else {
+   mount_cifs_usage();
+   exit(1);
}
+
if(thisprogram == NULL)
thisprogram = mount.cifs;
 
@@ -897,10 +901,11 @@
 /* #ifdef _GNU_SOURCE
printf( node: %s machine: %s sysname %s domain %s\n, 
sysinfo.nodename,sysinfo.machine,sysinfo.sysname,sysinfo.domainname);
 #endif */
+   if(argc  2) {
+   share_name = argv[1];
+   mountpoint = argv[2];
+   }
 
-   share_name = argv[1];
-   mountpoint = argv[2];
-
/* add sharename in opts string as unc= parm */
 
while ((c = getopt_long (argc, argv, afFhilL:no:O:rsSU:vVwt:,
@@ -1028,8 +1033,10 @@
}
}
 
-   if(argc  3)
+   if((argc  3) || (share_name == NULL) || (mountpoint == NULL)) {
mount_cifs_usage();
+   exit(1);
+   }
 
if (getenv(PASSWD)) {
if(mountpassword == NULL)
@@ -1110,6 +1117,8 @@
optlen += strlen(share_name) + 4;
else {
printf(No server share name specified\n);
+   printf(\nMounting the DFS root for server not implemented 
yet\n);
+exit(1);
}
if(user_name)
optlen += strlen(user_name) + 6;



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

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 00:05:47 + (Mon, 13 Mar 2006)
New Revision: 14259

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14259

Log:
Fix coverity #42. Ensure contact_domain can't be null derefed
in error code path.
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-03-13 00:00:46 UTC 
(rev 14258)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_pam.c   2006-03-13 00:05:47 UTC 
(rev 14259)
@@ -1583,7 +1583,8 @@
 
parse_domain_user(state-request.data.chauthtok.user, domain, user);
 
-   if (!(contact_domain = find_domain_from_name(domain))) {
+   contact_domain = find_domain_from_name(domain);
+   if (!contact_domain) {
DEBUG(3, (Cannot change password for [%s] - [%s]\\[%s] as %s 
is not a trusted domain\n, 
  state-request.data.chauthtok.user, domain, user, 
domain)); 
result = NT_STATUS_NO_SUCH_USER;
@@ -1650,7 +1651,7 @@
}
}   
 
-   if (!NT_STATUS_IS_OK(result)  !got_info) {
+   if (!NT_STATUS_IS_OK(result)  !got_info  contact_domain) {
 
NTSTATUS policy_ret;

@@ -1680,10 +1681,11 @@
   state-response.data.auth.nt_status_string,
   state-response.data.auth.pam_error)); 
 
-   if (NT_STATUS_IS_OK(result))
+   if (NT_STATUS_IS_OK(result)) {
request_ok(state);
-   else
+   } else {
request_error(state);
+   }
 }
 
 void winbindd_pam_logoff(struct winbindd_cli_state *state)



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

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 00:05:52 + (Mon, 13 Mar 2006)
New Revision: 14260

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14260

Log:
Fix coverity #42. Ensure contact_domain can't be null derefed
in error code path.
Jeremy.

Modified:
   trunk/source/nsswitch/winbindd_pam.c


Changeset:
Modified: trunk/source/nsswitch/winbindd_pam.c
===
--- trunk/source/nsswitch/winbindd_pam.c2006-03-13 00:05:47 UTC (rev 
14259)
+++ trunk/source/nsswitch/winbindd_pam.c2006-03-13 00:05:52 UTC (rev 
14260)
@@ -1583,7 +1583,8 @@
 
parse_domain_user(state-request.data.chauthtok.user, domain, user);
 
-   if (!(contact_domain = find_domain_from_name(domain))) {
+   contact_domain = find_domain_from_name(domain);
+   if (!contact_domain) {
DEBUG(3, (Cannot change password for [%s] - [%s]\\[%s] as %s 
is not a trusted domain\n, 
  state-request.data.chauthtok.user, domain, user, 
domain)); 
result = NT_STATUS_NO_SUCH_USER;
@@ -1650,7 +1651,7 @@
}
}   
 
-   if (!NT_STATUS_IS_OK(result)  !got_info) {
+   if (!NT_STATUS_IS_OK(result)  !got_info  contact_domain) {
 
NTSTATUS policy_ret;

@@ -1680,10 +1681,11 @@
   state-response.data.auth.nt_status_string,
   state-response.data.auth.pam_error)); 
 
-   if (NT_STATUS_IS_OK(result))
+   if (NT_STATUS_IS_OK(result)) {
request_ok(state);
-   else
+   } else {
request_error(state);
+   }
 }
 
 void winbindd_pam_logoff(struct winbindd_cli_state *state)



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

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 00:08:39 + (Mon, 13 Mar 2006)
New Revision: 14261

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14261

Log:
Fix coverity #38. No 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-03-13 00:05:52 UTC 
(rev 14260)
+++ branches/SAMBA_3_0/source/libmsrpc/cac_winreg.c 2006-03-13 00:08:39 UTC 
(rev 14261)
@@ -960,6 +960,12 @@
   hnd-_internal.pipes[PI_SHUTDOWN] = True;
}
 
+   pipe_hnd = cac_GetPipe(hnd, PI_SHUTDOWN);
+   if(!pipe_hnd) {
+  hnd-status = NT_STATUS_INVALID_HANDLE;
+  return CAC_FAILURE;
+   }
+
msg = (op-in.message != NULL) ? op-in.message : talloc_strdup(mem_ctx, 
);
 
hnd-status = NT_STATUS_OK;



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

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 00:08:44 + (Mon, 13 Mar 2006)
New Revision: 14262

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14262

Log:
Fix coverity #38. No 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-03-13 00:08:39 UTC (rev 14261)
+++ trunk/source/libmsrpc/cac_winreg.c  2006-03-13 00:08:44 UTC (rev 14262)
@@ -960,6 +960,12 @@
   hnd-_internal.pipes[PI_SHUTDOWN] = True;
}
 
+   pipe_hnd = cac_GetPipe(hnd, PI_SHUTDOWN);
+   if(!pipe_hnd) {
+  hnd-status = NT_STATUS_INVALID_HANDLE;
+  return CAC_FAILURE;
+   }
+
msg = (op-in.message != NULL) ? op-in.message : talloc_strdup(mem_ctx, 
);
 
hnd-status = NT_STATUS_OK;



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

2006-03-12 Thread idra
Author: idra
Date: 2006-03-13 00:10:40 + (Mon, 13 Mar 2006)
New Revision: 14263

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14263

Log:

We should simply not talloc_free(0 here at all as now the memory context is
not managed by this function.
Remove also unneeded check as the funtion always return the same value.

Simo.


Modified:
   trunk/source/passdb/pdb_ldap.c


Changeset:
Modified: trunk/source/passdb/pdb_ldap.c
===
--- trunk/source/passdb/pdb_ldap.c  2006-03-13 00:08:44 UTC (rev 14262)
+++ trunk/source/passdb/pdb_ldap.c  2006-03-13 00:10:40 UTC (rev 14263)
@@ -1438,10 +1438,7 @@
LDAP_ATTR_MOD_TIMESTAMP));
append_attr(mem_ctx, attr_list, uidNumber);
rc = ldapsam_search_suffix_by_sid(ldap_state, mem_ctx, 
sid, result, attr_list);
-   talloc_free(mem_ctx);
 
-   if (rc != LDAP_SUCCESS) 
-   return rc;
break;
}

@@ -1453,10 +1450,7 @@
attr_list = get_userattr_list(NULL,
  ldap_state-schema_ver);
rc = ldapsam_search_suffix_by_rid(ldap_state, mem_ctx, 
rid, result, attr_list);
-   talloc_free(mem_ctx);
 
-   if (rc != LDAP_SUCCESS) 
-   return rc;
break;
}
return rc;



Re: svn commit: samba r14257 - in trunk/source/passdb: .

2006-03-12 Thread simo
On Sun, 2006-03-12 at 15:48 -0800, Jeremy Allison wrote:
 On Sun, Mar 12, 2006 at 11:09:32PM +, [EMAIL PROTECTED] wrote:
  Author: idra
  Date: 2006-03-12 23:09:31 + (Sun, 12 Mar 2006)
  New Revision: 14257
  
  WebSVN: 
  http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14257
  
  Log:
  
  commit some fixes to the previous patch as Volker pointed out some flaws.
 
 Still has problems. *Never* use talloc_free, always use TALLOC_FREE.
 If you're using talloc_free you need to be re-examining your
 patch.

no, the use of talloc_free() is ok because we are always sure the
context passed is not null and valid.

Only function misused talloc_free() and turned out that function should
not call any free at all as it does not own the memory context.
(thanks, your comment made me notice that while checking my statements
are indeed correct :)

Simo.

-- 
Simo Sorce
Samba Team GPL Compliance Officer
email: [EMAIL PROTECTED]
http://samba.org



Re: svn commit: samba r14257 - in trunk/source/passdb: .

2006-03-12 Thread Jeremy Allison
On Sun, Mar 12, 2006 at 07:12:03PM -0500, simo wrote:
 On Sun, 2006-03-12 at 15:48 -0800, Jeremy Allison wrote:
  On Sun, Mar 12, 2006 at 11:09:32PM +, [EMAIL PROTECTED] wrote:
   Author: idra
   Date: 2006-03-12 23:09:31 + (Sun, 12 Mar 2006)
   New Revision: 14257
   
   WebSVN: 
   http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14257
   
   Log:
   
   commit some fixes to the previous patch as Volker pointed out some flaws.
  
  Still has problems. *Never* use talloc_free, always use TALLOC_FREE.
  If you're using talloc_free you need to be re-examining your
  patch.
 
 no, the use of talloc_free() is ok because we are always sure the
 context passed is not null and valid.

It's a habit thing. If you *always* use TALLOC_FREE you'll have
less bugs than if you think you can get away with talloc_free
as 'it doesn't matter this time'. I just fixed an unbelievably
subtle bug where someone used a _free call instead of a _FREE
style call. No one visually inspecting the code would have (or
did) see it. Coverity found it.

I know it doesn't matter in this case, but using TALLOC_FREE
instead here doesn't hurt either, and so it's safe to just
always use TALLOC_FREE.

If I do a grep on the source and see talloc_free, instead
of TALLOC_FREE, I want it to be an exceptional case *only*
with a comment explaining why that was used.

Jeremy.


Re: svn commit: samba r14257 - in trunk/source/passdb: .

2006-03-12 Thread simo
On Sun, 2006-03-12 at 16:18 -0800, Jeremy Allison wrote:
 On Sun, Mar 12, 2006 at 07:12:03PM -0500, simo wrote:
  On Sun, 2006-03-12 at 15:48 -0800, Jeremy Allison wrote:
   On Sun, Mar 12, 2006 at 11:09:32PM +, [EMAIL PROTECTED] wrote:
Author: idra
Date: 2006-03-12 23:09:31 + (Sun, 12 Mar 2006)
New Revision: 14257

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14257

Log:

commit some fixes to the previous patch as Volker pointed out some 
flaws.
   
   Still has problems. *Never* use talloc_free, always use TALLOC_FREE.
   If you're using talloc_free you need to be re-examining your
   patch.
  
  no, the use of talloc_free() is ok because we are always sure the
  context passed is not null and valid.
 
 It's a habit thing. If you *always* use TALLOC_FREE you'll have
 less bugs than if you think you can get away with talloc_free
 as 'it doesn't matter this time'. I just fixed an unbelievably
 subtle bug where someone used a _free call instead of a _FREE
 style call. No one visually inspecting the code would have (or
 did) see it. Coverity found it.

Yes, I'm following the streams of patches. Do you know what I thought
when I saw it?
That would not have happened if we had a talloc hierarchy.

 I know it doesn't matter in this case, but using TALLOC_FREE
 instead here doesn't hurt either, and so it's safe to just
 always use TALLOC_FREE.

See my argumentation on another mail/

 If I do a grep on the source and see talloc_free, instead
 of TALLOC_FREE, I want it to be an exceptional case *only*
 with a comment explaining why that was used.

But I see you feel strongly (reading another reply while answering) ..
in that case why not just make talloc_free check for context not being
null itself instead of adding a really ugly (visually because of all
caps) macro ? :-)

Simo.

-- 
Simo Sorce
Samba Team GPL Compliance Officer
email: [EMAIL PROTECTED]
http://samba.org



svn commit: samba r14264 - in branches/SAMBA_3_0/source/rpc_server: .

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 00:23:17 + (Mon, 13 Mar 2006)
New Revision: 14264

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14264

Log:
Fix coverity #207. Resource leak on error path.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
===
--- branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c   2006-03-13 
00:10:40 UTC (rev 14263)
+++ branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c   2006-03-13 
00:23:17 UTC (rev 14264)
@@ -6900,6 +6900,7 @@
  architecture, version);
if (!W_ERROR_IS_OK(status)) {
SAFE_FREE(list);
+   SAFE_FREE(driver_info_3);
return status;
}
fill_printer_driver_info_3(driver_info_3[*returned+i], 
driver, servername);



svn commit: samba r14265 - in trunk/source/rpc_server: .

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 00:23:22 + (Mon, 13 Mar 2006)
New Revision: 14265

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14265

Log:
Fix coverity #207. Resource leak on error path.
Jeremy.

Modified:
   trunk/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: trunk/source/rpc_server/srv_spoolss_nt.c
===
--- trunk/source/rpc_server/srv_spoolss_nt.c2006-03-13 00:23:17 UTC (rev 
14264)
+++ trunk/source/rpc_server/srv_spoolss_nt.c2006-03-13 00:23:22 UTC (rev 
14265)
@@ -6900,6 +6900,7 @@
  architecture, version);
if (!W_ERROR_IS_OK(status)) {
SAFE_FREE(list);
+   SAFE_FREE(driver_info_3);
return status;
}
fill_printer_driver_info_3(driver_info_3[*returned+i], 
driver, servername);



svn commit: samba r14266 - in branches/SAMBA_3_0/source/rpc_server: .

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 00:25:04 + (Mon, 13 Mar 2006)
New Revision: 14266

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14266

Log:
Fix coverity #205. Resource leak on error path.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
===
--- branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c   2006-03-13 
00:23:22 UTC (rev 14265)
+++ branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c   2006-03-13 
00:25:04 UTC (rev 14266)
@@ -6818,6 +6818,7 @@
  architecture, version);
if (!W_ERROR_IS_OK(status)) {
SAFE_FREE(list);
+   SAFE_FREE(driver_info_2);
return status;
}
fill_printer_driver_info_2(driver_info_2[*returned+i], 
driver, servername);



svn commit: samba r14267 - in trunk/source/rpc_server: .

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 00:25:10 + (Mon, 13 Mar 2006)
New Revision: 14267

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14267

Log:
Fix coverity #205. Resource leak on error path.
Jeremy.

Modified:
   trunk/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: trunk/source/rpc_server/srv_spoolss_nt.c
===
--- trunk/source/rpc_server/srv_spoolss_nt.c2006-03-13 00:25:04 UTC (rev 
14266)
+++ trunk/source/rpc_server/srv_spoolss_nt.c2006-03-13 00:25:10 UTC (rev 
14267)
@@ -6818,6 +6818,7 @@
  architecture, version);
if (!W_ERROR_IS_OK(status)) {
SAFE_FREE(list);
+   SAFE_FREE(driver_info_2);
return status;
}
fill_printer_driver_info_2(driver_info_2[*returned+i], 
driver, servername);



svn commit: samba r14268 - in branches/SAMBA_3_0/source/rpc_server: .

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 00:26:38 + (Mon, 13 Mar 2006)
New Revision: 14268

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14268

Log:
Fix coverity error #204. Resource leak on error path.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
===
--- branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c   2006-03-13 
00:25:10 UTC (rev 14267)
+++ branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c   2006-03-13 
00:26:38 UTC (rev 14268)
@@ -6736,6 +6736,7 @@
  architecture, version);
if (!W_ERROR_IS_OK(status)) {
SAFE_FREE(list);
+   SAFE_FREE(driver_info_1);
return status;
}
fill_printer_driver_info_1(driver_info_1[*returned+i], 
driver, servername, architecture ); 



svn commit: samba r14269 - in trunk/source/rpc_server: .

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 00:26:42 + (Mon, 13 Mar 2006)
New Revision: 14269

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14269

Log:
Fix coverity error #204. Resource leak on error path.
Jeremy.

Modified:
   trunk/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: trunk/source/rpc_server/srv_spoolss_nt.c
===
--- trunk/source/rpc_server/srv_spoolss_nt.c2006-03-13 00:26:38 UTC (rev 
14268)
+++ trunk/source/rpc_server/srv_spoolss_nt.c2006-03-13 00:26:42 UTC (rev 
14269)
@@ -6736,6 +6736,7 @@
  architecture, version);
if (!W_ERROR_IS_OK(status)) {
SAFE_FREE(list);
+   SAFE_FREE(driver_info_1);
return status;
}
fill_printer_driver_info_1(driver_info_1[*returned+i], 
driver, servername, architecture ); 



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

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 00:30:18 + (Mon, 13 Mar 2006)
New Revision: 14270

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14270

Log:
Fix coverity #203. Ensure we free on error exit.
Jeremy.

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


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_group.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd_group.c 2006-03-13 00:26:42 UTC 
(rev 14269)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_group.c 2006-03-13 00:30:18 UTC 
(rev 14270)
@@ -827,8 +827,6 @@
   [group_list_ndx * sizeof(struct winbindd_gr)], 
   gr_mem_list, gr_mem_list_len);
 
-   SAFE_FREE(gr_mem_list);
-
state-response.length += gr_mem_list_len;
 
DEBUG(10, (returning %d groups, length = %d\n,
@@ -838,6 +836,8 @@
 
  done:
 
+   SAFE_FREE(gr_mem_list);
+
if (group_list_ndx  0)
request_ok(state);
else



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

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 00:30:23 + (Mon, 13 Mar 2006)
New Revision: 14271

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14271

Log:
Fix coverity #203. Ensure we free on error exit.
Jeremy.

Modified:
   trunk/source/nsswitch/winbindd_group.c


Changeset:
Modified: trunk/source/nsswitch/winbindd_group.c
===
--- trunk/source/nsswitch/winbindd_group.c  2006-03-13 00:30:18 UTC (rev 
14270)
+++ trunk/source/nsswitch/winbindd_group.c  2006-03-13 00:30:23 UTC (rev 
14271)
@@ -827,8 +827,6 @@
   [group_list_ndx * sizeof(struct winbindd_gr)], 
   gr_mem_list, gr_mem_list_len);
 
-   SAFE_FREE(gr_mem_list);
-
state-response.length += gr_mem_list_len;
 
DEBUG(10, (returning %d groups, length = %d\n,
@@ -838,6 +836,8 @@
 
  done:
 
+   SAFE_FREE(gr_mem_list);
+
if (group_list_ndx  0)
request_ok(state);
else



Re: svn commit: samba r14257 - in trunk/source/passdb: .

2006-03-12 Thread Jeremy Allison
On Sun, Mar 12, 2006 at 07:22:18PM -0500, simo wrote:
 
 Yes, I'm following the streams of patches. Do you know what I thought
 when I saw it?
 That would not have happened if we had a talloc hierarchy.

A talloc hierarchy hung off random pointers is a poor man's C++ (IMHO).
It can be horribly misued. I'm wary of them at the moment.

 But I see you feel strongly (reading another reply while answering) ..
 in that case why not just make talloc_free check for context not being
 null itself instead of adding a really ugly (visually because of all
 caps) macro ? :-)

Consistency with the Samba4 talloc. It's the Samba3 style here, I'd
like to keep it consistent.

Jeremy.


svn commit: samba r14272 - branches/SAMBA_3_0/source/utils trunk/source/utils

2006-03-12 Thread jmcd
Author: jmcd
Date: 2006-03-13 00:35:33 + (Mon, 13 Mar 2006)
New Revision: 14272

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14272

Log:
Fix Coverity # 81: free alloc'ed storage before returning

Modified:
   branches/SAMBA_3_0/source/utils/smbcacls.c
   trunk/source/utils/smbcacls.c


Changeset:
Modified: branches/SAMBA_3_0/source/utils/smbcacls.c
===
--- branches/SAMBA_3_0/source/utils/smbcacls.c  2006-03-13 00:30:23 UTC (rev 
14271)
+++ branches/SAMBA_3_0/source/utils/smbcacls.c  2006-03-13 00:35:33 UTC (rev 
14272)
@@ -378,7 +378,7 @@
 {
const char *p = str;
fstring tok;
-   SEC_DESC *ret;
+   SEC_DESC *ret = NULL;
size_t sd_size;
DOM_SID *grp_sid=NULL, *owner_sid=NULL;
SEC_ACL *dacl=NULL;
@@ -396,7 +396,7 @@
if (!owner_sid ||
!StringToSid(owner_sid, tok+6)) {
printf(Failed to parse owner sid\n);
-   return NULL;
+   goto done;
}
continue;
}
@@ -406,7 +406,7 @@
if (!grp_sid ||
!StringToSid(grp_sid, tok+6)) {
printf(Failed to parse group sid\n);
-   return NULL;
+   goto done;
}
continue;
}
@@ -414,22 +414,23 @@
if (strncmp(tok,ACL:, 4) == 0) {
SEC_ACE ace;
if (!parse_ace(ace, tok+4)) {
-   return NULL;
+   goto done;
}
if(!add_ace(dacl, ace)) {
printf(Failed to add ACL %s\n, tok);
-   return NULL;
+   goto done;
}
continue;
}
 
printf(Failed to parse token '%s' in security descriptor,\n, 
tok);
-   return NULL;
+   goto done;
}
 
ret = make_sec_desc(ctx,revision, SEC_DESC_SELF_RELATIVE, owner_sid, 
grp_sid, 
NULL, dacl, sd_size);
 
+  done:
SAFE_FREE(grp_sid);
SAFE_FREE(owner_sid);
 

Modified: trunk/source/utils/smbcacls.c
===
--- trunk/source/utils/smbcacls.c   2006-03-13 00:30:23 UTC (rev 14271)
+++ trunk/source/utils/smbcacls.c   2006-03-13 00:35:33 UTC (rev 14272)
@@ -378,7 +378,7 @@
 {
const char *p = str;
fstring tok;
-   SEC_DESC *ret;
+   SEC_DESC *ret = NULL;
size_t sd_size;
DOM_SID *grp_sid=NULL, *owner_sid=NULL;
SEC_ACL *dacl=NULL;
@@ -396,7 +396,7 @@
if (!owner_sid ||
!StringToSid(owner_sid, tok+6)) {
printf(Failed to parse owner sid\n);
-   return NULL;
+   goto done;
}
continue;
}
@@ -406,7 +406,7 @@
if (!grp_sid ||
!StringToSid(grp_sid, tok+6)) {
printf(Failed to parse group sid\n);
-   return NULL;
+   goto done;
}
continue;
}
@@ -414,22 +414,23 @@
if (strncmp(tok,ACL:, 4) == 0) {
SEC_ACE ace;
if (!parse_ace(ace, tok+4)) {
-   return NULL;
+   goto done;
}
if(!add_ace(dacl, ace)) {
printf(Failed to add ACL %s\n, tok);
-   return NULL;
+   goto done;
}
continue;
}
 
printf(Failed to parse token '%s' in security descriptor,\n, 
tok);
-   return NULL;
+   goto done;
}
 
ret = make_sec_desc(ctx,revision, SEC_DESC_SELF_RELATIVE, owner_sid, 
grp_sid, 
NULL, dacl, sd_size);
 
+  done:
SAFE_FREE(grp_sid);
SAFE_FREE(owner_sid);
 



Re: svn commit: samba r14257 - in trunk/source/passdb: .

2006-03-12 Thread simo
On Sun, 2006-03-12 at 16:32 -0800, Jeremy Allison wrote:
 On Sun, Mar 12, 2006 at 07:22:18PM -0500, simo wrote:
  
  Yes, I'm following the streams of patches. Do you know what I thought
  when I saw it?
  That would not have happened if we had a talloc hierarchy.
 
 A talloc hierarchy hung off random pointers is a poor man's C++ (IMHO).
 It can be horribly misued. I'm wary of them at the moment.
 
  But I see you feel strongly (reading another reply while answering) ..
  in that case why not just make talloc_free check for context not being
  null itself instead of adding a really ugly (visually because of all
  caps) macro ? :-)
 
 Consistency with the Samba4 talloc. It's the Samba3 style here, I'd
 like to keep it consistent.

No TALLOC_FREE() actually adds something good, it makes the pointer NULL
after it is freed. This is very important in a code base like that of
samba3 which have not grown up with talloc as a programming paradigm, I
have not realized that before reading the last mails.

So for samba3 I think you are right, and TALLOC_FREE() does really make
sense to be used.

I'll commit a fix for that in the next hours, gotta go now.

Simo.

-- 
Simo Sorce
Samba Team GPL Compliance Officer
email: [EMAIL PROTECTED]
http://samba.org



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

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 00:37:57 + (Mon, 13 Mar 2006)
New Revision: 14273

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14273

Log:
Fix coverity bug #202. Memory leak on error path.
Jeremy.

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


Changeset:
Modified: branches/SAMBA_3_0/source/printing/nt_printing.c
===
--- branches/SAMBA_3_0/source/printing/nt_printing.c2006-03-13 00:35:33 UTC 
(rev 14272)
+++ branches/SAMBA_3_0/source/printing/nt_printing.c2006-03-13 00:37:57 UTC 
(rev 14273)
@@ -2804,8 +2804,10 @@

/* return error if the key was not found */

-   if ( i == data-num_keys )
+   if ( i == data-num_keys ) {
+   SAFE_FREE(subkeys_ptr);
return -1;
+   }

 done:
/* tag off the end */



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

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 00:38:03 + (Mon, 13 Mar 2006)
New Revision: 14274

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14274

Log:
Fix coverity bug #202. Memory leak on error path.
Jeremy.

Modified:
   trunk/source/printing/nt_printing.c


Changeset:
Modified: trunk/source/printing/nt_printing.c
===
--- trunk/source/printing/nt_printing.c 2006-03-13 00:37:57 UTC (rev 14273)
+++ trunk/source/printing/nt_printing.c 2006-03-13 00:38:03 UTC (rev 14274)
@@ -2804,8 +2804,10 @@

/* return error if the key was not found */

-   if ( i == data-num_keys )
+   if ( i == data-num_keys ) {
+   SAFE_FREE(subkeys_ptr);
return -1;
+   }

 done:
/* tag off the end */



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

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 01:08:27 + (Mon, 13 Mar 2006)
New Revision: 14275

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14275

Log:
Shut-up coverity false positive (bug #199) by making an assertion
explicit.
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-03-13 00:38:03 UTC 
(rev 14274)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_pam.c   2006-03-13 01:08:27 UTC 
(rev 14275)
@@ -1137,6 +1137,13 @@

DOM_SID user_sid;
 
+   /* In all codepaths were result == NT_STATUS_OK info3 must have
+  been initialized. */
+   if (!info3) {
+   result = NT_STATUS_INTERNAL_ERROR;
+   goto done;
+   }
+
netsamlogon_cache_store(name_user, info3);
wcache_invalidate_samlogon(find_domain_from_name(name_domain), 
info3);
 



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

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 01:08:34 + (Mon, 13 Mar 2006)
New Revision: 14276

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14276

Log:
Shut-up coverity false positive (bug #199) by making an assertion
explicit.
Jeremy.

Modified:
   trunk/source/nsswitch/winbindd_pam.c


Changeset:
Modified: trunk/source/nsswitch/winbindd_pam.c
===
--- trunk/source/nsswitch/winbindd_pam.c2006-03-13 01:08:27 UTC (rev 
14275)
+++ trunk/source/nsswitch/winbindd_pam.c2006-03-13 01:08:34 UTC (rev 
14276)
@@ -1137,6 +1137,13 @@

DOM_SID user_sid;
 
+   /* In all codepaths were result == NT_STATUS_OK info3 must have
+  been initialized. */
+   if (!info3) {
+   result = NT_STATUS_INTERNAL_ERROR;
+   goto done;
+   }
+
netsamlogon_cache_store(name_user, info3);
wcache_invalidate_samlogon(find_domain_from_name(name_domain), 
info3);
 



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

2006-03-12 Thread idra
Author: idra
Date: 2006-03-13 01:32:30 + (Mon, 13 Mar 2006)
New Revision: 14277

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14277

Log:

talloc_free() - TALLOC_FREE()


Modified:
   trunk/source/passdb/pdb_ldap.c


Changeset:
Modified: trunk/source/passdb/pdb_ldap.c
===
--- trunk/source/passdb/pdb_ldap.c  2006-03-13 01:08:34 UTC (rev 14276)
+++ trunk/source/passdb/pdb_ldap.c  2006-03-13 01:32:30 UTC (rev 14277)
@@ -1279,7 +1279,7 @@
DEBUG(0,(ldapsam_setsampwent: LDAP search failed: %s\n, 
ldap_err2string(rc)));
DEBUG(3,(ldapsam_setsampwent: Query was: %s, %s\n, suffix, 
filter));
ldap_state-result = NULL;
-   talloc_free(mem_ctx);
+   TALLOC_FREE(mem_ctx);
return NT_STATUS_UNSUCCESSFUL;
}
 
@@ -1289,7 +1289,7 @@
ldap_state-entry = ldap_first_entry(priv2ld(ldap_state), 
ldap_state-result);
ldap_state-index = 0;
 
-   talloc_free(mem_ctx);
+   TALLOC_FREE(mem_ctx);
return NT_STATUS_OK;
 }
 
@@ -1382,7 +1382,7 @@
   attr_list);
 
if ( rc != LDAP_SUCCESS ) {
-   talloc_free(mem_ctx);
+   TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_SUCH_USER;
}
 
@@ -1390,12 +1390,12 @@

if (count  1) {
DEBUG(4, (ldapsam_getsampwnam: Unable to locate user [%s] 
count=%d\n, sname, count));
-   talloc_free(mem_ctx);
+   TALLOC_FREE(mem_ctx);
ldap_msgfree(result);
return NT_STATUS_NO_SUCH_USER;
} else if (count  1) {
DEBUG(1, (ldapsam_getsampwnam: Duplicate entries for this user 
[%s] Failing. count=%d\n, sname, count));
-   talloc_free(mem_ctx);
+   TALLOC_FREE(mem_ctx);
ldap_msgfree(result);
return NT_STATUS_NO_SUCH_USER;
}
@@ -1404,7 +1404,7 @@
if (entry) {
if (!init_sam_from_ldap(ldap_state, user, entry)) {
DEBUG(1,(ldapsam_getsampwnam: init_sam_from_ldap 
failed for user '%s'!\n, sname));
-   talloc_free(mem_ctx);
+   TALLOC_FREE(mem_ctx);
ldap_msgfree(result);
return NT_STATUS_NO_SUCH_USER;
}
@@ -1416,7 +1416,7 @@
ldap_msgfree(result);
}
 
-   talloc_free(mem_ctx);
+   TALLOC_FREE(mem_ctx);
return ret;
 }
 
@@ -1478,7 +1478,7 @@
 
rc = ldapsam_get_ldap_user_by_sid(ldap_state, mem_ctx, sid, result); 
if (rc != LDAP_SUCCESS) {
-   talloc_free(mem_ctx);
+   TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_SUCH_USER;
}
 
@@ -1488,27 +1488,27 @@
DEBUG(4, (ldapsam_getsampwsid: Unable to locate SID [%s] 
count=%d\n, sid_to_string(sid_string, sid),
   count));
ldap_msgfree(result);
-   talloc_free(mem_ctx);
+   TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_SUCH_USER;
}  else if (count  1) {
DEBUG(1, (ldapsam_getsampwsid: More than one user with SID 
[%s]. Failing. count=%d\n, sid_to_string(sid_string, sid),
   count));
ldap_msgfree(result);
-   talloc_free(mem_ctx);
+   TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_SUCH_USER;
}
 
entry = ldap_first_entry(priv2ld(ldap_state), result);
if (!entry) {
ldap_msgfree(result);
-   talloc_free(mem_ctx);
+   TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_SUCH_USER;
}
 
if (!init_sam_from_ldap(ldap_state, user, entry)) {
DEBUG(1,(ldapsam_getsampwsid: init_sam_from_ldap failed!\n));
ldap_msgfree(result);
-   talloc_free(mem_ctx);
+   TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_SUCH_USER;
}
 
@@ -1516,7 +1516,7 @@
 my_methods, PDB_CHANGED);
talloc_autofree_ldapmsg(user, result);
 
-   talloc_free(mem_ctx);
+   TALLOC_FREE(mem_ctx);
return NT_STATUS_OK;
 }  
 
@@ -1760,7 +1760,7 @@
attr_list = get_userattr_list(mem_ctx, ldap_state-schema_ver);
rc = ldapsam_search_suffix_by_name(ldap_state, mem_ctx, 
pdb_get_username(newpwd), result, attr_list );
if (rc != LDAP_SUCCESS) {
-   talloc_free(mem_ctx);
+   TALLOC_FREE(mem_ctx);
return NT_STATUS_UNSUCCESSFUL;
}
pdb_set_backend_private_data(newpwd, result, NULL,
@@ -1770,14 +1770,14 @@
 
if (ldap_count_entries(ldap_state-smbldap_state-ldap_struct, result) 

svn commit: samba r14278 - branches/SAMBA_3_0/source/utils trunk/source/utils

2006-03-12 Thread jmcd
Author: jmcd
Date: 2006-03-13 01:32:30 + (Mon, 13 Mar 2006)
New Revision: 14278

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14278

Log:
Remainder of fix for Coverity #79,80,81: only allow GROUP or OWNER to be
specified once in an ACL, so it can be allocated a second time,
overwriting the first


Modified:
   branches/SAMBA_3_0/source/utils/smbcacls.c
   trunk/source/utils/smbcacls.c


Changeset:
Modified: branches/SAMBA_3_0/source/utils/smbcacls.c
===
--- branches/SAMBA_3_0/source/utils/smbcacls.c  2006-03-13 01:32:30 UTC (rev 
14277)
+++ branches/SAMBA_3_0/source/utils/smbcacls.c  2006-03-13 01:32:30 UTC (rev 
14278)
@@ -392,6 +392,10 @@
}
 
if (strncmp(tok,OWNER:, 6) == 0) {
+   if (owner_sid) {
+   printf(Only specify owner once\n);
+   goto done;
+   }
owner_sid = SMB_CALLOC_ARRAY(DOM_SID, 1);
if (!owner_sid ||
!StringToSid(owner_sid, tok+6)) {
@@ -402,6 +406,10 @@
}
 
if (strncmp(tok,GROUP:, 6) == 0) {
+   if (grp_sid) {
+   printf(Only specify group once\n);
+   goto done;
+   }
grp_sid = SMB_CALLOC_ARRAY(DOM_SID, 1);
if (!grp_sid ||
!StringToSid(grp_sid, tok+6)) {

Modified: trunk/source/utils/smbcacls.c
===
--- trunk/source/utils/smbcacls.c   2006-03-13 01:32:30 UTC (rev 14277)
+++ trunk/source/utils/smbcacls.c   2006-03-13 01:32:30 UTC (rev 14278)
@@ -392,6 +392,10 @@
}
 
if (strncmp(tok,OWNER:, 6) == 0) {
+   if (owner_sid) {
+   printf(Only specify owner once\n);
+   goto done;
+   }
owner_sid = SMB_CALLOC_ARRAY(DOM_SID, 1);
if (!owner_sid ||
!StringToSid(owner_sid, tok+6)) {
@@ -402,6 +406,10 @@
}
 
if (strncmp(tok,GROUP:, 6) == 0) {
+   if (grp_sid) {
+   printf(Only specify group once\n);
+   goto done;
+   }
grp_sid = SMB_CALLOC_ARRAY(DOM_SID, 1);
if (!grp_sid ||
!StringToSid(grp_sid, tok+6)) {



svn commit: samba r14279 - branches/SAMBA_3_0/source/libsmb trunk/source/libsmb

2006-03-12 Thread jmcd
Author: jmcd
Date: 2006-03-13 01:42:40 + (Mon, 13 Mar 2006)
New Revision: 14279

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14279

Log:
Fix coverity #86, 87, 88, 89: 
Free grp_sid and owner_sid before returning.  Also, only allow one group
or owner.

Modified:
   branches/SAMBA_3_0/source/libsmb/libsmbclient.c
   trunk/source/libsmb/libsmbclient.c


Changeset:
Modified: branches/SAMBA_3_0/source/libsmb/libsmbclient.c
===
--- branches/SAMBA_3_0/source/libsmb/libsmbclient.c 2006-03-13 01:32:30 UTC 
(rev 14278)
+++ branches/SAMBA_3_0/source/libsmb/libsmbclient.c 2006-03-13 01:42:40 UTC 
(rev 14279)
@@ -3922,7 +3922,7 @@
 {
const char *p = str;
fstring tok;
-   SEC_DESC *ret;
+   SEC_DESC *ret = NULL;
size_t sd_size;
DOM_SID *grp_sid=NULL;
 DOM_SID *owner_sid=NULL;
@@ -3937,49 +3937,65 @@
}
 
if (StrnCaseCmp(tok,OWNER:, 6) == 0) {
+   if (owner_sid) {
+   DEBUG(5, (OWNER specified more than once!\n));
+   goto done;
+   }
owner_sid = SMB_CALLOC_ARRAY(DOM_SID, 1);
if (!owner_sid ||
!convert_string_to_sid(ipc_cli, pol,
numeric,
owner_sid, tok+6)) {
DEBUG(5, (Failed to parse owner sid\n));
-   return NULL;
+   goto done;
}
continue;
}
 
if (StrnCaseCmp(tok,OWNER+:, 7) == 0) {
+   if (owner_sid) {
+   DEBUG(5, (OWNER specified more than once!\n));
+   goto done;
+   }
owner_sid = SMB_CALLOC_ARRAY(DOM_SID, 1);
if (!owner_sid ||
!convert_string_to_sid(ipc_cli, pol,
False,
owner_sid, tok+7)) {
DEBUG(5, (Failed to parse owner sid\n));
-   return NULL;
+   goto done;
}
continue;
}
 
if (StrnCaseCmp(tok,GROUP:, 6) == 0) {
+   if (grp_sid) {
+   DEBUG(5, (GROUP specified more than once!\n));
+   goto done;
+   }
grp_sid = SMB_CALLOC_ARRAY(DOM_SID, 1);
if (!grp_sid ||
!convert_string_to_sid(ipc_cli, pol,
numeric,
grp_sid, tok+6)) {
DEBUG(5, (Failed to parse group sid\n));
-   return NULL;
+   goto done;
}
continue;
}
 
if (StrnCaseCmp(tok,GROUP+:, 7) == 0) {
+   if (grp_sid) {
+   DEBUG(5, (GROUP specified more than once!\n));
+   goto done;
+   }
grp_sid = SMB_CALLOC_ARRAY(DOM_SID, 1);
if (!grp_sid ||
!convert_string_to_sid(ipc_cli, pol,
False,
grp_sid, tok+6)) {
DEBUG(5, (Failed to parse group sid\n));
-   return NULL;
+   goto done;
}
continue;
}
@@ -3988,11 +4004,11 @@
SEC_ACE ace;
if (!parse_ace(ipc_cli, pol, ace, numeric, tok+4)) {
DEBUG(5, (Failed to parse ACL %s\n, tok));
-   return NULL;
+   goto done;
}
if(!add_ace(dacl, ace, ctx)) {
DEBUG(5, (Failed to add ACL %s\n, tok));
-   return NULL;
+   goto done;
}
continue;
}
@@ -4001,22 +4017,23 @@
SEC_ACE ace;
if (!parse_ace(ipc_cli, pol, ace, False, tok+5)) {
DEBUG(5, (Failed to parse ACL %s\n, tok));
-   return NULL;
+ 

svn commit: samba r14280 - branches/SAMBA_3_0/source/lib trunk/source/lib

2006-03-12 Thread jmcd
Author: jmcd
Date: 2006-03-13 01:49:01 + (Mon, 13 Mar 2006)
New Revision: 14280

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14280

Log:
Fix Coverity #129 and 130: check before dereferencing a pointer.  This
was especially silly as we checked immediately _after_ dereferencing it
:-/

Modified:
   branches/SAMBA_3_0/source/lib/secdesc.c
   trunk/source/lib/secdesc.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/secdesc.c
===
--- branches/SAMBA_3_0/source/lib/secdesc.c 2006-03-13 01:42:40 UTC (rev 
14279)
+++ branches/SAMBA_3_0/source/lib/secdesc.c 2006-03-13 01:49:01 UTC (rev 
14280)
@@ -336,11 +336,11 @@
SEC_ACE  *ace  = 0;
NTSTATUS  status;
 
-   *sd_size = 0;
-
if (!ctx || !psd || !sid || !sd_size)
return NT_STATUS_INVALID_PARAMETER;
 
+   *sd_size = 0;
+
status = sec_ace_add_sid(ctx, ace, psd[0]-dacl-ace, 
psd[0]-dacl-num_aces, sid, mask);

if (!NT_STATUS_IS_OK(status))
@@ -388,11 +388,11 @@
SEC_ACE  *ace  = 0;
NTSTATUS  status;
 
-   *sd_size = 0;
-   
if (!ctx || !psd[0] || !sid || !sd_size)
return NT_STATUS_INVALID_PARAMETER;
 
+   *sd_size = 0;
+   
status = sec_ace_del_sid(ctx, ace, psd[0]-dacl-ace, 
psd[0]-dacl-num_aces, sid);
 
if (!NT_STATUS_IS_OK(status))

Modified: trunk/source/lib/secdesc.c
===
--- trunk/source/lib/secdesc.c  2006-03-13 01:42:40 UTC (rev 14279)
+++ trunk/source/lib/secdesc.c  2006-03-13 01:49:01 UTC (rev 14280)
@@ -336,11 +336,11 @@
SEC_ACE  *ace  = 0;
NTSTATUS  status;
 
-   *sd_size = 0;
-
if (!ctx || !psd || !sid || !sd_size)
return NT_STATUS_INVALID_PARAMETER;
 
+   *sd_size = 0;
+
status = sec_ace_add_sid(ctx, ace, psd[0]-dacl-ace, 
psd[0]-dacl-num_aces, sid, mask);

if (!NT_STATUS_IS_OK(status))
@@ -388,11 +388,11 @@
SEC_ACE  *ace  = 0;
NTSTATUS  status;
 
-   *sd_size = 0;
-   
if (!ctx || !psd[0] || !sid || !sd_size)
return NT_STATUS_INVALID_PARAMETER;
 
+   *sd_size = 0;
+   
status = sec_ace_del_sid(ctx, ace, psd[0]-dacl-ace, 
psd[0]-dacl-num_aces, sid);
 
if (!NT_STATUS_IS_OK(status))



svn commit: samba r14281 - in branches/SAMBA_4_0/source: . build/m4 build/smb_build heimdal/lib/asn1 intl lib/util script

2006-03-12 Thread jelmer
Author: jelmer
Date: 2006-03-13 02:05:39 + (Mon, 13 Mar 2006)
New Revision: 14281

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14281

Log:
Pull apart LIBDIR and MODULESDIR
Move architecture-independent data to DATADIR (was LIBDIR)

Modified:
   branches/SAMBA_4_0/source/build/m4/check_path.m4
   branches/SAMBA_4_0/source/build/smb_build/makefile.pm
   branches/SAMBA_4_0/source/build/smb_build/summary.pm
   branches/SAMBA_4_0/source/dynconfig.c
   branches/SAMBA_4_0/source/dynconfig.h
   branches/SAMBA_4_0/source/heimdal/lib/asn1/parse.c
   branches/SAMBA_4_0/source/heimdal/lib/asn1/parse.h
   branches/SAMBA_4_0/source/intl/lang_tdb.c
   branches/SAMBA_4_0/source/lib/util/util.c
   branches/SAMBA_4_0/source/lib/util/util_unistr.c
   branches/SAMBA_4_0/source/main.mk
   branches/SAMBA_4_0/source/script/installswat.sh


Changeset:
Sorry, the patch is too large (897 lines) to include; please use WebSVN to see 
it!
WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14281


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

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 03:50:26 + (Mon, 13 Mar 2006)
New Revision: 14282

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14282

Log:
Change centry_string to only use talloc. Should
quieten coverity bug #194 (which I think is a
false positive).
Jeremy.

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


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c 2006-03-13 02:05:39 UTC 
(rev 14281)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c 2006-03-13 03:50:26 UTC 
(rev 14282)
@@ -257,10 +257,7 @@
smb_panic(centry_string);
}
 
-   if (mem_ctx != NULL)
-   ret = TALLOC(mem_ctx, len+1);
-   else
-   ret = SMB_MALLOC(len+1);
+   ret = TALLOC(mem_ctx, len+1);
if (!ret) {
smb_panic(centry_string out of memory\n);
}
@@ -273,14 +270,13 @@
 /* pull a string from a cache entry, using the supplied
talloc context 
 */
-static BOOL centry_sid(struct cache_entry *centry, DOM_SID *sid)
+static BOOL centry_sid(struct cache_entry *centry, TALLOC_CTX *mem_ctx, 
DOM_SID *sid)
 {
char *sid_string;
-   sid_string = centry_string(centry, NULL);
+   sid_string = centry_string(centry, mem_ctx);
if (!string_to_sid(sid, sid_string)) {
return False;
}
-   SAFE_FREE(sid_string);
return True;
 }
 
@@ -912,8 +908,8 @@
(*info)[i].full_name = centry_string(centry, mem_ctx);
(*info)[i].homedir = centry_string(centry, mem_ctx);
(*info)[i].shell = centry_string(centry, mem_ctx);
-   centry_sid(centry, (*info)[i].user_sid);
-   centry_sid(centry, (*info)[i].group_sid);
+   centry_sid(centry, mem_ctx, (*info)[i].user_sid);
+   centry_sid(centry, mem_ctx, (*info)[i].group_sid);
}
 
 do_cached: 
@@ -1176,7 +1172,7 @@
*type = (enum SID_NAME_USE)centry_uint32(centry);
status = centry-status;
if (NT_STATUS_IS_OK(status)) {
-   centry_sid(centry, sid);
+   centry_sid(centry, mem_ctx, sid);
}
 
DEBUG(10,(name_to_sid: [Cached] - cached name for domain %s status 
%s\n,
@@ -1315,8 +1311,8 @@
info-full_name = centry_string(centry, mem_ctx);
info-homedir = centry_string(centry, mem_ctx);
info-shell = centry_string(centry, mem_ctx);
-   centry_sid(centry, info-user_sid);
-   centry_sid(centry, info-group_sid);
+   centry_sid(centry, mem_ctx, info-user_sid);
+   centry_sid(centry, mem_ctx, info-group_sid);
status = centry-status;
 
DEBUG(10,(query_user: [Cached] - cached info for domain %s status 
%s\n,
@@ -1387,7 +1383,7 @@
if (! (*user_gids))
smb_panic(lookup_usergroups out of memory);
for (i=0; i(*num_groups); i++) {
-   centry_sid(centry, (*user_gids)[i]);
+   centry_sid(centry, mem_ctx, (*user_gids)[i]);
}
 
 do_cached: 
@@ -1549,7 +1545,7 @@
}
 
for (i=0; i(*num_names); i++) {
-   centry_sid(centry, (*sid_mem)[i]);
+   centry_sid(centry, mem_ctx, (*sid_mem)[i]);
(*names)[i] = centry_string(centry, mem_ctx);
(*name_types)[i] = centry_uint32(centry);
}
@@ -1645,7 +1641,7 @@
for (i=0; i(*num_domains); i++) {
(*names)[i] = centry_string(centry, mem_ctx);
(*alt_names)[i] = centry_string(centry, mem_ctx);
-   centry_sid(centry, (*dom_sids)[i]);
+   centry_sid(centry, mem_ctx, (*dom_sids)[i]);
}
 
status = centry-status;
@@ -2045,7 +2041,7 @@
 
if (NT_STATUS_IS_OK(centry-status)) {
*type = (enum SID_NAME_USE)centry_uint32(centry);
-   centry_sid(centry, sid);
+   centry_sid(centry, mem_ctx, sid);
}
 
status = centry-status;



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

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 03:50:28 + (Mon, 13 Mar 2006)
New Revision: 14283

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14283

Log:
Change centry_string to only use talloc. Should
quieten coverity bug #194 (which I think is a
false positive).
Jeremy.

Modified:
   trunk/source/nsswitch/winbindd_cache.c


Changeset:
Modified: trunk/source/nsswitch/winbindd_cache.c
===
--- trunk/source/nsswitch/winbindd_cache.c  2006-03-13 03:50:26 UTC (rev 
14282)
+++ trunk/source/nsswitch/winbindd_cache.c  2006-03-13 03:50:28 UTC (rev 
14283)
@@ -257,10 +257,7 @@
smb_panic(centry_string);
}
 
-   if (mem_ctx != NULL)
-   ret = TALLOC(mem_ctx, len+1);
-   else
-   ret = SMB_MALLOC(len+1);
+   ret = TALLOC(mem_ctx, len+1);
if (!ret) {
smb_panic(centry_string out of memory\n);
}
@@ -273,14 +270,13 @@
 /* pull a string from a cache entry, using the supplied
talloc context 
 */
-static BOOL centry_sid(struct cache_entry *centry, DOM_SID *sid)
+static BOOL centry_sid(struct cache_entry *centry, TALLOC_CTX *mem_ctx, 
DOM_SID *sid)
 {
char *sid_string;
-   sid_string = centry_string(centry, NULL);
+   sid_string = centry_string(centry, mem_ctx);
if (!string_to_sid(sid, sid_string)) {
return False;
}
-   SAFE_FREE(sid_string);
return True;
 }
 
@@ -912,8 +908,8 @@
(*info)[i].full_name = centry_string(centry, mem_ctx);
(*info)[i].homedir = centry_string(centry, mem_ctx);
(*info)[i].shell = centry_string(centry, mem_ctx);
-   centry_sid(centry, (*info)[i].user_sid);
-   centry_sid(centry, (*info)[i].group_sid);
+   centry_sid(centry, mem_ctx, (*info)[i].user_sid);
+   centry_sid(centry, mem_ctx, (*info)[i].group_sid);
}
 
 do_cached: 
@@ -1176,7 +1172,7 @@
*type = (enum SID_NAME_USE)centry_uint32(centry);
status = centry-status;
if (NT_STATUS_IS_OK(status)) {
-   centry_sid(centry, sid);
+   centry_sid(centry, mem_ctx, sid);
}
 
DEBUG(10,(name_to_sid: [Cached] - cached name for domain %s status 
%s\n,
@@ -1315,8 +1311,8 @@
info-full_name = centry_string(centry, mem_ctx);
info-homedir = centry_string(centry, mem_ctx);
info-shell = centry_string(centry, mem_ctx);
-   centry_sid(centry, info-user_sid);
-   centry_sid(centry, info-group_sid);
+   centry_sid(centry, mem_ctx, info-user_sid);
+   centry_sid(centry, mem_ctx, info-group_sid);
status = centry-status;
 
DEBUG(10,(query_user: [Cached] - cached info for domain %s status 
%s\n,
@@ -1387,7 +1383,7 @@
if (! (*user_gids))
smb_panic(lookup_usergroups out of memory);
for (i=0; i(*num_groups); i++) {
-   centry_sid(centry, (*user_gids)[i]);
+   centry_sid(centry, mem_ctx, (*user_gids)[i]);
}
 
 do_cached: 
@@ -1549,7 +1545,7 @@
}
 
for (i=0; i(*num_names); i++) {
-   centry_sid(centry, (*sid_mem)[i]);
+   centry_sid(centry, mem_ctx, (*sid_mem)[i]);
(*names)[i] = centry_string(centry, mem_ctx);
(*name_types)[i] = centry_uint32(centry);
}
@@ -1645,7 +1641,7 @@
for (i=0; i(*num_domains); i++) {
(*names)[i] = centry_string(centry, mem_ctx);
(*alt_names)[i] = centry_string(centry, mem_ctx);
-   centry_sid(centry, (*dom_sids)[i]);
+   centry_sid(centry, mem_ctx, (*dom_sids)[i]);
}
 
status = centry-status;
@@ -2045,7 +2041,7 @@
 
if (NT_STATUS_IS_OK(centry-status)) {
*type = (enum SID_NAME_USE)centry_uint32(centry);
-   centry_sid(centry, sid);
+   centry_sid(centry, mem_ctx, sid);
}
 
status = centry-status;



svn commit: samba r14285 - in trunk/source/rpc_server: .

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 03:56:29 + (Mon, 13 Mar 2006)
New Revision: 14285

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14285

Log:
Fix coverity bug #103. Make code clearer - probably
not a real issue but this code is easier to read.
Jeremy.

Modified:
   trunk/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: trunk/source/rpc_server/srv_spoolss_nt.c
===
--- trunk/source/rpc_server/srv_spoolss_nt.c2006-03-13 03:56:24 UTC (rev 
14284)
+++ trunk/source/rpc_server/srv_spoolss_nt.c2006-03-13 03:56:29 UTC (rev 
14285)
@@ -7241,6 +7241,8 @@
int ret;
int fd;
 
+   *count = 0;
+   *lines = NULL;
 
/* if no hook then just fill in the default port */

@@ -7259,9 +7261,9 @@
ret = smbrun(command, fd);
DEBUG(10,(Returned [%d]\n, ret));
if (ret != 0) {
-   if (fd != -1)
+   if (fd != -1) {
close(fd);
-   
+   }
return WERR_ACCESS_DENIED;
}
 
@@ -7289,8 +7291,11 @@
char **qlines;
int numlines;
 
-   if ( !W_ERROR_IS_OK(result = enumports_hook( numlines, qlines )) ) 
+   result = enumports_hook( numlines, qlines );
+   if (!W_ERROR_IS_OK(result)) {
+   file_lines_free(qlines);
return result;
+   }

if(numlines) {
if((ports=SMB_MALLOC_ARRAY( PORT_INFO_1, numlines )) == NULL) {
@@ -7304,9 +7309,8 @@
DEBUG(6,(Filling port number [%d] with port [%s]\n, 
i, qlines[i]));
fill_port_1(ports[i], qlines[i]);
}
-
-   file_lines_free(qlines);
}
+   file_lines_free(qlines);
 
*returned = numlines;
 



svn commit: samba r14284 - in branches/SAMBA_3_0/source/rpc_server: .

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 03:56:24 + (Mon, 13 Mar 2006)
New Revision: 14284

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14284

Log:
Fix coverity bug #103. Make code clearer - probably
not a real issue but this code is easier to read.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
===
--- branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c   2006-03-13 
03:50:28 UTC (rev 14283)
+++ branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c   2006-03-13 
03:56:24 UTC (rev 14284)
@@ -7241,6 +7241,8 @@
int ret;
int fd;
 
+   *count = 0;
+   *lines = NULL;
 
/* if no hook then just fill in the default port */

@@ -7259,9 +7261,9 @@
ret = smbrun(command, fd);
DEBUG(10,(Returned [%d]\n, ret));
if (ret != 0) {
-   if (fd != -1)
+   if (fd != -1) {
close(fd);
-   
+   }
return WERR_ACCESS_DENIED;
}
 
@@ -7289,8 +7291,11 @@
char **qlines;
int numlines;
 
-   if ( !W_ERROR_IS_OK(result = enumports_hook( numlines, qlines )) ) 
+   result = enumports_hook( numlines, qlines );
+   if (!W_ERROR_IS_OK(result)) {
+   file_lines_free(qlines);
return result;
+   }

if(numlines) {
if((ports=SMB_MALLOC_ARRAY( PORT_INFO_1, numlines )) == NULL) {
@@ -7304,9 +7309,8 @@
DEBUG(6,(Filling port number [%d] with port [%s]\n, 
i, qlines[i]));
fill_port_1(ports[i], qlines[i]);
}
-
-   file_lines_free(qlines);
}
+   file_lines_free(qlines);
 
*returned = numlines;
 



svn commit: samba r14287 - in trunk/source/rpc_server: .

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 03:59:58 + (Mon, 13 Mar 2006)
New Revision: 14287

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14287

Log:
Similar clarifiction fix for coverity #102.
Jeremy.

Modified:
   trunk/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: trunk/source/rpc_server/srv_spoolss_nt.c
===
--- trunk/source/rpc_server/srv_spoolss_nt.c2006-03-13 03:59:53 UTC (rev 
14286)
+++ trunk/source/rpc_server/srv_spoolss_nt.c2006-03-13 03:59:58 UTC (rev 
14287)
@@ -7288,8 +7288,8 @@
PORT_INFO_1 *ports=NULL;
int i=0;
WERROR result = WERR_OK;
-   char **qlines;
-   int numlines;
+   char **qlines = NULL;
+   int numlines = 0;
 
result = enumports_hook( numlines, qlines );
if (!W_ERROR_IS_OK(result)) {
@@ -7354,13 +7354,15 @@
PORT_INFO_2 *ports=NULL;
int i=0;
WERROR result = WERR_OK;
-   char **qlines;
-   int numlines;
+   char **qlines = NULL;
+   int numlines = 0;
 
-   if ( !W_ERROR_IS_OK(result = enumports_hook( numlines, qlines )) ) 
+   result = enumports_hook( numlines, qlines );
+   if ( !W_ERROR_IS_OK(result)) {
+   file_lines_free(qlines);
return result;
+   }

-   
if(numlines) {
if((ports=SMB_MALLOC_ARRAY( PORT_INFO_2, numlines)) == NULL) {
file_lines_free(qlines);
@@ -7371,10 +7373,10 @@
DEBUG(6,(Filling port number [%d] with port [%s]\n, 
i, qlines[i]));
fill_port_2((ports[i]), qlines[i]);
}
-
-   file_lines_free(qlines);
}
 
+   file_lines_free(qlines);
+
*returned = numlines;
 
/* check the required size. */



svn commit: samba r14288 - in branches/SAMBA_4_0/source/lib/talloc: .

2006-03-12 Thread tridge
Author: tridge
Date: 2006-03-13 04:04:38 + (Mon, 13 Mar 2006)
New Revision: 14288

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14288

Log:

 - make the snprintf call in talloc portable to older solaris boxes

 - fixed an error found sing the beam analyser

Modified:
   branches/SAMBA_4_0/source/lib/talloc/talloc.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/talloc/talloc.c
===
--- branches/SAMBA_4_0/source/lib/talloc/talloc.c   2006-03-13 03:59:58 UTC 
(rev 14287)
+++ branches/SAMBA_4_0/source/lib/talloc/talloc.c   2006-03-13 04:04:38 UTC 
(rev 14288)
@@ -293,7 +293,11 @@
 
for (h=tc-refs;h;h=h-next) {
struct talloc_chunk *p = talloc_parent_chunk(h);
-   if ((p==NULL  context==NULL) || TC_PTR_FROM_CHUNK(p) == 
context) break;
+   if (p == NULL) {
+   if (context == NULL) break;
+   } else if (TC_PTR_FROM_CHUNK(p) == context) {
+   break;
+   }
}
if (h == NULL) {
return -1;
@@ -1010,10 +1014,12 @@
int len;
char *ret;
va_list ap2;
+   char c;

VA_COPY(ap2, ap);
 
-   if ((len = vsnprintf(NULL, 0, fmt, ap2))  0) {
+   /* this call looks strange, but it makes it work on older solaris boxes 
*/
+   if ((len = vsnprintf(c, 1, fmt, ap2))  0) {
return NULL;
}
 



svn commit: samba r14289 - in branches/SAMBA_3_0/source/rpc_server: .

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 04:05:47 + (Mon, 13 Mar 2006)
New Revision: 14289

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14289

Log:
Fix coverity #101, resource leak on error code path.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
===
--- branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c   2006-03-13 
04:04:38 UTC (rev 14288)
+++ branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c   2006-03-13 
04:05:47 UTC (rev 14289)
@@ -7046,12 +7046,17 @@
DEBUGADD(5,(Number of user forms [%d]\n, *numofforms));
*numofforms += numbuiltinforms;
 
-   if (*numofforms == 0) 
+   if (*numofforms == 0) {
+   SAFE_FREE(builtinlist);
+   SAFE_FREE(list);
return WERR_NO_MORE_ITEMS;
+   }
 
switch (level) {
case 1:
if ((forms_1=SMB_MALLOC_ARRAY(FORM_1, *numofforms)) == NULL) {
+   SAFE_FREE(builtinlist);
+   SAFE_FREE(list);
*numofforms=0;
return WERR_NOMEM;
}
@@ -7114,7 +7119,6 @@
SAFE_FREE(builtinlist);
return WERR_UNKNOWN_LEVEL;
}
-
 }
 
 /



svn commit: samba r14290 - in trunk/source/rpc_server: .

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 04:05:51 + (Mon, 13 Mar 2006)
New Revision: 14290

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14290

Log:
Fix coverity #101, resource leak on error code path.
Jeremy.

Modified:
   trunk/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: trunk/source/rpc_server/srv_spoolss_nt.c
===
--- trunk/source/rpc_server/srv_spoolss_nt.c2006-03-13 04:05:47 UTC (rev 
14289)
+++ trunk/source/rpc_server/srv_spoolss_nt.c2006-03-13 04:05:51 UTC (rev 
14290)
@@ -7046,12 +7046,17 @@
DEBUGADD(5,(Number of user forms [%d]\n, *numofforms));
*numofforms += numbuiltinforms;
 
-   if (*numofforms == 0) 
+   if (*numofforms == 0) {
+   SAFE_FREE(builtinlist);
+   SAFE_FREE(list);
return WERR_NO_MORE_ITEMS;
+   }
 
switch (level) {
case 1:
if ((forms_1=SMB_MALLOC_ARRAY(FORM_1, *numofforms)) == NULL) {
+   SAFE_FREE(builtinlist);
+   SAFE_FREE(list);
*numofforms=0;
return WERR_NOMEM;
}
@@ -7114,7 +7119,6 @@
SAFE_FREE(builtinlist);
return WERR_UNKNOWN_LEVEL;
}
-
 }
 
 /



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

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 04:27:47 + (Mon, 13 Mar 2006)
New Revision: 14291

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14291

Log:
Janitor for tridge (samba3 talloc is almost identical
to Samba4 talloc).
Jeremy

 - make the snprintf call in talloc portable to older solaris boxes

 - fixed an error found sing the beam analyser

Modified:
   trunk/source/lib/talloc.c


Changeset:
Modified: trunk/source/lib/talloc.c
===
--- trunk/source/lib/talloc.c   2006-03-13 04:05:51 UTC (rev 14290)
+++ trunk/source/lib/talloc.c   2006-03-13 04:27:47 UTC (rev 14291)
@@ -289,7 +289,11 @@
 
for (h=tc-refs;h;h=h-next) {
struct talloc_chunk *p = talloc_parent_chunk(h);
-   if ((p==NULL  context==NULL) || TC_PTR_FROM_CHUNK(p) == 
context) break;
+   if (p == NULL) {
+   if (context == NULL) break;
+   } else if (TC_PTR_FROM_CHUNK(p) == context) {
+   break;
+   }
}
if (h == NULL) {
return -1;
@@ -1076,10 +1080,14 @@
int len;
char *ret;
va_list ap2;
+   char c;

VA_COPY(ap2, ap);
 
-   len = vsnprintf(NULL, 0, fmt, ap2);
+   /* this call looks strange, but it makes it work on older solaris boxes 
*/
+   if ((len = vsnprintf(c, 1, fmt, ap2))  0) {
+   return NULL;
+   }
 
ret = _talloc(t, len+1);
if (ret) {
@@ -1131,7 +1139,15 @@
VA_COPY(ap2, ap);
 
s_len = tc-size - 1;
-   len = vsnprintf(NULL, 0, fmt, ap2);
+   if ((len = vsnprintf(NULL, 0, fmt, ap2)) = 0) {
+   /* Either the vsnprintf failed or the format resulted in
+* no characters being formatted. In the former case, we
+* ought to return NULL, in the latter we ought to return
+* the original string. Most current callers of this 
+* function expect it to never return NULL.
+*/
+   return s;
+   }
 
s = talloc_realloc(NULL, s, char, s_len + len+1);
if (!s) return NULL;



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

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 04:27:53 + (Mon, 13 Mar 2006)
New Revision: 14292

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14292

Log:
Janitor for tridge (samba3 talloc is almost identical
to Samba4 talloc).
Jeremy

 - make the snprintf call in talloc portable to older solaris boxes

 - fixed an error found sing the beam analyser

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


Changeset:
Modified: branches/SAMBA_3_0/source/lib/talloc.c
===
--- branches/SAMBA_3_0/source/lib/talloc.c  2006-03-13 04:27:47 UTC (rev 
14291)
+++ branches/SAMBA_3_0/source/lib/talloc.c  2006-03-13 04:27:53 UTC (rev 
14292)
@@ -289,7 +289,11 @@
 
for (h=tc-refs;h;h=h-next) {
struct talloc_chunk *p = talloc_parent_chunk(h);
-   if ((p==NULL  context==NULL) || TC_PTR_FROM_CHUNK(p) == 
context) break;
+   if (p == NULL) {
+   if (context == NULL) break;
+   } else if (TC_PTR_FROM_CHUNK(p) == context) {
+   break;
+   }
}
if (h == NULL) {
return -1;
@@ -1076,10 +1080,14 @@
int len;
char *ret;
va_list ap2;
+   char c;

VA_COPY(ap2, ap);
 
-   len = vsnprintf(NULL, 0, fmt, ap2);
+   /* this call looks strange, but it makes it work on older solaris boxes 
*/
+   if ((len = vsnprintf(c, 1, fmt, ap2))  0) {
+   return NULL;
+   }
 
ret = _talloc(t, len+1);
if (ret) {
@@ -1131,7 +1139,15 @@
VA_COPY(ap2, ap);
 
s_len = tc-size - 1;
-   len = vsnprintf(NULL, 0, fmt, ap2);
+   if ((len = vsnprintf(NULL, 0, fmt, ap2)) = 0) {
+   /* Either the vsnprintf failed or the format resulted in
+* no characters being formatted. In the former case, we
+* ought to return NULL, in the latter we ought to return
+* the original string. Most current callers of this 
+* function expect it to never return NULL.
+*/
+   return s;
+   }
 
s = talloc_realloc(NULL, s, char, s_len + len+1);
if (!s) return NULL;



svn commit: samba r14293 - in branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules: .

2006-03-12 Thread tridge
Author: tridge
Date: 2006-03-13 05:00:45 + (Mon, 13 Mar 2006)
New Revision: 14293

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14293

Log:

fixed some errors found with beam

Modified:
   branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/password_hash.c


Changeset:
Modified: branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/password_hash.c
===
--- branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/password_hash.c
2006-03-13 04:27:53 UTC (rev 14292)
+++ branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/password_hash.c
2006-03-13 05:00:45 UTC (rev 14293)
@@ -496,6 +496,9 @@
continue;
}
ASN1_MALLOC_ENCODE(Key, buf, buf_size, keys[i], len, 
krb5_ret);
+   if (krb5_ret) {
+   return LDB_ERR_OPERATIONS_ERROR;
+   }

val.data = talloc_memdup(req, buf, len);
val.length = len;
@@ -549,6 +552,9 @@
return LDB_ERR_OPERATIONS_ERROR;
}
ASN1_MALLOC_ENCODE(Key, buf, buf_size, key, len, krb5_ret);
+   if (krb5_ret) {
+   return LDB_ERR_OPERATIONS_ERROR;
+   }
krb5_free_keyblock_contents(smb_krb5_context-krb5_context,
key.key);




svn commit: samba r14294 - in branches/SAMBA_4_0/source/include: .

2006-03-12 Thread tridge
Author: tridge
Date: 2006-03-13 05:01:34 + (Mon, 13 Mar 2006)
New Revision: 14294

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14294

Log:

conditionally define _PUBLIC_, so you can disable it easily with -D_PUBLIC_=


Modified:
   branches/SAMBA_4_0/source/include/includes.h


Changeset:
Modified: branches/SAMBA_4_0/source/include/includes.h
===
--- branches/SAMBA_4_0/source/include/includes.h2006-03-13 05:00:45 UTC 
(rev 14293)
+++ branches/SAMBA_4_0/source/include/includes.h2006-03-13 05:01:34 UTC 
(rev 14294)
@@ -36,11 +36,13 @@
 /** Feel free to add definitions for other compilers here. */
 #endif
 
+#ifndef _PUBLIC_
 #ifdef HAVE_VISIBILITY_ATTR
 #  define _PUBLIC_ __attribute__((visibility(default)))
 #else
 #  define _PUBLIC_
 #endif
+#endif
 
 #ifndef PRINTF_ATTRIBUTE
 #if !defined(NO_PRINTF_ATTRIBUTE)  (__GNUC__ = 3)



svn commit: samba r14295 - in branches/SAMBA_4_0/source/lib/registry: .

2006-03-12 Thread tridge
Author: tridge
Date: 2006-03-13 05:01:58 + (Mon, 13 Mar 2006)
New Revision: 14295

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14295

Log:

make sure we return a valid data blob

Modified:
   branches/SAMBA_4_0/source/lib/registry/reg_backend_nt4.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/registry/reg_backend_nt4.c
===
--- branches/SAMBA_4_0/source/lib/registry/reg_backend_nt4.c2006-03-13 
05:01:34 UTC (rev 14294)
+++ branches/SAMBA_4_0/source/lib/registry/reg_backend_nt4.c2006-03-13 
05:01:58 UTC (rev 14295)
@@ -133,7 +133,7 @@
int i;
 
if (size == 0)
-   return ret;
+   return data_blob(NULL, 0);
 
size += 4; /* Need to include uint32 for the length */
 



svn commit: samba r14296 - in branches/SAMBA_4_0/source/lib/util: .

2006-03-12 Thread tridge
Author: tridge
Date: 2006-03-13 05:02:30 + (Mon, 13 Mar 2006)
New Revision: 14296

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14296

Log:

added an abort() to SMB_ASSERT() so that static analysers know it doesn't return


Modified:
   branches/SAMBA_4_0/source/lib/util/util.h


Changeset:
Modified: branches/SAMBA_4_0/source/lib/util/util.h
===
--- branches/SAMBA_4_0/source/lib/util/util.h   2006-03-13 05:01:58 UTC (rev 
14295)
+++ branches/SAMBA_4_0/source/lib/util/util.h   2006-03-13 05:02:30 UTC (rev 
14296)
@@ -67,7 +67,7 @@
  */
 #define SMB_ASSERT(b) do { if (!(b)) { \
DEBUG(0,(PANIC: assert failed at %s(%d)\n, __FILE__, __LINE__)); \
-   smb_panic(assert failed); }} while (0)
+   smb_panic(assert failed); abort(); }} while (0)
 
 /**
  * determine the lowest of two values



svn commit: samba r14297 - in branches/SAMBA_4_0/source/libcli/dgram: .

2006-03-12 Thread tridge
Author: tridge
Date: 2006-03-13 05:02:49 + (Mon, 13 Mar 2006)
New Revision: 14297

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14297

Log:

make sure we can go through the loop for than once



Modified:
   branches/SAMBA_4_0/source/libcli/dgram/mailslot.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/dgram/mailslot.c
===
--- branches/SAMBA_4_0/source/libcli/dgram/mailslot.c   2006-03-13 05:02:30 UTC 
(rev 14296)
+++ branches/SAMBA_4_0/source/libcli/dgram/mailslot.c   2006-03-13 05:02:49 UTC 
(rev 14297)
@@ -137,7 +137,9 @@
}
dgmslot = dgram_mailslot_listen(dgmsock, name, handler, 
private);
talloc_free(name);
-   return dgmslot;
+   if (dgmslot != NULL) {
+   return dgmslot;
+   }
}
DEBUG(2,(Unable to create temporary mailslot from %s\n, 
mailslot_name));
return NULL;



svn commit: samba r14298 - branches/SAMBA_3_0/source/rpc_parse trunk/source/rpc_parse

2006-03-12 Thread vlendec
Author: vlendec
Date: 2006-03-13 06:44:10 + (Mon, 13 Mar 2006)
New Revision: 14298

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14298

Log:
The other half of Coverity # 217
Modified:
   branches/SAMBA_3_0/source/rpc_parse/parse_spoolss.c
   trunk/source/rpc_parse/parse_spoolss.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_parse/parse_spoolss.c
===
--- branches/SAMBA_3_0/source/rpc_parse/parse_spoolss.c 2006-03-13 05:02:49 UTC 
(rev 14297)
+++ branches/SAMBA_3_0/source/rpc_parse/parse_spoolss.c 2006-03-13 06:44:10 UTC 
(rev 14298)
@@ -5065,7 +5065,7 @@
return False;
}
 
-   q_u-server_name_ptr = (srv_name!=NULL)?1:0;
+   q_u-server_name_ptr = 1; /* srv_name is != NULL, see above */
init_unistr2(q_u-server_name, srv_name, UNI_STR_TERMINATE);

q_u-level = level;

Modified: trunk/source/rpc_parse/parse_spoolss.c
===
--- trunk/source/rpc_parse/parse_spoolss.c  2006-03-13 05:02:49 UTC (rev 
14297)
+++ trunk/source/rpc_parse/parse_spoolss.c  2006-03-13 06:44:10 UTC (rev 
14298)
@@ -5065,7 +5065,7 @@
return False;
}
 
-   q_u-server_name_ptr = (srv_name!=NULL)?1:0;
+   q_u-server_name_ptr = 1; /* srv_name is != NULL, see above */
init_unistr2(q_u-server_name, srv_name, UNI_STR_TERMINATE);

q_u-level = level;



svn commit: samba r14299 - in branches/SAMBA_3_0/source/rpc_server: .

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 06:48:41 + (Mon, 13 Mar 2006)
New Revision: 14299

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14299

Log:
Fix coverity #225. In a loop we were forgetting to free
resources on error exit path.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
===
--- branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c   2006-03-13 
06:44:10 UTC (rev 14298)
+++ branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c   2006-03-13 
06:48:41 UTC (rev 14299)
@@ -6871,8 +6871,8 @@
int ndrivers;
uint32 version;
fstring *list = NULL;
+   DRIVER_INFO_3 *driver_info_3=NULL;
NT_PRINTER_DRIVER_INFO_LEVEL driver;
-   DRIVER_INFO_3 *driver_info_3=NULL;
WERROR result = WERR_OK;
 
*returned=0;
@@ -6882,8 +6882,10 @@
ndrivers=get_ntdrivers(list, architecture, version);
DEBUGADD(4,(we have:[%d] drivers in environment [%s] and 
version [%d]\n, ndrivers, architecture, version));
 
-   if(ndrivers == -1)
+   if(ndrivers == -1) {
+   SAFE_FREE(driver_info_3);
return WERR_NOMEM;
+   }
 
if(ndrivers != 0) {
if((driver_info_3=SMB_REALLOC_ARRAY(driver_info_3, 
DRIVER_INFO_3, *returned+ndrivers )) == NULL) {
@@ -6936,8 +6938,9 @@
}
 
 out:
-   for (i=0; i*returned; i++)
+   for (i=0; i*returned; i++) {
SAFE_FREE(driver_info_3[i].dependentfiles);
+   }
 
SAFE_FREE(driver_info_3);




svn commit: samba r14300 - in trunk/source/rpc_server: .

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 06:48:48 + (Mon, 13 Mar 2006)
New Revision: 14300

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14300

Log:
Fix coverity #225. In a loop we were forgetting to free
resources on error exit path.
Jeremy.

Modified:
   trunk/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: trunk/source/rpc_server/srv_spoolss_nt.c
===
--- trunk/source/rpc_server/srv_spoolss_nt.c2006-03-13 06:48:41 UTC (rev 
14299)
+++ trunk/source/rpc_server/srv_spoolss_nt.c2006-03-13 06:48:48 UTC (rev 
14300)
@@ -6871,8 +6871,8 @@
int ndrivers;
uint32 version;
fstring *list = NULL;
+   DRIVER_INFO_3 *driver_info_3=NULL;
NT_PRINTER_DRIVER_INFO_LEVEL driver;
-   DRIVER_INFO_3 *driver_info_3=NULL;
WERROR result = WERR_OK;
 
*returned=0;
@@ -6882,8 +6882,10 @@
ndrivers=get_ntdrivers(list, architecture, version);
DEBUGADD(4,(we have:[%d] drivers in environment [%s] and 
version [%d]\n, ndrivers, architecture, version));
 
-   if(ndrivers == -1)
+   if(ndrivers == -1) {
+   SAFE_FREE(driver_info_3);
return WERR_NOMEM;
+   }
 
if(ndrivers != 0) {
if((driver_info_3=SMB_REALLOC_ARRAY(driver_info_3, 
DRIVER_INFO_3, *returned+ndrivers )) == NULL) {
@@ -6936,8 +6938,9 @@
}
 
 out:
-   for (i=0; i*returned; i++)
+   for (i=0; i*returned; i++) {
SAFE_FREE(driver_info_3[i].dependentfiles);
+   }
 
SAFE_FREE(driver_info_3);




svn commit: samba r14301 - in branches/SAMBA_3_0/source/rpc_server: .

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 06:50:33 + (Mon, 13 Mar 2006)
New Revision: 14301

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14301

Log:
Fix coverity #224. In a loop we were forgetting to free
resources on error exit path.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
===
--- branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c   2006-03-13 
06:48:48 UTC (rev 14300)
+++ branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c   2006-03-13 
06:50:33 UTC (rev 14301)
@@ -6799,8 +6799,10 @@
ndrivers=get_ntdrivers(list, architecture, version);
DEBUGADD(4,(we have:[%d] drivers in environment [%s] and 
version [%d]\n, ndrivers, architecture, version));
 
-   if(ndrivers == -1)
+   if(ndrivers == -1) {
+   SAFE_FREE(driver_info_2);
return WERR_NOMEM;
+   }
 
if(ndrivers != 0) {
if((driver_info_2=SMB_REALLOC_ARRAY(driver_info_2, 
DRIVER_INFO_2, *returned+ndrivers )) == NULL) {



svn commit: samba r14302 - in trunk/source/rpc_server: .

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 06:50:40 + (Mon, 13 Mar 2006)
New Revision: 14302

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14302

Log:
Fix coverity #224. In a loop we were forgetting to free
resources on error exit path.
Jeremy.

Modified:
   trunk/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: trunk/source/rpc_server/srv_spoolss_nt.c
===
--- trunk/source/rpc_server/srv_spoolss_nt.c2006-03-13 06:50:33 UTC (rev 
14301)
+++ trunk/source/rpc_server/srv_spoolss_nt.c2006-03-13 06:50:40 UTC (rev 
14302)
@@ -6799,8 +6799,10 @@
ndrivers=get_ntdrivers(list, architecture, version);
DEBUGADD(4,(we have:[%d] drivers in environment [%s] and 
version [%d]\n, ndrivers, architecture, version));
 
-   if(ndrivers == -1)
+   if(ndrivers == -1) {
+   SAFE_FREE(driver_info_2);
return WERR_NOMEM;
+   }
 
if(ndrivers != 0) {
if((driver_info_2=SMB_REALLOC_ARRAY(driver_info_2, 
DRIVER_INFO_2, *returned+ndrivers )) == NULL) {



svn commit: samba r14303 - in branches/SAMBA_3_0/source/rpc_server: .

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 06:52:03 + (Mon, 13 Mar 2006)
New Revision: 14303

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14303

Log:
Fix coverity #223. In a loop we were forgetting to free
resources on error exit path.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
===
--- branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c   2006-03-13 
06:50:40 UTC (rev 14302)
+++ branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c   2006-03-13 
06:52:03 UTC (rev 14303)
@@ -6717,8 +6717,10 @@
ndrivers=get_ntdrivers(list, architecture, version);
DEBUGADD(4,(we have:[%d] drivers in environment [%s] and 
version [%d]\n, ndrivers, architecture, version));
 
-   if(ndrivers == -1)
+   if(ndrivers == -1) {
+   SAFE_FREE(driver_info_1);
return WERR_NOMEM;
+   }
 
if(ndrivers != 0) {
if((driver_info_1=SMB_REALLOC_ARRAY(driver_info_1, 
DRIVER_INFO_1, *returned+ndrivers )) == NULL) {



svn commit: samba r14304 - in trunk/source/rpc_server: .

2006-03-12 Thread jra
Author: jra
Date: 2006-03-13 06:52:09 + (Mon, 13 Mar 2006)
New Revision: 14304

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14304

Log:
Fix coverity #223. In a loop we were forgetting to free
resources on error exit path.
Jeremy.

Modified:
   trunk/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: trunk/source/rpc_server/srv_spoolss_nt.c
===
--- trunk/source/rpc_server/srv_spoolss_nt.c2006-03-13 06:52:03 UTC (rev 
14303)
+++ trunk/source/rpc_server/srv_spoolss_nt.c2006-03-13 06:52:09 UTC (rev 
14304)
@@ -6717,8 +6717,10 @@
ndrivers=get_ntdrivers(list, architecture, version);
DEBUGADD(4,(we have:[%d] drivers in environment [%s] and 
version [%d]\n, ndrivers, architecture, version));
 
-   if(ndrivers == -1)
+   if(ndrivers == -1) {
+   SAFE_FREE(driver_info_1);
return WERR_NOMEM;
+   }
 
if(ndrivers != 0) {
if((driver_info_1=SMB_REALLOC_ARRAY(driver_info_1, 
DRIVER_INFO_1, *returned+ndrivers )) == NULL) {



svn commit: samba r14305 - in branches/SAMBA_4_0/source/auth: .

2006-03-12 Thread tridge
Author: tridge
Date: 2006-03-13 06:56:07 + (Mon, 13 Mar 2006)
New Revision: 14305

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14305

Log:

fixed a memory leak and a break error

Modified:
   branches/SAMBA_4_0/source/auth/auth_unix.c


Changeset:
Modified: branches/SAMBA_4_0/source/auth/auth_unix.c
===
--- branches/SAMBA_4_0/source/auth/auth_unix.c  2006-03-13 06:52:09 UTC (rev 
14304)
+++ branches/SAMBA_4_0/source/auth/auth_unix.c  2006-03-13 06:56:07 UTC (rev 
14305)
@@ -197,6 +197,7 @@
(*reply)[num].resp_retcode = PAM_SUCCESS;
(*reply)[num].resp = NULL;
DEBUG(4,(PAM Info message in conversation 
function: %s\n, (msg[num]-msg)));
+   break;
 
case PAM_ERROR_MSG:
(*reply)[num].resp_retcode = PAM_SUCCESS;
@@ -205,6 +206,10 @@
break;
 
default:
+   while (num  0) {
+   SAFE_FREE((*reply)[num-1].resp);
+   num--;
+   }
SAFE_FREE(*reply);
*reply = NULL;
DEBUG(1,(Error: PAM subsystme sent an UNKNOWN 
message type to the conversation function!\n));



svn commit: samba r14306 - in branches/SAMBA_4_0/source/auth/kerberos: .

2006-03-12 Thread tridge
Author: tridge
Date: 2006-03-13 06:56:31 + (Mon, 13 Mar 2006)
New Revision: 14306

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14306

Log:

fixed two break errors


Modified:
   branches/SAMBA_4_0/source/auth/kerberos/krb5_init_context.c


Changeset:
Modified: branches/SAMBA_4_0/source/auth/kerberos/krb5_init_context.c
===
--- branches/SAMBA_4_0/source/auth/kerberos/krb5_init_context.c 2006-03-13 
06:56:07 UTC (rev 14305)
+++ branches/SAMBA_4_0/source/auth/kerberos/krb5_init_context.c 2006-03-13 
06:56:31 UTC (rev 14306)
@@ -272,13 +272,13 @@
case KRB5_KRBHST_UDP:
if (lp_parm_bool(-1, krb5, udp, True)) {
status = socket_create(name, SOCKET_TYPE_DGRAM, 
smb_krb5-sock, 0);
-   break;
}
+   break;
case KRB5_KRBHST_TCP:
if (lp_parm_bool(-1, krb5, tcp, True)) {
status = socket_create(name, 
SOCKET_TYPE_STREAM, smb_krb5-sock, 0);
-   break;
}
+   break;
case KRB5_KRBHST_HTTP:
talloc_free(smb_krb5);
return EINVAL;



svn commit: samba r14307 - in branches/SAMBA_4_0/source/lib/socket: .

2006-03-12 Thread tridge
Author: tridge
Date: 2006-03-13 06:57:11 + (Mon, 13 Mar 2006)
New Revision: 14307

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14307

Log:

fixed dereference of my_address-addr when NULL



Modified:
   branches/SAMBA_4_0/source/lib/socket/socket_unix.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/socket/socket_unix.c
===
--- branches/SAMBA_4_0/source/lib/socket/socket_unix.c  2006-03-13 06:56:31 UTC 
(rev 14306)
+++ branches/SAMBA_4_0/source/lib/socket/socket_unix.c  2006-03-13 06:57:11 UTC 
(rev 14307)
@@ -134,10 +134,11 @@
unlink(my_address-addr);
}
 
-   if (my_address  my_address-sockaddr) {
+   if (my_address-sockaddr) {
ret = bind(sock-fd, (struct sockaddr *)my_addr, 
sizeof(my_addr));
+   } else if (my_address-addr == NULL) {
+   return NT_STATUS_INVALID_PARAMETER;
} else {
-   
if (strlen(my_address-addr)+1  sizeof(my_addr.sun_path)) {
return NT_STATUS_OBJECT_PATH_INVALID;
}



svn commit: samba r14308 - in branches/SAMBA_4_0/source/lib/util: .

2006-03-12 Thread tridge
Author: tridge
Date: 2006-03-13 06:58:09 + (Mon, 13 Mar 2006)
New Revision: 14308

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14308

Log:

fixed an out of range shift and an uninitialised error




Modified:
   branches/SAMBA_4_0/source/lib/util/idtree.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/util/idtree.c
===
--- branches/SAMBA_4_0/source/lib/util/idtree.c 2006-03-13 06:57:11 UTC (rev 
14307)
+++ branches/SAMBA_4_0/source/lib/util/idtree.c 2006-03-13 06:58:09 UTC (rev 
14308)
@@ -107,6 +107,8 @@
int l, id;
uint32_t bm;
 
+   memset(pa, 0, sizeof(pa));
+
id = *starting_id;
p = idp-top;
l = idp-layers;
@@ -271,7 +273,7 @@
/* Mask off upper bits we don't use for the search. */
id = MAX_ID_MASK;
 
-   while (n  0  p) {
+   while (n = IDR_BITS  p) {
n -= IDR_BITS;
p = p-ary[(id  n)  IDR_MASK];
}



svn commit: samba r14309 - in branches/SAMBA_4_0/source/lib/util: .

2006-03-12 Thread tridge
Author: tridge
Date: 2006-03-13 06:58:32 + (Mon, 13 Mar 2006)
New Revision: 14309

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14309

Log:

make sure ret is initialised





Modified:
   branches/SAMBA_4_0/source/lib/util/module.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/util/module.c
===
--- branches/SAMBA_4_0/source/lib/util/module.c 2006-03-13 06:58:09 UTC (rev 
14308)
+++ branches/SAMBA_4_0/source/lib/util/module.c 2006-03-13 06:58:32 UTC (rev 
14309)
@@ -100,12 +100,12 @@
 _PUBLIC_ BOOL run_init_functions(NTSTATUS (**fns) (void))
 {
int i;
-   BOOL ret;
+   BOOL ret = True;

if (fns == NULL)
return True;

-   for (i = 0; fns[i]; i++) { ret = NT_STATUS_IS_OK(fns[i]()); }
+   for (i = 0; fns[i]; i++) { ret = (BOOL)NT_STATUS_IS_OK(fns[i]()); }
 
return ret;
 }



svn commit: samba r14310 - in branches/SAMBA_4_0/source/librpc/ndr: .

2006-03-12 Thread tridge
Author: tridge
Date: 2006-03-13 06:58:51 + (Mon, 13 Mar 2006)
New Revision: 14310

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14310

Log:

length needs to be initialised






Modified:
   branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c
===
--- branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c2006-03-13 06:58:32 UTC 
(rev 14309)
+++ branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c2006-03-13 06:58:51 UTC 
(rev 14310)
@@ -817,7 +817,7 @@
 */
 _PUBLIC_ NTSTATUS ndr_pull_DATA_BLOB(struct ndr_pull *ndr, int ndr_flags, 
DATA_BLOB *blob)
 {
-   uint32_t length;
+   uint32_t length = 0;
 
if (ndr-flags  LIBNDR_ALIGN_FLAGS) {
if (ndr-flags  LIBNDR_FLAG_ALIGN2) {



svn commit: samba r14311 - in branches/SAMBA_4_0/source/librpc/rpc: .

2006-03-12 Thread tridge
Author: tridge
Date: 2006-03-13 06:59:06 + (Mon, 13 Mar 2006)
New Revision: 14311

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=14311

Log:

canon needs to be initialised






Modified:
   branches/SAMBA_4_0/source/librpc/rpc/dcerpc_sock.c


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc_sock.c
===
--- branches/SAMBA_4_0/source/librpc/rpc/dcerpc_sock.c  2006-03-13 06:58:51 UTC 
(rev 14310)
+++ branches/SAMBA_4_0/source/librpc/rpc/dcerpc_sock.c  2006-03-13 06:59:06 UTC 
(rev 14311)
@@ -627,7 +627,7 @@
 struct composite_context* dcerpc_pipe_open_pipe_send(struct dcerpc_connection 
*conn,
 const char *identifier)
 {
-   char *canon;
+   char *canon = NULL;
 
struct composite_context *c;
struct composite_context *sock_np_req;



Re: svn commit: samba r14173 - (fnum and smb_file change)

2006-03-12 Thread tridge
Metze,

  are you ok with r14256?

The structures are definately better, but it seems to be failing quite
a few tests :-)

for example, RAW-UNLINK is failing. I'm pretty sure it was this patch
that causes it, but I haven't worked out how yet.

  the idea with this is that I'll later add struct ntvfs_handle *ntvfs to
  smb_handle, so that the ntvfs subsystem doesn't need to know about fnum
  or smb2_handle.

oh, ok! So you'll have an idtree hanging off the session that maps the
fnum to the ntvfs_handle, then fill that in on calls that take a
handle?

The only slightly tricky bit will be calls that can take a 'wildcard'
handle. For example, SMBflush can take a handle of 0x meaning
flush all open handles. We handle that in the backend at the moment.

Apart from that, I think this is a good idea.

Cheers, Tridge


Re: svn commit: samba r14173 - (fnum and smb_file change)

2006-03-12 Thread Stefan (metze) Metzmacher
 Metze,

   are you ok with r14256?

 The structures are definately better, but it seems to be failing quite
 a few tests :-)

 for example, RAW-UNLINK is failing. I'm pretty sure it was this patch
 that causes it, but I haven't worked out how yet.

sorry, I take a look at it in about 5 hours, when I'm back from my exam...


   the idea with this is that I'll later add struct ntvfs_handle *ntvfs to
   smb_handle, so that the ntvfs subsystem doesn't need to know about fnum
   or smb2_handle.

 oh, ok! So you'll have an idtree hanging off the session that maps the
 fnum to the ntvfs_handle, then fill that in on calls that take a
 handle?

yep

 The only slightly tricky bit will be calls that can take a 'wildcard'
 handle. For example, SMBflush can take a handle of 0x meaning
 flush all open handles. We handle that in the backend at the moment.

yes, I noticed yet, but I need to think a bit more about it.

the simplest idea is to just move the for(each file) into the frontend,
and call the backend for each file, but I hope I find a solution,
where the cifs backend, can just pass one request.

we have the same problem with smb_exit and smb_logoff...

 Apart from that, I think this is a good idea.

good:-)

--
metze

Stefan Metzmacher metze at samba dot org