svn commit: samba-web r1362 - in trunk/support: .

2010-02-01 Thread jra
Author: jra
Date: 2010-02-01 11:57:40 -0700 (Mon, 01 Feb 2010)
New Revision: 1362

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

Log:
Update Dentar phone number.

Modified:
   trunk/support/us.html


Changeset:
Modified: trunk/support/us.html
===
--- trunk/support/us.html   2010-01-26 15:10:26 UTC (rev 1361)
+++ trunk/support/us.html   2010-02-01 18:57:40 UTC (rev 1362)
@@ -934,8 +934,7 @@
 Dentar, Inc.
 Thomas Glascock, President
 UNIX, Linux, and Samba expertise.
-513.985.0964
-513.312.6673
+513-312-6673
 den...@dentar.com
 /small/pre
 



svn commit: samba-web r1351 - in trunk: .

2009-12-25 Thread jra
Author: jra
Date: 2009-12-25 14:40:27 -0700 (Fri, 25 Dec 2009)
New Revision: 1351

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

Log:
Added blog #3 news.
Jeremy.

Modified:
   trunk/index.html


Changeset:
Modified: trunk/index.html
===
--- trunk/index.html2009-12-23 09:23:06 UTC (rev 1350)
+++ trunk/index.html2009-12-25 21:40:27 UTC (rev 1351)
@@ -24,6 +24,14 @@
 h2Latest News/h2
 !--#include virtual=/samba/news/headlines.html --
 
+h425 December 2009/h4
+
+p class=headlineSamba Team Blog #3/p
+
+pThe latest Samba Team Blog can be read a 
href=http://news.samba.org/developers/Samba_Team_Blog_3/;
+here./aIt includes advice on using Samba in your file serving product, 
news
+about Samba 4 and an explaination of how our release schedules work./p
+
 h415 December 2009/h4
 
 p class=headlineSamba 3.5.0pre2 Available for Download/p



svn commit: samba-web r1349 - in trunk/support: .

2009-12-15 Thread jra
Author: jra
Date: 2009-12-15 16:28:55 -0700 (Tue, 15 Dec 2009)
New Revision: 1349

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

Log:
Added lines.

Modified:
   trunk/support/costarica.html


Changeset:
Modified: trunk/support/costarica.html
===
--- trunk/support/costarica.html2009-12-15 09:44:35 UTC (rev 1348)
+++ trunk/support/costarica.html2009-12-15 23:28:55 UTC (rev 1349)
@@ -30,6 +30,7 @@
 /small/pre
 
 !-- Added: 27 November 2009 --
+hr /
 presmall
 Abax Asesores
 URL: a href=http://www.abaxasesores.com;http://www.abaxasesores.com/a
@@ -38,6 +39,7 @@
 Fax. +506 2234.6622
 
 Apartado Postal: 595-2070, Sabanilla, San José, Costa Rica.
+hr /
 /small/pre
 
 !--#include virtual=footer_support.html --



svn commit: samba-web r1344 - in trunk/support: .

2009-11-27 Thread jra
Author: jra
Date: 2009-11-27 15:53:07 -0700 (Fri, 27 Nov 2009)
New Revision: 1344

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

Log:
Updated DeepRoot Linux

Modified:
   trunk/support/india.html


Changeset:
Modified: trunk/support/india.html
===
--- trunk/support/india.html2009-11-26 14:05:04 UTC (rev 1343)
+++ trunk/support/india.html2009-11-27 22:53:07 UTC (rev 1344)
@@ -8,20 +8,27 @@
 !-- Added: 11 December 2004 --
 h3Bangalore/h3
 presmall
-DeepRoot Linux is one of the largest gnu/Linux product companies in 
-India. Headquartered at Bangalore, we develop cutting edge products and
-solutions to get gnu/Linux to work for you - faster, better, today,
-every way.
+DeepRoot Linux is one of the largest GNU/Linux product companies in India.
+Headquartered at Bangalore, we develop cutting edge solutions in terms of
+Products and Value Added Services to get GNU/Linux to work for you -
+faster, better, today, every way and back them up with exemplary support.
 
-Our products include small office servers, messaging servers, file 
-servers, firewall and vpn appliances and bandwidth management and link
-management solutions. We also provide commercial support for Free
-Software and the Debian gnu/Linux distribution. Support is available
-over phone, email, remote login and on-site.
+We have sufficient expertise and experience working on Samba.
+We have countless installations of Samba Servers across verticals and
+geographies.
 
+
+DeepRoot Linux' solutions (among others) include the deepOfix Mail Server,
+CRM applications, Hosting, Firewall, Proxy Servers, VPN Solutions, Drupal
+Solutions, Directory Services, File Servers, Bandwidth and Link Management,
+Electronic Fax Solutions, Training on GNU/Linux, etc.
+We provide commercial support for Free Software and the Debian GNU/Linux
+distribution. Support is available over phone, email, remote login and
+on-site.
+
 URL: a href=http://www.deeproot.co.in;http://www.deeproot.co.in/a
-Phone: +91 (80) 5112 4781
-Email: a href=mailto:sa...@deeproot.co.in;sa...@deeproot.co.in/a
+Phone: +91 (80) 4089 
+Email: a href=mailto:st...@deeproot.co.in;st...@deeproot.co.in/a
 /small/pre
 
 



svn commit: samba-web r1345 - in trunk/support: .

2009-11-27 Thread jra
Author: jra
Date: 2009-11-27 23:06:26 -0700 (Fri, 27 Nov 2009)
New Revision: 1345

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

Log:
Added Abax Asesores

Modified:
   trunk/support/costarica.html


Changeset:
Modified: trunk/support/costarica.html
===
--- trunk/support/costarica.html2009-11-27 22:53:07 UTC (rev 1344)
+++ trunk/support/costarica.html2009-11-28 06:06:26 UTC (rev 1345)
@@ -29,4 +29,15 @@
 a href=http://www.coral-systems.com;http://www.coral-systems.com/a
 /small/pre
 
+!-- Added: 27 November 2009 --
+presmall
+Abax Asesores
+URL: a href=http://www.abaxasesores.com;http://www.abaxasesores.com/a
+Email: a href=i...@abaxasesores.comi...@abaxasesores.com/a
+Tel. +506 2234.2290
+Fax. +506 2234.6622
+
+Apartado Postal: 595-2070, Sabanilla, San José, Costa Rica.
+/small/pre
+
 !--#include virtual=footer_support.html --



svn commit: samba-web r1341 - in trunk/support: .

2009-11-11 Thread jra
Author: jra
Date: 2009-11-11 13:26:58 -0700 (Wed, 11 Nov 2009)
New Revision: 1341

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

Log:
Updated transparen corp.

Modified:
   trunk/support/canada.html


Changeset:
Modified: trunk/support/canada.html
===
--- trunk/support/canada.html   2009-10-29 11:03:07 UTC (rev 1340)
+++ trunk/support/canada.html   2009-11-11 20:26:58 UTC (rev 1341)
@@ -28,24 +28,30 @@
 hr /
 presmall
 Transparen Corporation
-116-6363 121 Street
-Surrey BC  V3X 3K6
-Canada
 
-Office: 604-597-0464
-Fax: 604-597-0494
+British Columbia
+101-7164 120 Street
+Surrey BC V3W 3M8 Canada
+Website: a 
href=http://british-columbia.transparen.com;http://british-columbia.transparen.com/a
+
+Ontario
+100 King Street West, Suite 5700
+Toronto ON M5X 1C9 Canada
+Website: a 
href=http://ontario.transparen.com;http://ontario.transparen.com/a
+
+General Website: a 
href=http://www.transparen.com;http://www.transparen.com/a
 Email: a href=mailto:busin...@transparen.com;busin...@transparen.com/a
-Website: a href=http://www.transparen.com;http://www.transparen.com/a
+Office: 1-888-747-6775
+Fax: 1-888-747-6775
 
 Transparen Corporation provides balanced technical support to corporate
 clients who have networks of computers, whether they use Windows or Linux.
 Due to our knowledge of both operating systems, we provide truly
 independent and knowledgeable advice, based solely on the business
-requirements of the customer.  Clients in Surrey, BC benefit from swift
-on-site technical support. Other clients can make use of our remote
-help-desk service, which allows them to be served remotely using SSH for
-Linux, or Remote Desktop Assistance for Windows, as well as by live
-interaction with highly qualified technical support staff over the phone.
+requirements of the customer.  Clients in Surrey, BC benefit from rapid
+data recovery (for Samba Servers and Windows desktops), and SRamp;ED tax 
credit
+preparation related to their efforts creating business systems involving
+Windows and Linux.
 /small/pre
 
 



svn commit: samba-web r1327 - in trunk: .

2009-09-25 Thread jra
Author: jra
Date: 2009-09-25 11:03:50 -0600 (Fri, 25 Sep 2009)
New Revision: 1327

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

Log:
Added blog post #2.
Jeremy.

Modified:
   trunk/index.html


Changeset:
Modified: trunk/index.html
===
--- trunk/index.html2009-09-25 16:06:15 UTC (rev 1326)
+++ trunk/index.html2009-09-25 17:03:50 UTC (rev 1327)
@@ -24,7 +24,10 @@
 h2Latest News/h2
 !--#include virtual=/samba/news/headlines.html --
 
-h4a name=latest9 September 2009/a/h4
+h4a name=latest25 September 2009/a/h4
+p class=headlineA new Samba Team Blog post can be read a 
href=http://news.samba.org/developers/Samba_Team_Blog_2;here./a/p
+
+h49 September 2009/a/h4
 p class=headlineSamba 3.4.1 Available for Download/p
 
 pThis is the latest stable release of the Samba 3.4 series./p
@@ -35,8 +38,6 @@
 See a href=/samba/history/samba-3.4.1.htmlthe release notes
 for more info/a./p
 
-h2Samba Team Starts a Blog/h2
-
 h412 August 2009/h4
 p class=headlineSamba 3.2.14 Available for Download/p
 
@@ -56,6 +57,7 @@
 Planning/a Wiki page for more information.
 /p
 
+h2Samba Team Starts a Blog/h2
 h407 August 2009/h4
 p class=headlineThe first Samba Team Blog post can be read a 
href=http://news.samba.org/developers/Samba_Team_Blog_1/;here./a/p
 



svn commit: samba-web r1316 - in trunk: .

2009-08-07 Thread jra
Author: jra
Date: 2009-08-07 15:26:34 -0600 (Fri, 07 Aug 2009)
New Revision: 1316

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

Log:
Added blog post.

Modified:
   trunk/index.html


Changeset:
Modified: trunk/index.html
===
--- trunk/index.html2009-08-05 08:00:01 UTC (rev 1315)
+++ trunk/index.html2009-08-07 21:26:34 UTC (rev 1316)
@@ -24,8 +24,11 @@
 h2Latest News/h2
 !--#include virtual=/samba/news/headlines.html --
 
-h2Current Release/h2
+h2Samba Team Starts a Blog/h2
 
+h407 August 2009/h4
+p class=headlineThe first Samba Team Blog post can be read a 
href=http://news.samba.org/developers/Samba_Team_Blog_1/;here./a/p
+
 h405 August 2009/h4
 p class=headlineSamba 3.0.36 Available for Download/p
 



svn commit: samba-web r1285 - in trunk/news: .

2009-04-03 Thread jra
Author: jra
Date: 2009-04-03 23:10:34 + (Fri, 03 Apr 2009)
New Revision: 1285

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

Log:
Added Lars.
Jeremy.

Modified:
   trunk/news/samba_and_guis.html


Changeset:
Modified: trunk/news/samba_and_guis.html
===
--- trunk/news/samba_and_guis.html  2009-04-03 20:51:59 UTC (rev 1284)
+++ trunk/news/samba_and_guis.html  2009-04-03 23:10:34 UTC (rev 1285)
@@ -62,7 +62,7 @@
and authentication service that can be used by
everyone and is developed as a community of equals./p
 
-pVolker Lendecke, Jeremy Allison, and Jim McDonoughbr
+pVolker Lendecke, Jeremy Allison, Jim McDonough, and Lars M�llerbr
 Samba Team/p
 
 !--#include virtual=/samba/footer.html --



svn commit: samba-web r1286 - in trunk/news: .

2009-04-03 Thread jra
Author: jra
Date: 2009-04-03 23:13:01 + (Fri, 03 Apr 2009)
New Revision: 1286

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

Log:
Fix the umlaut.

Modified:
   trunk/news/samba_and_guis.html


Changeset:
Modified: trunk/news/samba_and_guis.html
===
--- trunk/news/samba_and_guis.html  2009-04-03 23:10:34 UTC (rev 1285)
+++ trunk/news/samba_and_guis.html  2009-04-03 23:13:01 UTC (rev 1286)
@@ -62,7 +62,7 @@
and authentication service that can be used by
everyone and is developed as a community of equals./p
 
-pVolker Lendecke, Jeremy Allison, Jim McDonough, and Lars M�llerbr
+pVolker Lendecke, Jeremy Allison, Jim McDonough, and Lars Muuml;llerbr
 Samba Team/p
 
 !--#include virtual=/samba/footer.html --



svn commit: samba-docs r1218 - in trunk/smbdotconf/security: .

2007-12-30 Thread jra
Author: jra
Date: 2007-12-31 02:22:27 + (Mon, 31 Dec 2007)
New Revision: 1218

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

Log:
Add smb encrypt to smb.conf.
Jeremy.

Added:
   trunk/smbdotconf/security/smbencrypt.xml


Changeset:
Added: trunk/smbdotconf/security/smbencrypt.xml
===
--- trunk/smbdotconf/security/smbencrypt.xml2007-12-20 10:00:30 UTC (rev 
1217)
+++ trunk/smbdotconf/security/smbencrypt.xml2007-12-31 02:22:27 UTC (rev 
1218)
@@ -0,0 +1,45 @@
+samba:parameter name=smb encrypt
+ context=S
+type=enum
+ basic=1
+xmlns:samba=http://www.samba.org/samba/DTD/samba-doc;
+description
+
+paraThis is a new feature introduced with Samba 3.2 and above. It is an
+extension to the SMB/CIFS protocol negotiated as part of the UNIX 
extensions.
+SMB encryption uses the GSSAPI (SSPI on Windows) ability to encrypt
+and sign every request/response in a SMB protocol stream. When
+enabled it provides a secure method of SMB/CIFS communication,
+similar to an ssh protected session, but using SMB/CIFS authentication
+to negotiate encryption and signing keys. Currently this is only
+supported by Samba 3.2 smbclient, and hopefully soon Linux CIFSFS
+and MacOS/X clients. Windows clients do not support this feature.
+/para
+
+paraThis controls whether the server offers or requires
+the client it talks to to use SMB encryption. Possible values 
+are emphasisauto/emphasis, emphasismandatory/emphasis 
+and emphasisdisabled/emphasis. This may be set on a per-share
+basis, but clients may chose to encrypt the entire session, not
+just traffic to a specific share. If this is set to mandatory
+then all traffic to a share emphasismust/emphasis must
+be encrypted once the connection has been made to the share.
+The server would return access denied to all non-encrypted
+requests on such a share. Selecting encrypted traffic reduces
+throughput as smaller packet sizes must be used (no huge UNIX
+style read/writes allowed) as well as the overhead of encrypting
+and signing all the data.
+/para
+
+paraIf SMB encryption is selected, Windows style SMB signing (see
+the smbconfoption name=server signing/ option) is no longer necessary,
+as the GSSAPI flags use select both signing and sealing of the data.
+/para
+
+paraWhen set to auto, SMB encryption is offered, but not enforced. 
+When set to mandatory, SMB encryption is required and if set 
+to disabled, SMB encryption can not be negotiated./para
+/description
+
+value type=defaultauto/value
+/samba:parameter



svn commit: samba-docs r1219 - in trunk/manpages-3: .

2007-12-30 Thread jra
Author: jra
Date: 2007-12-31 06:17:01 + (Mon, 31 Dec 2007)
New Revision: 1219

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

Log:
Add in the docs for -e and posix_encrypt commands.
Jeremy.

Modified:
   trunk/manpages-3/smbclient.1.xml


Changeset:
Modified: trunk/manpages-3/smbclient.1.xml
===
--- trunk/manpages-3/smbclient.1.xml2007-12-31 02:22:27 UTC (rev 1218)
+++ trunk/manpages-3/smbclient.1.xml2007-12-31 06:17:01 UTC (rev 1219)
@@ -19,6 +19,7 @@
commandsmbclient/command
arg choice=opt-b lt;buffer sizegt;/arg
arg choice=opt-d debuglevel/arg
+   arg choice=opt-e/arg
arg choice=opt-L lt;netbios namegt;/arg
arg choice=opt-U username/arg
arg choice=opt-I destinationIP/arg
@@ -42,6 +43,7 @@
arg choice=optpassword/arg
arg choice=opt-b lt;buffer sizegt;/arg
arg choice=opt-d debuglevel/arg
+   arg choice=opt-e/arg
arg choice=opt-D Directory/arg
arg choice=opt-U username/arg
arg choice=opt-W workgroup/arg
@@ -310,6 +312,18 @@
/para/listitem
/varlistentry

+   varlistentry
+   term-e/term
+   listitemparaThis command line parameter requires the remote
+   server support the UNIX extensions. Request that the connection 
be
+   encrypted. This is new for Samba 3.2 and will only work with 
Samba
+   3.2 or above servers. Negotiates SMB encryption using GSSAPI. 
Uses
+   the given credentials for the encryption negotiaion (either 
kerberos
+   or NTLMv1/v2 if given domain/username/password triple. Fails the
+   connection if encryption cannot be negotiated.
+   /para/listitem
+   /varlistentry
+   
popt.common.samba;
popt.common.credentials;
popt.common.connection;
@@ -801,6 +815,18 @@
/varlistentry
 
varlistentry
+   termposix_encrypt lt;domaingt; lt;usernamegt; 
lt;passwordgt;/term
+   listitemparaThis command depends on the server supporting 
the CIFS
+   UNIX extensions and will fail if the server does not. Attempt 
to negotiate
+   SMB encryption on this connection. If smbclient connected with 
kerberos
+   credentials (-k) the arguments to this command are ignored and 
the kerberos
+   credentials are used to negotiate GSSAPI signing and sealing 
instead. See
+   also the -e option to smbclient to force encryption on initial 
connection.
+   This command is new with Samba 3.2.
+   /para/listitem
+   /varlistentry
+
+   varlistentry
termposix_open lt;filenamegt; lt;octal modegt;/term
listitemparaThis command depends on the server supporting 
the CIFS
UNIX extensions and will fail if the server does not. Opens a 
remote file



svn commit: samba-docs r1205 - in trunk/smbdotconf/protocol: .

2007-11-07 Thread jra
Author: jra
Date: 2007-11-08 05:38:04 + (Thu, 08 Nov 2007)
New Revision: 1205

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

Log:
Note that the max value of this is 128k and it is
silently enforced.
Jeremy.

Modified:
   trunk/smbdotconf/protocol/minreceivefilesize.xml


Changeset:
Modified: trunk/smbdotconf/protocol/minreceivefilesize.xml
===
--- trunk/smbdotconf/protocol/minreceivefilesize.xml2007-11-06 13:43:19 UTC 
(rev 1204)
+++ trunk/smbdotconf/protocol/minreceivefilesize.xml2007-11-08 05:38:04 UTC 
(rev 1205)
@@ -12,7 +12,7 @@
 socket buffers into the filesystem buffer cache, if available. It may improve 
performance
 but user testing is recommended. If set to zero Samba processes SMBwriteX 
calls in the
 normal way. To enable POSIX large write support (SMB/CIFS writes up to 16Mb) 
this option must be
-nonzero./para
+nonzero. The maximum value is 128k. Values greater than 128k will be silently 
set to 128k./para
 paraNote this option will have NO EFFECT if set on a SMB signed 
connection./para
 paraThe default is zero, which diables this option./para
 /description



svn commit: samba r25892 - in branches/SAMBA_4_0/source/lib: replace replace/system tdb/common tdb/include tdb/tools

2007-11-06 Thread jra
Author: jra
Date: 2007-11-07 06:59:02 + (Wed, 07 Nov 2007)
New Revision: 25892

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

Log:
Keep the tdb code in sync between 3.2.x and 4.0.
Add in the alarm fix to allow locks to exit on
alarm signal.
Sync up the changes in tools.
Jeremy.

Modified:
   branches/SAMBA_4_0/source/lib/replace/replace.h
   branches/SAMBA_4_0/source/lib/replace/system/wait.h
   branches/SAMBA_4_0/source/lib/tdb/common/io.c
   branches/SAMBA_4_0/source/lib/tdb/common/lock.c
   branches/SAMBA_4_0/source/lib/tdb/common/tdb_private.h
   branches/SAMBA_4_0/source/lib/tdb/include/tdb.h
   branches/SAMBA_4_0/source/lib/tdb/tools/tdbbackup.c
   branches/SAMBA_4_0/source/lib/tdb/tools/tdbdump.c
   branches/SAMBA_4_0/source/lib/tdb/tools/tdbtool.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/replace.h
===
--- branches/SAMBA_4_0/source/lib/replace/replace.h 2007-11-07 05:35:16 UTC 
(rev 25891)
+++ branches/SAMBA_4_0/source/lib/replace/replace.h 2007-11-07 06:59:02 UTC 
(rev 25892)
@@ -452,6 +452,10 @@
 #define MAX(a,b) ((a)(b)?(a):(b))
 #endif
 
+#if !defined(HAVE_VOLATILE)
+#define volatile
+#endif
+
 /**
   this is a warning hack. The idea is to use this everywhere that we
   get the discarding const warning from gcc. That doesn't actually

Modified: branches/SAMBA_4_0/source/lib/replace/system/wait.h
===
--- branches/SAMBA_4_0/source/lib/replace/system/wait.h 2007-11-07 05:35:16 UTC 
(rev 25891)
+++ branches/SAMBA_4_0/source/lib/replace/system/wait.h 2007-11-07 06:59:02 UTC 
(rev 25892)
@@ -48,4 +48,8 @@
 #define SA_RESETHAND SA_ONESHOT
 #endif
 
+#if !defined(HAVE_SIG_ATOMIC_T_TYPE)
+typedef int sig_atomic_t;
 #endif
+
+#endif

Modified: branches/SAMBA_4_0/source/lib/tdb/common/io.c
===
--- branches/SAMBA_4_0/source/lib/tdb/common/io.c   2007-11-07 05:35:16 UTC 
(rev 25891)
+++ branches/SAMBA_4_0/source/lib/tdb/common/io.c   2007-11-07 06:59:02 UTC 
(rev 25892)
@@ -94,7 +94,7 @@
/* try once more */
TDB_LOG((tdb, TDB_DEBUG_FATAL, tdb_write: wrote only 
 %d of %d bytes at %d, trying once more\n,
-written, len, off));
+(int)written, len, off));
errno = ENOSPC;
written = pwrite(tdb-fd, (void *)((char *)buf+written),
 len-written,
@@ -274,11 +274,13 @@
return -1;
} else if (written == -1) {
TDB_LOG((tdb, TDB_DEBUG_FATAL, expand_file write of 
-   %d bytes failed (%s)\n, n, strerror(errno)));
+%d bytes failed (%s)\n, (int)n,
+strerror(errno)));
return -1;
} else if (written != n) {
TDB_LOG((tdb, TDB_DEBUG_WARNING, expand_file: wrote 
-   only %d of %d bytes - retrying\n, written,n));
+only %d of %d bytes - retrying\n, 
(int)written,
+(int)n));
}
addition -= written;
size += written;

Modified: branches/SAMBA_4_0/source/lib/tdb/common/lock.c
===
--- branches/SAMBA_4_0/source/lib/tdb/common/lock.c 2007-11-07 05:35:16 UTC 
(rev 25891)
+++ branches/SAMBA_4_0/source/lib/tdb/common/lock.c 2007-11-07 06:59:02 UTC 
(rev 25892)
@@ -29,6 +29,11 @@
 
 #define TDB_MARK_LOCK 0x8000
 
+void tdb_setalarm_sigptr(struct tdb_context *tdb, volatile sig_atomic_t *ptr)
+{
+   tdb-interrupt_sig_ptr = ptr;
+}
+
 /* a byte range locking function - return 0 on success
this functions locks/unlocks 1 byte at the specified offset.
 
@@ -60,6 +65,13 @@
 
do {
ret = fcntl(tdb-fd,lck_type,fl);
+
+   /* Check for a sigalarm break. */
+   if (ret == -1  errno == EINTR 
+   tdb-interrupt_sig_ptr 
+   *tdb-interrupt_sig_ptr) {
+   break;
+   }
} while (ret == -1  errno == EINTR);
 
if (ret == -1) {

Modified: branches/SAMBA_4_0/source/lib/tdb/common/tdb_private.h
===
--- branches/SAMBA_4_0/source/lib/tdb/common/tdb_private.h  2007-11-07 
05:35:16 UTC (rev 25891)
+++ branches/SAMBA_4_0/source/lib/tdb/common/tdb_private.h  2007-11-07 
06:59:02 UTC (rev 25892)
@@ -28,6 +28,7 @@
 #include system/time.h
 #include system/shmem.h
 #include system/select.h
+#include system/wait.h
 #include tdb.h

svn commit: samba r25893 - in branches/SAMBA_4_0/source/lib: ldb/ldb_tdb tdb/common tdb/tools

2007-11-06 Thread jra
Author: jra
Date: 2007-11-07 07:13:44 + (Wed, 07 Nov 2007)
New Revision: 25893

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

Log:
Fix ldb, tdb builds (and one warning).
Jeremy.

Modified:
   branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.h
   branches/SAMBA_4_0/source/lib/tdb/common/io.c
   branches/SAMBA_4_0/source/lib/tdb/tools/tdbtorture.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.h
===
--- branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.h 2007-11-07 06:59:02 UTC 
(rev 25892)
+++ branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.h 2007-11-07 07:13:44 UTC 
(rev 25893)
@@ -1,6 +1,8 @@
 #if (_SAMBA_BUILD_ == 3)
 #include tdb/include/tdb.h
 #else
+#include replace.h
+#include system/wait.h
 #include tdb.h
 #endif
 

Modified: branches/SAMBA_4_0/source/lib/tdb/common/io.c
===
--- branches/SAMBA_4_0/source/lib/tdb/common/io.c   2007-11-07 06:59:02 UTC 
(rev 25892)
+++ branches/SAMBA_4_0/source/lib/tdb/common/io.c   2007-11-07 07:13:44 UTC 
(rev 25893)
@@ -96,7 +96,7 @@
 %d of %d bytes at %d, trying once more\n,
 (int)written, len, off));
errno = ENOSPC;
-   written = pwrite(tdb-fd, (void *)((char *)buf+written),
+   written = pwrite(tdb-fd, (const void *)((const char 
*)buf+written),
 len-written,
 off+written);
}

Modified: branches/SAMBA_4_0/source/lib/tdb/tools/tdbtorture.c
===
--- branches/SAMBA_4_0/source/lib/tdb/tools/tdbtorture.c2007-11-07 
06:59:02 UTC (rev 25892)
+++ branches/SAMBA_4_0/source/lib/tdb/tools/tdbtorture.c2007-11-07 
07:13:44 UTC (rev 25893)
@@ -3,10 +3,10 @@
 */
 
 #include replace.h
-#include tdb.h
 #include system/time.h
 #include system/wait.h
 #include system/filesys.h
+#include tdb.h
 
 #ifdef HAVE_GETOPT_H
 #include getopt.h



svn commit: samba-docs r1202 - in trunk/smbdotconf/protocol: .

2007-11-02 Thread jra
Author: jra
Date: 2007-11-02 21:54:22 + (Fri, 02 Nov 2007)
New Revision: 1202

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

Log:
Add min receivefile size docs.
Jeremy.

Added:
   trunk/smbdotconf/protocol/minreceivefilesize.xml


Changeset:
Added: trunk/smbdotconf/protocol/minreceivefilesize.xml
===
--- trunk/smbdotconf/protocol/minreceivefilesize.xml2007-11-01 13:45:31 UTC 
(rev 1201)
+++ trunk/smbdotconf/protocol/minreceivefilesize.xml2007-11-02 21:54:22 UTC 
(rev 1202)
@@ -0,0 +1,22 @@
+samba:parameter name=min receivefile size
+   type=integer
+   context=G
+   advanced=1 developer=1
+   xmlns:samba=http://www.samba.org/samba/DTD/samba-doc;
+description
+paraThis option changes the behavior of 
citerefentryrefentrytitlesmbd/refentrytitle
+manvolnum8/manvolnum/citerefentry when processing SMBwriteX calls. Any 
incoming
+SMBwriteX call on a non-signed SMB/CIFS connection greater than this value 
will not be processed in the normal way but will
+be passed to any underlying kernel recvfile or splice system call (if there is 
no such
+call Samba will emulate in user space). This allows zero-copy writes directly 
from network
+socket buffers into the filesystem buffer cache, if available. It may improve 
performance
+but user testing is recommended. If set to zero Samba processes SMBwriteX 
calls in the
+normal way. To enable POSIX large write support (SMB/CIFS writes up to 16Mb) 
this option must be
+nonzero./para
+paraNote this option will have NO EFFECT if set on a SMB signed 
connection./para
+paraThe default is zero, which diables this option./para
+/description
+
+relatedmin receivefile size/related
+value type=default0/value
+/samba:parameter



svn commit: samba-docs r1203 - in trunk/manpages-3: .

2007-11-02 Thread jra
Author: jra
Date: 2007-11-02 22:45:37 + (Fri, 02 Nov 2007)
New Revision: 1203

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

Log:
Make the smbclient man page match the internal command list.
Jeremy.

Modified:
   trunk/manpages-3/smbclient.1.xml


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


svn commit: samba r25700 - in branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3: .

2007-10-18 Thread jra
Author: jra
Date: 2007-10-19 00:40:51 + (Fri, 19 Oct 2007)
New Revision: 25700

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

Log:
Now BOOL no longer exists in Samba 3.2, use bool instead.
Jeremy.

Modified:
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm


Changeset:
Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
===
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm   
2007-10-18 21:23:25 UTC (rev 25699)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm   
2007-10-19 00:40:51 UTC (rev 25700)
@@ -84,7 +84,7 @@
 
my $op = NDR_.uc($fn-{NAME});
 
-   pidl static BOOL api_$fn-{NAME}(pipes_struct *p);
+   pidl static bool api_$fn-{NAME}(pipes_struct *p);
pidl {;
indent;
pidl const struct ndr_interface_call *call;;



svn commit: samba r25586 - in branches/SAMBA_4_0/source/lib/replace: .

2007-10-08 Thread jra
Author: jra
Date: 2007-10-08 23:10:09 + (Mon, 08 Oct 2007)
New Revision: 25586

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

Log:
Fix getaddrinfo detection - from Timur.
Jeremy.

Modified:
   branches/SAMBA_4_0/source/lib/replace/libreplace.m4


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/libreplace.m4
===
--- branches/SAMBA_4_0/source/lib/replace/libreplace.m4 2007-10-08 20:06:37 UTC 
(rev 25585)
+++ branches/SAMBA_4_0/source/lib/replace/libreplace.m4 2007-10-08 23:10:09 UTC 
(rev 25586)
@@ -141,6 +141,10 @@
 AC_CACHE_CHECK([for struct addrinfo],samba_cv_HAVE_STRUCT_ADDRINFO,[
 AC_TRY_COMPILE([
 #include sys/types.h
+#if STDC_HEADERS
+#include stdlib.h
+#include stddef.h
+#endif
 #include sys/socket.h
 #include netdb.h],
 [
@@ -154,8 +158,12 @@
 dnl test for getaddrinfo/getnameinfo
 AC_CACHE_CHECK([for getaddrinfo],samba_cv_HAVE_GETADDRINFO,[
 AC_TRY_COMPILE([
+#include sys/types.h
+#if STDC_HEADERS
+#include stdlib.h
+#include stddef.h
+#endif
 #include sys/socket.h
-#include sys/types.h
 #include netdb.h],
 [
 struct sockaddr sa;



svn commit: samba r25587 - in branches: SAMBA_3_2/source/lib/replace SAMBA_3_2_0/source/lib/replace

2007-10-08 Thread jra
Author: jra
Date: 2007-10-08 23:11:33 + (Mon, 08 Oct 2007)
New Revision: 25587

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

Log:
Fix getaddrinfo detection code. From Timur.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/lib/replace/libreplace.m4
   branches/SAMBA_3_2_0/source/lib/replace/libreplace.m4


Changeset:
Modified: branches/SAMBA_3_2/source/lib/replace/libreplace.m4
===
--- branches/SAMBA_3_2/source/lib/replace/libreplace.m4 2007-10-08 23:10:09 UTC 
(rev 25586)
+++ branches/SAMBA_3_2/source/lib/replace/libreplace.m4 2007-10-08 23:11:33 UTC 
(rev 25587)
@@ -141,6 +141,10 @@
 AC_CACHE_CHECK([for struct addrinfo],samba_cv_HAVE_STRUCT_ADDRINFO,[
 AC_TRY_COMPILE([
 #include sys/types.h
+#if STDC_HEADERS
+#include stdlib.h
+#include stddef.h
+#endif
 #include sys/socket.h
 #include netdb.h],
 [
@@ -154,8 +158,12 @@
 dnl test for getaddrinfo/getnameinfo
 AC_CACHE_CHECK([for getaddrinfo],samba_cv_HAVE_GETADDRINFO,[
 AC_TRY_COMPILE([
+#include sys/types.h
+#if STDC_HEADERS
+#include stdlib.h
+#include stddef.h
+#endif
 #include sys/socket.h
-#include sys/types.h
 #include netdb.h],
 [
 struct sockaddr sa;

Modified: branches/SAMBA_3_2_0/source/lib/replace/libreplace.m4
===
--- branches/SAMBA_3_2_0/source/lib/replace/libreplace.m4   2007-10-08 
23:10:09 UTC (rev 25586)
+++ branches/SAMBA_3_2_0/source/lib/replace/libreplace.m4   2007-10-08 
23:11:33 UTC (rev 25587)
@@ -141,6 +141,10 @@
 AC_CACHE_CHECK([for struct addrinfo],samba_cv_HAVE_STRUCT_ADDRINFO,[
 AC_TRY_COMPILE([
 #include sys/types.h
+#if STDC_HEADERS
+#include stdlib.h
+#include stddef.h
+#endif
 #include sys/socket.h
 #include netdb.h],
 [
@@ -154,8 +158,12 @@
 dnl test for getaddrinfo/getnameinfo
 AC_CACHE_CHECK([for getaddrinfo],samba_cv_HAVE_GETADDRINFO,[
 AC_TRY_COMPILE([
+#include sys/types.h
+#if STDC_HEADERS
+#include stdlib.h
+#include stddef.h
+#endif
 #include sys/socket.h
-#include sys/types.h
 #include netdb.h],
 [
 struct sockaddr sa;



svn commit: samba r25565 - in branches: SAMBA_3_2/source/lib SAMBA_3_2_0/source/lib

2007-10-07 Thread jra
Author: jra
Date: 2007-10-08 02:48:03 + (Mon, 08 Oct 2007)
New Revision: 25565

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

Log:
Fix unintended consequence change for IPv6 noticed
by Volker. We used to return 0.0.0.0 for the text
address of an uninitialized socket - ensure we
still do so. Once uninitialized address is as
good as any other.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/lib/util_sock.c
   branches/SAMBA_3_2_0/source/lib/util_sock.c


Changeset:
Modified: branches/SAMBA_3_2/source/lib/util_sock.c
===
--- branches/SAMBA_3_2/source/lib/util_sock.c   2007-10-07 17:58:48 UTC (rev 
25564)
+++ branches/SAMBA_3_2/source/lib/util_sock.c   2007-10-08 02:48:03 UTC (rev 
25565)
@@ -70,8 +70,13 @@
socklen_t length = sizeof(sa);
static char addr_buf[INET6_ADDRSTRLEN];
 
-   addr_buf[0] = '\0';
+   /* Ok, returning a hard coded IPv4 address
+* is bogus, but it's just as bogus as a
+* zero IPv6 address. No good choice here.
+*/
 
+   safe_strcpy(addr_buf, 0.0.0.0, sizeof(addr_buf)-1);
+
if (fd == -1) {
return addr_buf;
}

Modified: branches/SAMBA_3_2_0/source/lib/util_sock.c
===
--- branches/SAMBA_3_2_0/source/lib/util_sock.c 2007-10-07 17:58:48 UTC (rev 
25564)
+++ branches/SAMBA_3_2_0/source/lib/util_sock.c 2007-10-08 02:48:03 UTC (rev 
25565)
@@ -70,8 +70,13 @@
socklen_t length = sizeof(sa);
static char addr_buf[INET6_ADDRSTRLEN];
 
-   addr_buf[0] = '\0';
+   /* Ok, returning a hard coded IPv4 address
+* is bogus, but it's just as bogus as a
+* zero IPv6 address. No good choice here.
+*/
 
+   safe_strcpy(addr_buf, 0.0.0.0, sizeof(addr_buf)-1);
+
if (fd == -1) {
return addr_buf;
}



svn commit: samba r25559 - in branches/SAMBA_3_2_0/source: . lib/replace lib/replace/system script/tests

2007-10-06 Thread jra
Author: jra
Date: 2007-10-07 04:23:06 + (Sun, 07 Oct 2007)
New Revision: 25559

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

Log:
Janitor for Jelmer (until git is in place).
merge libreplace fixes from samba4.
Jeremy.

Added:
   branches/SAMBA_3_2_0/source/lib/replace/getaddrinfo.h
Modified:
   branches/SAMBA_3_2_0/source/configure.in
   branches/SAMBA_3_2_0/source/lib/replace/README
   branches/SAMBA_3_2_0/source/lib/replace/libreplace.m4
   branches/SAMBA_3_2_0/source/lib/replace/replace.h
   branches/SAMBA_3_2_0/source/lib/replace/system/getaddrinfo.h
   branches/SAMBA_3_2_0/source/script/tests/test_smbtorture_s3.sh


Changeset:
Modified: branches/SAMBA_3_2_0/source/configure.in
===
--- branches/SAMBA_3_2_0/source/configure.in2007-10-07 00:25:27 UTC (rev 
25558)
+++ branches/SAMBA_3_2_0/source/configure.in2007-10-07 04:23:06 UTC (rev 
25559)
@@ -3093,44 +3093,6 @@
 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6,1,[Whether the system has struct 
sockaddr_in6])
 fi
 
-dnl test for struct addrinfo
-AC_CACHE_CHECK([for struct addrinfo],samba_cv_HAVE_STRUCT_ADDRINFO,[
-AC_TRY_COMPILE([
-#include sys/types.h
-#include sys/socket.h
-#include netdb.h],
-[
-struct addrinfo ai;
-],
-samba_cv_HAVE_STRUCT_ADDRINFO=yes,samba_cv_HAVE_STRUCT_ADDRINFO=no)])
-if test x$samba_cv_HAVE_STRUCT_ADDRINFO = xyes; then
-AC_DEFINE(HAVE_STRUCT_ADDRINFO,1,[Whether the system has struct addrinfo])
-fi
-
-dnl test for getaddrinfo/getnameinfo
-AC_CACHE_CHECK([for getaddrinfo],samba_cv_HAVE_GETADDRINFO,[
-AC_TRY_COMPILE([
-#include sys/socket.h
-#include sys/types.h
-#include netdb.h],
-[
-struct sockaddr sa;
-struct addrinfo *ai = NULL;
-int ret = getaddrinfo(NULL, NULL, NULL, ai);
-if (ret != 0) {
-   const char *es = gai_strerror(ret);
-}
-freeaddrinfo(ai);
-ret = getnameinfo(sa, sizeof(sa),
-   NULL, 0,
-   NULL, 0, 0);
-
-],
-samba_cv_HAVE_GETADDRINFO=yes,samba_cv_HAVE_GETADDRINFO=no)])
-if test x$samba_cv_HAVE_GETADDRINFO = xyes; then
-AC_DEFINE(HAVE_GETADDRINFO,1,[Whether the system has getaddrinfo and 
getnameinfo])
-fi
-
 
 # look for a method of setting the effective uid
 seteuid=no;

Modified: branches/SAMBA_3_2_0/source/lib/replace/README
===
--- branches/SAMBA_3_2_0/source/lib/replace/README  2007-10-07 00:25:27 UTC 
(rev 25558)
+++ branches/SAMBA_3_2_0/source/lib/replace/README  2007-10-07 04:23:06 UTC 
(rev 25559)
@@ -50,10 +50,16 @@
 getpass
 readline (the library)
 inet_ntoa
+inet_ntop
+inet_pton
 strtoll
 strtoull
 socketpair
 strptime
+getaddrinfo
+freeaddrinfo
+getnameinfo
+gai_strerror
 
 Types:
 bool

Added: branches/SAMBA_3_2_0/source/lib/replace/getaddrinfo.h
===
--- branches/SAMBA_3_2_0/source/lib/replace/getaddrinfo.h   2007-10-07 
00:25:27 UTC (rev 25558)
+++ branches/SAMBA_3_2_0/source/lib/replace/getaddrinfo.h   2007-10-07 
04:23:06 UTC (rev 25559)
@@ -0,0 +1,158 @@
+/*
+PostgreSQL Database Management System
+(formerly known as Postgres, then as Postgres95)
+
+Portions Copyright (c) 1996-2005, The PostgreSQL Global Development Group
+
+Portions Copyright (c) 1994, The Regents of the University of California
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose, without fee, and without a written agreement
+is hereby granted, provided that the above copyright notice and this paragraph
+and the following two paragraphs appear in all copies.
+
+IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
+LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
+EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ON AN AS IS BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS
+TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+*/
+
+/*-
+ *
+ * getaddrinfo.h
+ *   Support getaddrinfo() on platforms that don't have it.
+ *
+ * Note: we use our own routines on platforms that don't HAVE_STRUCT_ADDRINFO,
+ * whether or not the library routine getaddrinfo() can be found.  This
+ * policy is needed because on some platforms a manually installed libbind.a
+ * may provide getaddrinfo(), yet the system headers may not provide the
+ * struct definitions needed to call it.  To avoid conflict with the libbind
+ * definition in such cases, we rename our routines to pg_xxx() via

svn commit: samba r25560 - in branches: SAMBA_3_2/source/lib/replace SAMBA_3_2_0/source/lib/replace

2007-10-06 Thread jra
Author: jra
Date: 2007-10-07 04:28:01 + (Sun, 07 Oct 2007)
New Revision: 25560

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

Log:
Merge from Jelmer. Define HAVE_* for other gai functions to prevent problems 
with libroken.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/lib/replace/libreplace.m4
   branches/SAMBA_3_2_0/source/lib/replace/libreplace.m4


Changeset:
Modified: branches/SAMBA_3_2/source/lib/replace/libreplace.m4
===
--- branches/SAMBA_3_2/source/lib/replace/libreplace.m4 2007-10-07 04:23:06 UTC 
(rev 25559)
+++ branches/SAMBA_3_2/source/lib/replace/libreplace.m4 2007-10-07 04:28:01 UTC 
(rev 25560)
@@ -173,6 +173,8 @@
 samba_cv_HAVE_GETADDRINFO=yes,samba_cv_HAVE_GETADDRINFO=no)])
 if test x$samba_cv_HAVE_GETADDRINFO = xyes; then
 AC_DEFINE(HAVE_GETADDRINFO,1,[Whether the system has getaddrinfo and 
getnameinfo])
+AC_DEFINE(HAVE_FREEADDRINFO,1,[Whether the system has freeaddrinfo])
+AC_DEFINE(HAVE_GAI_STRERROR,1,[Whether the system has gai_strerror])
 fi
 
 

Modified: branches/SAMBA_3_2_0/source/lib/replace/libreplace.m4
===
--- branches/SAMBA_3_2_0/source/lib/replace/libreplace.m4   2007-10-07 
04:23:06 UTC (rev 25559)
+++ branches/SAMBA_3_2_0/source/lib/replace/libreplace.m4   2007-10-07 
04:28:01 UTC (rev 25560)
@@ -173,6 +173,8 @@
 samba_cv_HAVE_GETADDRINFO=yes,samba_cv_HAVE_GETADDRINFO=no)])
 if test x$samba_cv_HAVE_GETADDRINFO = xyes; then
 AC_DEFINE(HAVE_GETADDRINFO,1,[Whether the system has getaddrinfo and 
getnameinfo])
+AC_DEFINE(HAVE_FREEADDRINFO,1,[Whether the system has freeaddrinfo])
+AC_DEFINE(HAVE_GAI_STRERROR,1,[Whether the system has gai_strerror])
 fi
 
 



svn commit: samba r25505 - in branches: SAMBA_3_2/source SAMBA_3_2/source/lib SAMBA_3_2/source/lib/replace SAMBA_3_2/source/lib/replace/system SAMBA_3_2_0/source SAMBA_3_2_0/source/lib SAMBA_3_2_0/sou

2007-10-04 Thread jra
Author: jra
Date: 2007-10-04 17:20:49 + (Thu, 04 Oct 2007)
New Revision: 25505

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

Log:
Add a replacement (IPv4 only) implementation of getaddrinfo/freeaddrinfo
under the 2 clause *BSD license for future use in IPv6 code. Original
code was from PostgreSQL and I've maintained their license even though
I've rewritten large parts of it (I probably should donate this back
to them).
Jeremy.

Added:
   branches/SAMBA_3_2/source/lib/replace/getaddrinfo.c
   branches/SAMBA_3_2/source/lib/replace/system/getaddrinfo.h
Modified:
   branches/SAMBA_3_2/source/configure.in
   branches/SAMBA_3_2/source/lib/replace/replace.h
   branches/SAMBA_3_2/source/lib/replace/system/network.h
   branches/SAMBA_3_2/source/lib/system.c
   branches/SAMBA_3_2/source/lib/util.c
   branches/SAMBA_3_2_0/source/configure.in
   branches/SAMBA_3_2_0/source/lib/replace/replace.h
   branches/SAMBA_3_2_0/source/lib/replace/system/network.h
   branches/SAMBA_3_2_0/source/lib/system.c
   branches/SAMBA_3_2_0/source/lib/util.c


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


svn commit: samba r25507 - in branches: SAMBA_3_2/source SAMBA_3_2/source/lib/replace/system SAMBA_3_2_0/source SAMBA_3_2_0/source/lib/replace/system

2007-10-04 Thread jra
Author: jra
Date: 2007-10-04 17:35:12 + (Thu, 04 Oct 2007)
New Revision: 25507

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

Log:
Fix definition of struct sockaddr_storage if
struct sockaddr_in6 is defined.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/configure.in
   branches/SAMBA_3_2/source/lib/replace/system/network.h
   branches/SAMBA_3_2_0/source/configure.in
   branches/SAMBA_3_2_0/source/lib/replace/system/network.h


Changeset:
Modified: branches/SAMBA_3_2/source/configure.in
===
--- branches/SAMBA_3_2/source/configure.in  2007-10-04 17:25:41 UTC (rev 
25506)
+++ branches/SAMBA_3_2/source/configure.in  2007-10-04 17:35:12 UTC (rev 
25507)
@@ -3195,7 +3195,7 @@
 fi
 
 dnl test for struct sockaddr_storage
-AC_CACHE_CHECK([for ipv6 support],samba_cv_HAVE_STRUCT_SOCKADDR_STORAGE,[
+AC_CACHE_CHECK([for struct 
sockaddr_storage],samba_cv_HAVE_STRUCT_SOCKADDR_STORAGE,[
 AC_TRY_COMPILE([
 #include sys/socket.h
 #include sys/types.h],
@@ -3207,6 +3207,19 @@
 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE,1,[Whether the system has struct 
sockaddr_storage])
 fi
 
+dnl test for struct struct sockaddr_in6
+AC_CACHE_CHECK([for struct sockaddr_in6],samba_cv_HAVE_STRUCT_SOCKADDR_IN6,[
+AC_TRY_COMPILE([
+#include sys/socket.h
+#include sys/types.h],
+[
+struct sockaddr_in6 sa6;
+],
+samba_cv_HAVE_STRUCT_SOCKADDR_IN6=yes,samba_cv_HAVE_STRUCT_SOCKADDR_IN6=no)])
+if test x$samba_cv_HAVE_STRUCT_SOCKADDR_IN6 = xyes; then
+AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6,1,[Whether the system has struct 
sockaddr_in6])
+fi
+
 dnl test for struct addrinfo
 AC_CACHE_CHECK([for struct addrinfo],samba_cv_HAVE_STRUCT_ADDRINFO,[
 AC_TRY_COMPILE([

Modified: branches/SAMBA_3_2/source/lib/replace/system/network.h
===
--- branches/SAMBA_3_2/source/lib/replace/system/network.h  2007-10-04 
17:25:41 UTC (rev 25506)
+++ branches/SAMBA_3_2/source/lib/replace/system/network.h  2007-10-04 
17:35:12 UTC (rev 25507)
@@ -127,9 +127,14 @@
 #endif
 
 #ifndef HAVE_STRUCT_SOCKADDR_STORAGE
+#ifdef HAVE_STRUCT_SOCKADDR_IN6
+#define sockaddr_storage sockaddr_in6
+#define ss_family sin6_family
+#else
 #define sockaddr_storage sockaddr_in
 #define ss_family sin_family
 #endif
+#endif
 
 #ifndef HOST_NAME_MAX
 #define HOST_NAME_MAX 256

Modified: branches/SAMBA_3_2_0/source/configure.in
===
--- branches/SAMBA_3_2_0/source/configure.in2007-10-04 17:25:41 UTC (rev 
25506)
+++ branches/SAMBA_3_2_0/source/configure.in2007-10-04 17:35:12 UTC (rev 
25507)
@@ -3066,7 +3066,7 @@
 fi
 
 dnl test for struct sockaddr_storage
-AC_CACHE_CHECK([for ipv6 support],samba_cv_HAVE_STRUCT_SOCKADDR_STORAGE,[
+AC_CACHE_CHECK([for struct 
sockaddr_storage],samba_cv_HAVE_STRUCT_SOCKADDR_STORAGE,[
 AC_TRY_COMPILE([
 #include sys/socket.h
 #include sys/types.h],
@@ -3078,6 +3078,19 @@
 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE,1,[Whether the system has struct 
sockaddr_storage])
 fi
 
+dnl test for struct struct sockaddr_in6
+AC_CACHE_CHECK([for struct sockaddr_in6],samba_cv_HAVE_STRUCT_SOCKADDR_IN6,[
+AC_TRY_COMPILE([
+#include sys/socket.h
+#include sys/types.h],
+[
+struct sockaddr_in6 sa6;
+],
+samba_cv_HAVE_STRUCT_SOCKADDR_IN6=yes,samba_cv_HAVE_STRUCT_SOCKADDR_IN6=no)])
+if test x$samba_cv_HAVE_STRUCT_SOCKADDR_IN6 = xyes; then
+AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6,1,[Whether the system has struct 
sockaddr_in6])
+fi
+
 dnl test for struct addrinfo
 AC_CACHE_CHECK([for struct addrinfo],samba_cv_HAVE_STRUCT_ADDRINFO,[
 AC_TRY_COMPILE([

Modified: branches/SAMBA_3_2_0/source/lib/replace/system/network.h
===
--- branches/SAMBA_3_2_0/source/lib/replace/system/network.h2007-10-04 
17:25:41 UTC (rev 25506)
+++ branches/SAMBA_3_2_0/source/lib/replace/system/network.h2007-10-04 
17:35:12 UTC (rev 25507)
@@ -127,9 +127,14 @@
 #endif
 
 #ifndef HAVE_STRUCT_SOCKADDR_STORAGE
+#ifdef HAVE_STRUCT_SOCKADDR_IN6
+#define sockaddr_storage sockaddr_in6
+#define ss_family sin6_family
+#else
 #define sockaddr_storage sockaddr_in
 #define ss_family sin_family
 #endif
+#endif
 
 #ifndef HOST_NAME_MAX
 #define HOST_NAME_MAX 256



svn commit: samba r25506 - in branches/SAMBA_3_2_0/source/lib/replace: . system

2007-10-04 Thread jra
Author: jra
Date: 2007-10-04 17:25:41 + (Thu, 04 Oct 2007)
New Revision: 25506

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

Log:
Add files I forgot in last commit.
Jeremy.

Added:
   branches/SAMBA_3_2_0/source/lib/replace/getaddrinfo.c
   branches/SAMBA_3_2_0/source/lib/replace/system/getaddrinfo.h


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


svn commit: samba r25508 - in branches: SAMBA_3_2/source/lib SAMBA_3_2_0/source/lib

2007-10-04 Thread jra
Author: jra
Date: 2007-10-04 18:23:22 + (Thu, 04 Oct 2007)
New Revision: 25508

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

Log:
Reformatting.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/lib/interface.c
   branches/SAMBA_3_2_0/source/lib/interface.c


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


svn commit: samba r25510 - in branches: SAMBA_3_2/source/lib SAMBA_3_2/source/libsmb SAMBA_3_2_0/source/lib SAMBA_3_2_0/source/libsmb

2007-10-04 Thread jra
Author: jra
Date: 2007-10-05 01:11:33 + (Fri, 05 Oct 2007)
New Revision: 25510

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

Log:
Now we're returning the port instead of using a global,
remember to use ntohs. Hopefully will fix the build farm.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/lib/util_sock.c
   branches/SAMBA_3_2/source/libsmb/nmblib.c
   branches/SAMBA_3_2_0/source/lib/util_sock.c
   branches/SAMBA_3_2_0/source/libsmb/nmblib.c


Changeset:
Modified: branches/SAMBA_3_2/source/lib/util_sock.c
===
--- branches/SAMBA_3_2/source/lib/util_sock.c   2007-10-04 23:20:30 UTC (rev 
25509)
+++ branches/SAMBA_3_2/source/lib/util_sock.c   2007-10-05 01:11:33 UTC (rev 
25510)
@@ -319,12 +319,12 @@
}
 
if (psa-ss_family != AF_INET) {
-   DEBUG(2,(read_udp_v4_socket:: invalid address family %d 
+   DEBUG(2,(read_udp_v4_socket: invalid address family %d 
(not IPv4)\n, (int)psa-ss_family));
return 0;
}
 
-   DEBUG(10,(read_udp_socket: ip %s port %d read: %lu\n,
+   DEBUG(10,(read_udp_v4_socket: ip %s port %d read: %lu\n,
inet_ntoa(si-sin_addr),
si-sin_port,
(unsigned long)ret));

Modified: branches/SAMBA_3_2/source/libsmb/nmblib.c
===
--- branches/SAMBA_3_2/source/libsmb/nmblib.c   2007-10-04 23:20:30 UTC (rev 
25509)
+++ branches/SAMBA_3_2/source/libsmb/nmblib.c   2007-10-05 01:11:33 UTC (rev 
25510)
@@ -789,7 +789,7 @@
length,
packet_type,
si-sin_addr,
-   si-sin_port);
+   ntohs(si-sin_port));
if (!packet)
return NULL;
 

Modified: branches/SAMBA_3_2_0/source/lib/util_sock.c
===
--- branches/SAMBA_3_2_0/source/lib/util_sock.c 2007-10-04 23:20:30 UTC (rev 
25509)
+++ branches/SAMBA_3_2_0/source/lib/util_sock.c 2007-10-05 01:11:33 UTC (rev 
25510)
@@ -319,12 +319,12 @@
}
 
if (psa-ss_family != AF_INET) {
-   DEBUG(2,(read_udp_v4_socket:: invalid address family %d 
+   DEBUG(2,(read_udp_v4_socket: invalid address family %d 
(not IPv4)\n, (int)psa-ss_family));
return 0;
}
 
-   DEBUG(10,(read_udp_socket: ip %s port %d read: %lu\n,
+   DEBUG(10,(read_udp_v4_socket: ip %s port %d read: %lu\n,
inet_ntoa(si-sin_addr),
si-sin_port,
(unsigned long)ret));

Modified: branches/SAMBA_3_2_0/source/libsmb/nmblib.c
===
--- branches/SAMBA_3_2_0/source/libsmb/nmblib.c 2007-10-04 23:20:30 UTC (rev 
25509)
+++ branches/SAMBA_3_2_0/source/libsmb/nmblib.c 2007-10-05 01:11:33 UTC (rev 
25510)
@@ -789,7 +789,7 @@
length,
packet_type,
si-sin_addr,
-   si-sin_port);
+   ntohs(si-sin_port));
if (!packet)
return NULL;
 



svn commit: samba r25511 - in branches: SAMBA_3_2/source SAMBA_3_2_0/source

2007-10-04 Thread jra
Author: jra
Date: 2007-10-05 02:03:29 + (Fri, 05 Oct 2007)
New Revision: 25511

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

Log:
Fix sockaddr_in6 detection.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/configure.in
   branches/SAMBA_3_2_0/source/configure.in


Changeset:
Modified: branches/SAMBA_3_2/source/configure.in
===
--- branches/SAMBA_3_2/source/configure.in  2007-10-05 01:11:33 UTC (rev 
25510)
+++ branches/SAMBA_3_2/source/configure.in  2007-10-05 02:03:29 UTC (rev 
25511)
@@ -3198,7 +3198,8 @@
 AC_CACHE_CHECK([for struct 
sockaddr_storage],samba_cv_HAVE_STRUCT_SOCKADDR_STORAGE,[
 AC_TRY_COMPILE([
 #include sys/socket.h
-#include sys/types.h],
+#include sys/types.h
+#include netinet/in.h],
 [
 struct sockaddr_storage sa_store;
 ],
@@ -3211,7 +3212,8 @@
 AC_CACHE_CHECK([for struct sockaddr_in6],samba_cv_HAVE_STRUCT_SOCKADDR_IN6,[
 AC_TRY_COMPILE([
 #include sys/socket.h
-#include sys/types.h],
+#include sys/types.h
+#include netinet/in.h],
 [
 struct sockaddr_in6 sa6;
 ],

Modified: branches/SAMBA_3_2_0/source/configure.in
===
--- branches/SAMBA_3_2_0/source/configure.in2007-10-05 01:11:33 UTC (rev 
25510)
+++ branches/SAMBA_3_2_0/source/configure.in2007-10-05 02:03:29 UTC (rev 
25511)
@@ -3069,7 +3069,8 @@
 AC_CACHE_CHECK([for struct 
sockaddr_storage],samba_cv_HAVE_STRUCT_SOCKADDR_STORAGE,[
 AC_TRY_COMPILE([
 #include sys/socket.h
-#include sys/types.h],
+#include sys/types.h
+#include netinet/in.h],
 [
 struct sockaddr_storage sa_store;
 ],
@@ -3082,7 +3083,8 @@
 AC_CACHE_CHECK([for struct sockaddr_in6],samba_cv_HAVE_STRUCT_SOCKADDR_IN6,[
 AC_TRY_COMPILE([
 #include sys/socket.h
-#include sys/types.h],
+#include sys/types.h
+#include netinet/in.h],
 [
 struct sockaddr_in6 sa6;
 ],



svn commit: samba r25487 - in branches: SAMBA_3_2/source SAMBA_3_2/source/lib/replace/system SAMBA_3_2_0/source SAMBA_3_2_0/source/lib/replace/system

2007-10-03 Thread jra
Author: jra
Date: 2007-10-03 19:12:39 + (Wed, 03 Oct 2007)
New Revision: 25487

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

Log:
Try fix the build - fix socklen_t and sa_family_t.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/configure.in
   branches/SAMBA_3_2/source/lib/replace/system/network.h
   branches/SAMBA_3_2_0/source/configure.in
   branches/SAMBA_3_2_0/source/lib/replace/system/network.h


Changeset:
Modified: branches/SAMBA_3_2/source/configure.in
===
--- branches/SAMBA_3_2/source/configure.in  2007-10-03 19:08:53 UTC (rev 
25486)
+++ branches/SAMBA_3_2/source/configure.in  2007-10-03 19:12:39 UTC (rev 
25487)
@@ -1082,7 +1082,6 @@
 AC_CHECK_TYPE(offset_t,loff_t)
 AC_CHECK_TYPE(ssize_t, int)
 AC_CHECK_TYPE(wchar_t, unsigned short)
-AC_CHECK_TYPE(socklen_t, int)
 AC_CHECK_TYPE(comparison_fn_t,
 [AC_DEFINE(HAVE_COMPARISON_FN_T, 1,[Whether or not we have comparison_fn_t])])
 
@@ -2502,6 +2501,16 @@
 AC_DEFINE(HAVE_UT_UT_EXIT,1,[Whether the utmp struct has a property 
ut_exit])
 fi
 
+dnl Look for the IPv6 varient by preference. Many systems have both.
+AC_CACHE_CHECK([for ut_addr_v6 in utmp],samba_cv_HAVE_UT_UT_ADDR_V6,[
+AC_TRY_COMPILE([#include sys/types.h
+#include utmp.h],
+[struct utmp ut;  ut.ut_addr_v6[0] = 0;],
+samba_cv_HAVE_UT_UT_ADDR_V6=yes,samba_cv_HAVE_UT_UT_ADDR_V6=no,samba_cv_HAVE_UT_UT_ADDR_V6=cross)])
+if test x$samba_cv_HAVE_UT_UT_ADDR_V6 = xyes; then
+AC_DEFINE(HAVE_UT_UT_ADDR_V6,1,[Whether the utmp struct has a property 
ut_addr_v6])
+fi
+
 AC_CACHE_CHECK([for ut_addr in utmp],samba_cv_HAVE_UT_UT_ADDR,[
 AC_TRY_COMPILE([#include sys/types.h
 #include utmp.h],
@@ -3039,11 +3048,29 @@
 SMB_CHECK_SYSCONF(_SC_PAGESIZE)
 AC_CHECK_FUNCS(getpagesize)
 
+dnl test for socklen_t
+AC_CACHE_CHECK([for socklen_t],samba_cv_HAVE_SA_FAMILY_T,[
+AC_TRY_COMPILE([
+#include sys/types.h
+#include unistd.h
+#include sys/socket.h
+#include netinet/in.h
+#include arpa/inet.h
+],
+[
+socklen_t foo;
+],
+samba_cv_HAVE_SOCKLEN_T=yes,samba_cv_HAVE_SOCKLEN_T=no)])
+if test x$samba_cv_HAVE_SOCKLEN_T = xyes; then
+AC_DEFINE(HAVE_SOCKLEN_T,1,[Whether the system has socklen_t])
+fi
+
 dnl test for sa_family_t
 AC_CACHE_CHECK([for sa_family_t],samba_cv_HAVE_SA_FAMILY_T,[
 AC_TRY_COMPILE([
+#include sys/types.h
+#include unistd.h
 #include sys/socket.h
-#include sys/types.h
 #include netinet/in.h
 #include arpa/inet.h
 ],
@@ -3158,6 +3185,20 @@
 AC_DEFINE(HAVE_IPV6,1,[Whether the system has IPv6 support])
 fi
 
+dnl test for struct sockaddr_storage
+AC_CACHE_CHECK([for ipv6 support],samba_cv_HAVE_SOCKADDR_STORAGE,[
+AC_TRY_COMPILE([
+#include sys/socket.h
+#include sys/types.h],
+[
+struct sockaddr_storage sa_store;
+],
+samba_cv_HAVE_SOCKADDR_STORAGE=yes,samba_cv_HAVE_SOCKADDR_STORAGE=no)])
+if test x$samba_cv_HAVE_SOCKADDR_STORAGE = xyes; then
+AC_DEFINE(HAVE_SOCKADDR_STORAGE,1,[Whether the system has struct 
sockaddr_storage])
+fi
+
+
 
 # look for a method of setting the effective uid
 seteuid=no;

Modified: branches/SAMBA_3_2/source/lib/replace/system/network.h
===
--- branches/SAMBA_3_2/source/lib/replace/system/network.h  2007-10-03 
19:08:53 UTC (rev 25486)
+++ branches/SAMBA_3_2/source/lib/replace/system/network.h  2007-10-03 
19:12:39 UTC (rev 25487)
@@ -118,8 +118,16 @@
 #define INET6_ADDRSTRLEN 46
 #endif
 
+#ifndef HAVE_SOCKLEN_T
+typedef int socklen_t;
+#endif
+
 #ifndef HAVE_SA_FAMILY_T
 typedef unsigned short int sa_family_t;
 #endif
 
+#ifndef HAVE_SOCKADDR_STORAGE
+#define sockaddr_storage sockaddr
 #endif
+
+#endif

Modified: branches/SAMBA_3_2_0/source/configure.in
===
--- branches/SAMBA_3_2_0/source/configure.in2007-10-03 19:08:53 UTC (rev 
25486)
+++ branches/SAMBA_3_2_0/source/configure.in2007-10-03 19:12:39 UTC (rev 
25487)
@@ -1006,7 +1006,6 @@
 AC_CHECK_TYPE(offset_t,loff_t)
 AC_CHECK_TYPE(ssize_t, int)
 AC_CHECK_TYPE(wchar_t, unsigned short)
-AC_CHECK_TYPE(socklen_t, int)
 AC_CHECK_TYPE(comparison_fn_t,
 [AC_DEFINE(HAVE_COMPARISON_FN_T, 1,[Whether or not we have comparison_fn_t])])
 
@@ -2390,6 +2389,16 @@
 AC_DEFINE(HAVE_UT_UT_EXIT,1,[Whether the utmp struct has a property 
ut_exit])
 fi
 
+dnl Look for the IPv6 varient by preference. Many systems have both.
+AC_CACHE_CHECK([for ut_addr_v6 in utmp],samba_cv_HAVE_UT_UT_ADDR_V6,[
+AC_TRY_COMPILE([#include sys/types.h
+#include utmp.h],
+[struct utmp ut;  ut.ut_addr_v6[0] = 0;],
+samba_cv_HAVE_UT_UT_ADDR_V6=yes,samba_cv_HAVE_UT_UT_ADDR_V6=no,samba_cv_HAVE_UT_UT_ADDR_V6=cross)])
+if test x$samba_cv_HAVE_UT_UT_ADDR_V6 = xyes; then
+AC_DEFINE(HAVE_UT_UT_ADDR_V6,1,[Whether the utmp struct has a property 
ut_addr_v6])
+fi
+
 AC_CACHE_CHECK([for ut_addr in utmp],samba_cv_HAVE_UT_UT_ADDR,[
 AC_TRY_COMPILE

svn commit: samba r25495 - in branches: SAMBA_3_2/source/lib/replace/system SAMBA_3_2_0/source/lib/replace/system

2007-10-03 Thread jra
Author: jra
Date: 2007-10-03 22:01:25 + (Wed, 03 Oct 2007)
New Revision: 25495

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

Log:
Fixup definitions for missing sockaddr_storage.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/lib/replace/system/network.h
   branches/SAMBA_3_2_0/source/lib/replace/system/network.h


Changeset:
Modified: branches/SAMBA_3_2/source/lib/replace/system/network.h
===
--- branches/SAMBA_3_2/source/lib/replace/system/network.h  2007-10-03 
21:14:20 UTC (rev 25494)
+++ branches/SAMBA_3_2/source/lib/replace/system/network.h  2007-10-03 
22:01:25 UTC (rev 25495)
@@ -127,7 +127,8 @@
 #endif
 
 #ifndef HAVE_SOCKADDR_STORAGE
-#define sockaddr_storage sockaddr
+#define sockaddr_storage sockaddr_in
+#define ss_family sin_family
 #endif
 
 #endif

Modified: branches/SAMBA_3_2_0/source/lib/replace/system/network.h
===
--- branches/SAMBA_3_2_0/source/lib/replace/system/network.h2007-10-03 
21:14:20 UTC (rev 25494)
+++ branches/SAMBA_3_2_0/source/lib/replace/system/network.h2007-10-03 
22:01:25 UTC (rev 25495)
@@ -127,7 +127,8 @@
 #endif
 
 #ifndef HAVE_SOCKADDR_STORAGE
-#define sockaddr_storage sockaddr
+#define sockaddr_storage sockaddr_in
+#define ss_family sin_family
 #endif
 
 #endif



svn commit: samba r25472 - in branches: SAMBA_3_2/source SAMBA_3_2/source/include SAMBA_3_2/source/lib SAMBA_3_2/source/lib/replace SAMBA_3_2/source/lib/replace/system SAMBA_3_2/source/utils SAMBA_3_2

2007-10-02 Thread jra
Author: jra
Date: 2007-10-02 19:27:25 + (Tue, 02 Oct 2007)
New Revision: 25472

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

Log:
Fix the interfaces code to detect IPv6 interfaces, using the
new standard getifaddrs() and freeifaddrs() interfaces. Currently
we only return IPv4 af_families. Needs fixing for binds to IPv6
but this has to be careful work.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/configure.in
   branches/SAMBA_3_2/source/include/includes.h
   branches/SAMBA_3_2/source/include/interfaces.h
   branches/SAMBA_3_2/source/lib/interface.c
   branches/SAMBA_3_2/source/lib/interfaces.c
   branches/SAMBA_3_2/source/lib/replace/replace.h
   branches/SAMBA_3_2/source/lib/replace/system/network.h
   branches/SAMBA_3_2/source/lib/util.c
   branches/SAMBA_3_2/source/utils/net_dns.c
   branches/SAMBA_3_2_0/source/configure.in
   branches/SAMBA_3_2_0/source/include/includes.h
   branches/SAMBA_3_2_0/source/include/interfaces.h
   branches/SAMBA_3_2_0/source/lib/interface.c
   branches/SAMBA_3_2_0/source/lib/interfaces.c
   branches/SAMBA_3_2_0/source/lib/replace/replace.h
   branches/SAMBA_3_2_0/source/lib/replace/system/network.h
   branches/SAMBA_3_2_0/source/lib/util.c
   branches/SAMBA_3_2_0/source/utils/net_dns.c


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


svn commit: samba r25473 - in branches: SAMBA_3_2/source/lib SAMBA_3_2_0/source/lib

2007-10-02 Thread jra
Author: jra
Date: 2007-10-02 19:50:53 + (Tue, 02 Oct 2007)
New Revision: 25473

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

Log:
Reformatting only. Prepare for new ip functions.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/lib/util_sock.c
   branches/SAMBA_3_2_0/source/lib/util_sock.c


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


svn commit: samba r25474 - in branches: SAMBA_3_2/source/include SAMBA_3_2/source/lib/replace/system SAMBA_3_2_0/source/include SAMBA_3_2_0/source/lib/replace/system

2007-10-02 Thread jra
Author: jra
Date: 2007-10-02 20:04:14 + (Tue, 02 Oct 2007)
New Revision: 25474

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

Log:
Try and fix the build on Mac OS X 10.4.9.
Shuffle sa_family_t around.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/include/includes.h
   branches/SAMBA_3_2/source/lib/replace/system/network.h
   branches/SAMBA_3_2_0/source/include/includes.h
   branches/SAMBA_3_2_0/source/lib/replace/system/network.h


Changeset:
Modified: branches/SAMBA_3_2/source/include/includes.h
===
--- branches/SAMBA_3_2/source/include/includes.h2007-10-02 19:50:53 UTC 
(rev 25473)
+++ branches/SAMBA_3_2/source/include/includes.h2007-10-02 20:04:14 UTC 
(rev 25474)
@@ -1262,8 +1262,4 @@
 #include libnscd.h
 #endif
 
-#ifndef HAVE_SA_FAMILY_T
-typedef unsigned short int sa_family_t;
-#endif
-
 #endif /* _INCLUDES_H */

Modified: branches/SAMBA_3_2/source/lib/replace/system/network.h
===
--- branches/SAMBA_3_2/source/lib/replace/system/network.h  2007-10-02 
19:50:53 UTC (rev 25473)
+++ branches/SAMBA_3_2/source/lib/replace/system/network.h  2007-10-02 
20:04:14 UTC (rev 25474)
@@ -118,4 +118,8 @@
 #define INET6_ADDRSTRLEN 46
 #endif
 
+#ifndef HAVE_SA_FAMILY_T
+typedef unsigned short int sa_family_t;
 #endif
+
+#endif

Modified: branches/SAMBA_3_2_0/source/include/includes.h
===
--- branches/SAMBA_3_2_0/source/include/includes.h  2007-10-02 19:50:53 UTC 
(rev 25473)
+++ branches/SAMBA_3_2_0/source/include/includes.h  2007-10-02 20:04:14 UTC 
(rev 25474)
@@ -1265,8 +1265,4 @@
 #include libnscd.h
 #endif
 
-#ifndef HAVE_SA_FAMILY_T
-typedef unsigned short int sa_family_t;
-#endif
-
 #endif /* _INCLUDES_H */

Modified: branches/SAMBA_3_2_0/source/lib/replace/system/network.h
===
--- branches/SAMBA_3_2_0/source/lib/replace/system/network.h2007-10-02 
19:50:53 UTC (rev 25473)
+++ branches/SAMBA_3_2_0/source/lib/replace/system/network.h2007-10-02 
20:04:14 UTC (rev 25474)
@@ -118,4 +118,8 @@
 #define INET6_ADDRSTRLEN 46
 #endif
 
+#ifndef HAVE_SA_FAMILY_T
+typedef unsigned short int sa_family_t;
 #endif
+
+#endif



svn commit: samba r25475 - in branches: SAMBA_3_2/source/lib SAMBA_3_2_0/source/lib

2007-10-02 Thread jra
Author: jra
Date: 2007-10-02 20:39:41 + (Tue, 02 Oct 2007)
New Revision: 25475

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

Log:
Fix braindead mistakes I made pointed out by Simo and
James (how did this compile ? :-).
Jeremy.

Modified:
   branches/SAMBA_3_2/source/lib/interfaces.c
   branches/SAMBA_3_2_0/source/lib/interfaces.c


Changeset:
Modified: branches/SAMBA_3_2/source/lib/interfaces.c
===
--- branches/SAMBA_3_2/source/lib/interfaces.c  2007-10-02 20:04:14 UTC (rev 
25474)
+++ branches/SAMBA_3_2/source/lib/interfaces.c  2007-10-02 20:39:41 UTC (rev 
25475)
@@ -102,7 +102,7 @@
struct ifaddrs *ifptr = NULL;
int total = 0;
 
-   if (getifaddrs(ifp)  0) {
+   if (getifaddrs(iflist)  0) {
return -1;
}
 
@@ -111,6 +111,10 @@
ifptr != NULL  total  max_interfaces;
ifptr = ifptr-ifa_next) {
 
+   if (!ifptr-ifa_addr || !ifptr-ifa_netmask) {
+   continue;
+   }
+
/* Skip ipv6 for now. */
if (ifptr-ifa_addr-sa_family != AF_INET) {
continue;
@@ -125,7 +129,7 @@
((struct sockaddr_in *)ifptr-ifa_addr).sin_addr;
 
ifaces[total].iface_netmask.netmask =
-   ((struct sockaddr_in *)ifptr-ifa_addr)-sin_addr;
+   ((struct sockaddr_in *)ifptr-ifa_netmask)-sin_addr;
 
strncpy(ifaces[total].name, ifptr-ifa_name,
sizeof(ifaces[total].name)-1);

Modified: branches/SAMBA_3_2_0/source/lib/interfaces.c
===
--- branches/SAMBA_3_2_0/source/lib/interfaces.c2007-10-02 20:04:14 UTC 
(rev 25474)
+++ branches/SAMBA_3_2_0/source/lib/interfaces.c2007-10-02 20:39:41 UTC 
(rev 25475)
@@ -102,7 +102,7 @@
struct ifaddrs *ifptr = NULL;
int total = 0;
 
-   if (getifaddrs(ifp)  0) {
+   if (getifaddrs(iflist)  0) {
return -1;
}
 
@@ -111,6 +111,10 @@
ifptr != NULL  total  max_interfaces;
ifptr = ifptr-ifa_next) {
 
+   if (!ifptr-ifa_addr || !ifptr-ifa_netmask) {
+   continue;
+   }
+
/* Skip ipv6 for now. */
if (ifptr-ifa_addr-sa_family != AF_INET) {
continue;
@@ -125,7 +129,7 @@
((struct sockaddr_in *)ifptr-ifa_addr).sin_addr;
 
ifaces[total].iface_netmask.netmask =
-   ((struct sockaddr_in *)ifptr-ifa_addr)-sin_addr;
+   ((struct sockaddr_in *)ifptr-ifa_netmask)-sin_addr;
 
strncpy(ifaces[total].name, ifptr-ifa_name,
sizeof(ifaces[total].name)-1);



svn commit: samba r25476 - in branches: SAMBA_3_2/source SAMBA_3_2/source/lib SAMBA_3_2_0/source SAMBA_3_2_0/source/lib

2007-10-02 Thread jra
Author: jra
Date: 2007-10-02 21:12:01 + (Tue, 02 Oct 2007)
New Revision: 25476

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

Log:
Finally fix up new interface detection code :-).
Jeremy.

Modified:
   branches/SAMBA_3_2/source/configure.in
   branches/SAMBA_3_2/source/lib/interfaces.c
   branches/SAMBA_3_2_0/source/configure.in
   branches/SAMBA_3_2_0/source/lib/interfaces.c


Changeset:
Modified: branches/SAMBA_3_2/source/configure.in
===
--- branches/SAMBA_3_2/source/configure.in  2007-10-02 20:39:41 UTC (rev 
25475)
+++ branches/SAMBA_3_2/source/configure.in  2007-10-02 21:12:01 UTC (rev 
25476)
@@ -3093,7 +3093,7 @@
 fi
 
 if test $iface = no; then
-AC_CACHE_CHECK([for iface getifaddrs],samba_cv_HAVE_GETIFADDRS,[
+AC_CACHE_CHECK([for iface getifaddrs],samba_cv_HAVE_IFACE_GETIFADDRS,[
 SAVE_CPPFLAGS=$CPPFLAGS
 CPPFLAGS=$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}
 AC_TRY_RUN([
@@ -3103,7 +3103,7 @@

samba_cv_HAVE_IFACE_GETIFADDRS=yes,samba_cv_HAVE_IFACE_GETIFADDRS=no,samba_cv_HAVE_IFACE_GETIFADDRS=cross)])
 CPPFLAGS=$SAVE_CPPFLAGS
 if test x$samba_cv_HAVE_IFACE_GETIFADDRS = xyes; then
-iface=yes;AC_DEFINE(HAVE_IFACE_GETIFADDRS,1,[Whether iface ifconf is 
available])
+iface=yes;AC_DEFINE(HAVE_IFACE_GETIFADDRS,1,[Whether iface getifaddrs is 
available])
 fi
 fi
 

Modified: branches/SAMBA_3_2/source/lib/interfaces.c
===
--- branches/SAMBA_3_2/source/lib/interfaces.c  2007-10-02 20:39:41 UTC (rev 
25475)
+++ branches/SAMBA_3_2/source/lib/interfaces.c  2007-10-02 21:12:01 UTC (rev 
25476)
@@ -126,7 +126,7 @@
ifaces[total].sa_family = ifptr-ifa_addr-sa_family;
 
ifaces[total].iface_addr.ip =
-   ((struct sockaddr_in *)ifptr-ifa_addr).sin_addr;
+   ((struct sockaddr_in *)ifptr-ifa_addr)-sin_addr;
 
ifaces[total].iface_netmask.netmask =
((struct sockaddr_in *)ifptr-ifa_netmask)-sin_addr;

Modified: branches/SAMBA_3_2_0/source/configure.in
===
--- branches/SAMBA_3_2_0/source/configure.in2007-10-02 20:39:41 UTC (rev 
25475)
+++ branches/SAMBA_3_2_0/source/configure.in2007-10-02 21:12:01 UTC (rev 
25476)
@@ -2973,7 +2973,7 @@
 fi
 
 if test $iface = no; then
-AC_CACHE_CHECK([for iface getifaddrs],samba_cv_HAVE_GETIFADDRS,[
+AC_CACHE_CHECK([for iface getifaddrs],samba_cv_HAVE_IFACE_GETIFADDRS,[
 SAVE_CPPFLAGS=$CPPFLAGS
 CPPFLAGS=$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}
 AC_TRY_RUN([
@@ -2983,7 +2983,7 @@

samba_cv_HAVE_IFACE_GETIFADDRS=yes,samba_cv_HAVE_IFACE_GETIFADDRS=no,samba_cv_HAVE_IFACE_GETIFADDRS=cross)])
 CPPFLAGS=$SAVE_CPPFLAGS
 if test x$samba_cv_HAVE_IFACE_GETIFADDRS = xyes; then
-iface=yes;AC_DEFINE(HAVE_IFACE_GETIFADDRS,1,[Whether iface ifconf is 
available])
+iface=yes;AC_DEFINE(HAVE_IFACE_GETIFADDRS,1,[Whether iface getifaddrs is 
available])
 fi
 fi
 

Modified: branches/SAMBA_3_2_0/source/lib/interfaces.c
===
--- branches/SAMBA_3_2_0/source/lib/interfaces.c2007-10-02 20:39:41 UTC 
(rev 25475)
+++ branches/SAMBA_3_2_0/source/lib/interfaces.c2007-10-02 21:12:01 UTC 
(rev 25476)
@@ -126,7 +126,7 @@
ifaces[total].sa_family = ifptr-ifa_addr-sa_family;
 
ifaces[total].iface_addr.ip =
-   ((struct sockaddr_in *)ifptr-ifa_addr).sin_addr;
+   ((struct sockaddr_in *)ifptr-ifa_addr)-sin_addr;
 
ifaces[total].iface_netmask.netmask =
((struct sockaddr_in *)ifptr-ifa_netmask)-sin_addr;



svn commit: samba r25445 - in branches: SAMBA_3_2/source SAMBA_3_2_0/source

2007-10-01 Thread jra
Author: jra
Date: 2007-10-01 18:30:01 + (Mon, 01 Oct 2007)
New Revision: 25445

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

Log:
Fix IPV6 detection.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/configure.in
   branches/SAMBA_3_2_0/source/configure.in


Changeset:
Modified: branches/SAMBA_3_2/source/configure.in
===
--- branches/SAMBA_3_2/source/configure.in  2007-10-01 15:49:56 UTC (rev 
25444)
+++ branches/SAMBA_3_2/source/configure.in  2007-10-01 18:30:01 UTC (rev 
25445)
@@ -3094,8 +3094,8 @@
 [
 struct sockaddr_storage sa_store;
 struct addrinfo *ai = NULL;
-int s = socket(AF_INET6, SOCK_STREAM, 0)
-int ret = getaddrinfo(NULL, NULL, NULL ai);
+int s = socket(AF_INET6, SOCK_STREAM, 0);
+int ret = getaddrinfo(NULL, NULL, NULL, ai);
 if (ret != 0) {
const char *es = gai_strerror(ret);
 }

Modified: branches/SAMBA_3_2_0/source/configure.in
===
--- branches/SAMBA_3_2_0/source/configure.in2007-10-01 15:49:56 UTC (rev 
25444)
+++ branches/SAMBA_3_2_0/source/configure.in2007-10-01 18:30:01 UTC (rev 
25445)
@@ -2974,8 +2974,8 @@
 [
 struct sockaddr_storage sa_store;
 struct addrinfo *ai = NULL;
-int s = socket(AF_INET6, SOCK_STREAM, 0)
-int ret = getaddrinfo(NULL, NULL, NULL ai);
+int s = socket(AF_INET6, SOCK_STREAM, 0);
+int ret = getaddrinfo(NULL, NULL, NULL, ai);
 if (ret != 0) {
const char *es = gai_strerror(ret);
 }



svn commit: samba r25455 - in branches: SAMBA_3_2/source/lib/replace SAMBA_3_2_0/source/lib/replace

2007-10-01 Thread jra
Author: jra
Date: 2007-10-01 23:18:26 + (Mon, 01 Oct 2007)
New Revision: 25455

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

Log:
Ensure we have inet_ntop and inet_pton available in lib/replace.
Jeremy.

Added:
   branches/SAMBA_3_2/source/lib/replace/inet_ntop.c
   branches/SAMBA_3_2/source/lib/replace/inet_ntop.m4
   branches/SAMBA_3_2/source/lib/replace/inet_pton.c
   branches/SAMBA_3_2/source/lib/replace/inet_pton.m4
   branches/SAMBA_3_2_0/source/lib/replace/inet_ntop.c
   branches/SAMBA_3_2_0/source/lib/replace/inet_ntop.m4
   branches/SAMBA_3_2_0/source/lib/replace/inet_pton.c
   branches/SAMBA_3_2_0/source/lib/replace/inet_pton.m4
Modified:
   branches/SAMBA_3_2/source/lib/replace/libreplace.m4
   branches/SAMBA_3_2/source/lib/replace/replace.h
   branches/SAMBA_3_2_0/source/lib/replace/libreplace.m4
   branches/SAMBA_3_2_0/source/lib/replace/replace.h


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


svn commit: samba r25431 - in branches: SAMBA_3_2/source SAMBA_3_2_0/source

2007-09-29 Thread jra
Author: jra
Date: 2007-09-29 23:43:24 + (Sat, 29 Sep 2007)
New Revision: 25431

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

Log:
Add detection for IPv6 support.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/configure.in
   branches/SAMBA_3_2_0/source/configure.in


Changeset:
Modified: branches/SAMBA_3_2/source/configure.in
===
--- branches/SAMBA_3_2/source/configure.in  2007-09-29 18:00:19 UTC (rev 
25430)
+++ branches/SAMBA_3_2/source/configure.in  2007-09-29 23:43:24 UTC (rev 
25431)
@@ -3085,6 +3085,26 @@
 fi
 fi
 
+dnl test for ipv6
+AC_CACHE_CHECK([for ipv6 support],samba_cv_HAVE_IPV6,[
+AC_TRY_COMPILE([
+#include sys/socket.h
+#include sys/types.h
+#include netdb.h],
+[
+struct sockaddr_storage sa_store;
+struct addrinfo *ai = NULL;
+int s = socket(AF_INET6, SOCK_STREAM, 0)
+int ret = getaddrinfo(NULL, NULL, NULL ai);
+if (ret != 0) {
+   const char *es = gai_strerror(ret);
+}
+freeaddrinfo(ai);
+],
+samba_cv_HAVE_IPV6=yes,samba_cv_HAVE_IPV6=no)])
+if test x$samba_cv_HAVE_IPV6 = xyes; then
+AC_DEFINE(HAVE_IPV6,1,[Whether the system has IPv6 support])
+fi
 
 
 # look for a method of setting the effective uid

Modified: branches/SAMBA_3_2_0/source/configure.in
===
--- branches/SAMBA_3_2_0/source/configure.in2007-09-29 18:00:19 UTC (rev 
25430)
+++ branches/SAMBA_3_2_0/source/configure.in2007-09-29 23:43:24 UTC (rev 
25431)
@@ -2956,6 +2956,26 @@
 fi
 fi
 
+dnl test for ipv6
+AC_CACHE_CHECK([for ipv6 support],samba_cv_HAVE_IPV6,[
+AC_TRY_COMPILE([
+#include sys/socket.h
+#include sys/types.h
+#include netdb.h],
+[
+struct sockaddr_storage sa_store;
+struct addrinfo *ai = NULL;
+int s = socket(AF_INET6, SOCK_STREAM, 0)
+int ret = getaddrinfo(NULL, NULL, NULL ai);
+if (ret != 0) {
+   const char *es = gai_strerror(ret);
+}
+freeaddrinfo(ai);
+],
+samba_cv_HAVE_IPV6=yes,samba_cv_HAVE_IPV6=no)])
+if test x$samba_cv_HAVE_IPV6 = xyes; then
+AC_DEFINE(HAVE_IPV6,1,[Whether the system has IPv6 support])
+fi
 
 
 # look for a method of setting the effective uid



svn commit: samba r25406 - in branches: SAMBA_3_2/source SAMBA_3_2/source/nsswitch SAMBA_3_2_0/source SAMBA_3_2_0/source/nsswitch

2007-09-28 Thread jra
Author: jra
Date: 2007-09-28 18:12:22 + (Fri, 28 Sep 2007)
New Revision: 25406

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

Log:
Make the Linux nss client code thread-safe.
Fix originally inspired from code from boyang [EMAIL PROTECTED].
Jeremy.

Modified:
   branches/SAMBA_3_2/source/Makefile.in
   branches/SAMBA_3_2/source/configure.in
   branches/SAMBA_3_2/source/nsswitch/winbind_nss_linux.c
   branches/SAMBA_3_2_0/source/Makefile.in
   branches/SAMBA_3_2_0/source/configure.in
   branches/SAMBA_3_2_0/source/nsswitch/winbind_nss_linux.c


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


svn commit: samba r25391 - in branches: SAMBA_3_0_MAINT/source/smbd SAMBA_3_2/source/smbd SAMBA_3_2_0/source/smbd

2007-09-27 Thread jra
Author: jra
Date: 2007-09-27 23:28:35 + (Thu, 27 Sep 2007)
New Revision: 25391

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

Log:
Fix bug #4978 : Store DOS Attributes fails when copying folders.
Jeremy.

Modified:
   branches/SAMBA_3_0_MAINT/source/smbd/open.c
   branches/SAMBA_3_2/source/smbd/open.c
   branches/SAMBA_3_2_0/source/smbd/open.c


Changeset:
Modified: branches/SAMBA_3_0_MAINT/source/smbd/open.c
===
--- branches/SAMBA_3_0_MAINT/source/smbd/open.c 2007-09-27 23:07:35 UTC (rev 
25390)
+++ branches/SAMBA_3_0_MAINT/source/smbd/open.c 2007-09-27 23:28:35 UTC (rev 
25391)
@@ -1939,6 +1939,7 @@
char *parent_dir;
const char *dirname;
NTSTATUS status;
+   BOOL posix_open = False;
 
if(!CAN_WRITE(conn)) {
DEBUG(5,(mkdir_internal: failing create on read-only share 
@@ -1957,6 +1958,7 @@
}
 
if (file_attributes  FILE_FLAG_POSIX_SEMANTICS) {
+   posix_open = True;
mode = (mode_t)(file_attributes  ~FILE_FLAG_POSIX_SEMANTICS);
} else {
mode = unix_mode(conn, aDIR, name, parent_dir);
@@ -1981,6 +1983,14 @@
return NT_STATUS_ACCESS_DENIED;
}
 
+   if (lp_store_dos_attributes(SNUM(conn))) {
+   if (!posix_open) {
+   file_set_dosmode(conn, name,
+file_attributes | aDIR, NULL,
+parent_dir);
+   }
+   }
+
if (lp_inherit_perms(SNUM(conn))) {
inherit_access_acl(conn, parent_dir, name, mode);
}

Modified: branches/SAMBA_3_2/source/smbd/open.c
===
--- branches/SAMBA_3_2/source/smbd/open.c   2007-09-27 23:07:35 UTC (rev 
25390)
+++ branches/SAMBA_3_2/source/smbd/open.c   2007-09-27 23:28:35 UTC (rev 
25391)
@@ -1983,6 +1983,7 @@
char *parent_dir;
const char *dirname;
NTSTATUS status;
+   bool posix_open = false;
 
if(!CAN_WRITE(conn)) {
DEBUG(5,(mkdir_internal: failing create on read-only share 
@@ -2001,6 +2002,7 @@
}
 
if (file_attributes  FILE_FLAG_POSIX_SEMANTICS) {
+   posix_open = true;
mode = (mode_t)(file_attributes  ~FILE_FLAG_POSIX_SEMANTICS);
} else {
mode = unix_mode(conn, aDIR, name, parent_dir);
@@ -2025,6 +2027,14 @@
return NT_STATUS_ACCESS_DENIED;
}
 
+   if (lp_store_dos_attributes(SNUM(conn))) {
+   if (!posix_open) {
+   file_set_dosmode(conn, name,
+file_attributes | aDIR, NULL,
+parent_dir);
+   }
+   }
+
if (lp_inherit_perms(SNUM(conn))) {
inherit_access_acl(conn, parent_dir, name, mode);
}

Modified: branches/SAMBA_3_2_0/source/smbd/open.c
===
--- branches/SAMBA_3_2_0/source/smbd/open.c 2007-09-27 23:07:35 UTC (rev 
25390)
+++ branches/SAMBA_3_2_0/source/smbd/open.c 2007-09-27 23:28:35 UTC (rev 
25391)
@@ -1987,6 +1987,7 @@
char *parent_dir;
const char *dirname;
NTSTATUS status;
+   bool posix_open = false;
 
if(!CAN_WRITE(conn)) {
DEBUG(5,(mkdir_internal: failing create on read-only share 
@@ -2005,6 +2006,7 @@
}
 
if (file_attributes  FILE_FLAG_POSIX_SEMANTICS) {
+   posix_open = true;
mode = (mode_t)(file_attributes  ~FILE_FLAG_POSIX_SEMANTICS);
} else {
mode = unix_mode(conn, aDIR, name, parent_dir);
@@ -2029,6 +2031,14 @@
return NT_STATUS_ACCESS_DENIED;
}
 
+   if (lp_store_dos_attributes(SNUM(conn))) {
+   if (!posix_open) {
+   file_set_dosmode(conn, name,
+file_attributes | aDIR, NULL,
+parent_dir);
+   }
+   }
+
if (lp_inherit_perms(SNUM(conn))) {
inherit_access_acl(conn, parent_dir, name, mode);
}



svn commit: samba r25389 - in branches: SAMBA_3_2/source/rpc_server SAMBA_3_2_0/source/rpc_server

2007-09-27 Thread jra
Author: jra
Date: 2007-09-27 22:55:11 + (Thu, 27 Sep 2007)
New Revision: 25389

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

Log:
Fix crash bug using DFS info struct uninitialized.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/rpc_server/srv_dfs_nt.c
   branches/SAMBA_3_2_0/source/rpc_server/srv_dfs_nt.c


Changeset:
Modified: branches/SAMBA_3_2/source/rpc_server/srv_dfs_nt.c
===
--- branches/SAMBA_3_2/source/rpc_server/srv_dfs_nt.c   2007-09-27 22:54:40 UTC 
(rev 25388)
+++ branches/SAMBA_3_2/source/rpc_server/srv_dfs_nt.c   2007-09-27 22:55:11 UTC 
(rev 25389)
@@ -379,10 +379,34 @@
vfs_ChDir(p-conn,p-conn-connectpath);
 
switch (r-in.level) {
-   case 1: ret = init_reply_dfs_info_1(ctx, jn, 
r-out.info-info1); break;
-   case 2: ret = init_reply_dfs_info_2(ctx, jn, 
r-out.info-info2); break;
-   case 3: ret = init_reply_dfs_info_3(ctx, jn, 
r-out.info-info3); break;
-   case 100: ret = init_reply_dfs_info_100(ctx, jn, 
r-out.info-info100); break;
+   case 1:
+   r-out.info-info1 = TALLOC_ZERO_P(ctx,struct 
dfs_Info1);
+   if (!r-out.info-info1) {
+   return WERR_NOMEM;
+   }
+   ret = init_reply_dfs_info_1(ctx, jn, 
r-out.info-info1);
+   break;
+   case 2:
+   r-out.info-info2 = TALLOC_ZERO_P(ctx,struct 
dfs_Info2);
+   if (!r-out.info-info2) {
+   return WERR_NOMEM;
+   }
+   ret = init_reply_dfs_info_2(ctx, jn, 
r-out.info-info2);
+   break;
+   case 3:
+   r-out.info-info3 = TALLOC_ZERO_P(ctx,struct 
dfs_Info3);
+   if (!r-out.info-info3) {
+   return WERR_NOMEM;
+   }
+   ret = init_reply_dfs_info_3(ctx, jn, 
r-out.info-info3);
+   break;
+   case 100:
+   r-out.info-info100 = TALLOC_ZERO_P(ctx,struct 
dfs_Info100);
+   if (!r-out.info-info100) {
+   return WERR_NOMEM;
+   }
+   ret = init_reply_dfs_info_100(ctx, jn, 
r-out.info-info100);
+   break;
default:
r-out.info-info1 = NULL;
return WERR_INVALID_PARAM;

Modified: branches/SAMBA_3_2_0/source/rpc_server/srv_dfs_nt.c
===
--- branches/SAMBA_3_2_0/source/rpc_server/srv_dfs_nt.c 2007-09-27 22:54:40 UTC 
(rev 25388)
+++ branches/SAMBA_3_2_0/source/rpc_server/srv_dfs_nt.c 2007-09-27 22:55:11 UTC 
(rev 25389)
@@ -379,10 +379,34 @@
vfs_ChDir(p-conn,p-conn-connectpath);
 
switch (r-in.level) {
-   case 1: ret = init_reply_dfs_info_1(ctx, jn, 
r-out.info-info1); break;
-   case 2: ret = init_reply_dfs_info_2(ctx, jn, 
r-out.info-info2); break;
-   case 3: ret = init_reply_dfs_info_3(ctx, jn, 
r-out.info-info3); break;
-   case 100: ret = init_reply_dfs_info_100(ctx, jn, 
r-out.info-info100); break;
+   case 1:
+   r-out.info-info1 = TALLOC_ZERO_P(ctx,struct 
dfs_Info1);
+   if (!r-out.info-info1) {
+   return WERR_NOMEM;
+   }
+   ret = init_reply_dfs_info_1(ctx, jn, 
r-out.info-info1);
+   break;
+   case 2:
+   r-out.info-info2 = TALLOC_ZERO_P(ctx,struct 
dfs_Info2);
+   if (!r-out.info-info2) {
+   return WERR_NOMEM;
+   }
+   ret = init_reply_dfs_info_2(ctx, jn, 
r-out.info-info2);
+   break;
+   case 3:
+   r-out.info-info3 = TALLOC_ZERO_P(ctx,struct 
dfs_Info3);
+   if (!r-out.info-info3) {
+   return WERR_NOMEM;
+   }
+   ret = init_reply_dfs_info_3(ctx, jn, 
r-out.info-info3);
+   break;
+   case 100:
+   r-out.info-info100 = TALLOC_ZERO_P(ctx,struct 
dfs_Info100);
+   if (!r-out.info-info100) {
+   return WERR_NOMEM;
+   }
+   ret = init_reply_dfs_info_100(ctx, jn, 
r-out.info-info100);
+   break;
default:
r-out.info-info1 = NULL;
return WERR_INVALID_PARAM;



svn commit: samba r25397 - in branches/SAMBA_3_0_MAINT/source/lib: .

2007-09-27 Thread jra
Author: jra
Date: 2007-09-28 01:07:07 + (Fri, 28 Sep 2007)
New Revision: 25397

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

Log:
Merge Very obvious fix from Martin Zielinski.
Jeremy.

Modified:
   branches/SAMBA_3_0_MAINT/source/lib/util.c


Changeset:
Modified: branches/SAMBA_3_0_MAINT/source/lib/util.c
===
--- branches/SAMBA_3_0_MAINT/source/lib/util.c  2007-09-28 01:02:11 UTC (rev 
25396)
+++ branches/SAMBA_3_0_MAINT/source/lib/util.c  2007-09-28 01:07:07 UTC (rev 
25397)
@@ -1237,6 +1237,7 @@
if (p) {
p++;
fstrcpy(my_domname, p);
+   return True;
}
 
return False;



svn commit: samba r25309 - in branches: SAMBA_3_0_MAINT/source/smbd SAMBA_3_2/source/smbd SAMBA_3_2_0/source/smbd

2007-09-24 Thread jra
Author: jra
Date: 2007-09-24 19:11:42 + (Mon, 24 Sep 2007)
New Revision: 25309

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

Log:
Volker's fix for bug #4984 - samba4 torture test
to follow. Ensure we don't prepend ./ as a root
directory - this is an invalid pathname for unix_convert().
Jeremy.

Modified:
   branches/SAMBA_3_0_MAINT/source/smbd/nttrans.c
   branches/SAMBA_3_2/source/smbd/nttrans.c
   branches/SAMBA_3_2_0/source/smbd/nttrans.c


Changeset:
Modified: branches/SAMBA_3_0_MAINT/source/smbd/nttrans.c
===
--- branches/SAMBA_3_0_MAINT/source/smbd/nttrans.c  2007-09-24 18:47:50 UTC 
(rev 25308)
+++ branches/SAMBA_3_0_MAINT/source/smbd/nttrans.c  2007-09-24 19:11:42 UTC 
(rev 25309)
@@ -543,7 +543,6 @@
 */
pstring rel_fname;
files_struct *dir_fsp = 
file_fsp(inbuf,smb_ntcreate_RootDirectoryFid);
-   size_t dir_name_len;
 
if(!dir_fsp) {
END_PROFILE(SMBntcreateX);
@@ -583,15 +582,18 @@
 */
 
pstrcpy( fname, dir_fsp-fsp_name );
-   dir_name_len = strlen(fname);
 
-   /*
-* Ensure it ends in a '\'.
-*/
+   if (ISDOT(fname)) {
+   fname[0] = '\0';
+   } else {
+   size_t dir_name_len = strlen(fname);
+   /*
+* Ensure it ends in a '\'.
+*/
 
-   if((fname[dir_name_len-1] != '\\')  (fname[dir_name_len-1] != 
'/')) {
-   pstrcat(fname, /);
-   dir_name_len++;
+   if((fname[dir_name_len-1] != '\\')  
(fname[dir_name_len-1] != '/')) {
+   pstrcat(fname, /);
+   }
}
 
srvstr_get_path(inbuf, rel_fname, smb_buf(inbuf), 
sizeof(rel_fname), 0, STR_TERMINATE, status);
@@ -1244,7 +1246,6 @@
 * This filename is relative to a directory fid.
 */
files_struct *dir_fsp = file_fsp(params,4);
-   size_t dir_name_len;
 
if(!dir_fsp) {
return ERROR_DOS(ERRDOS,ERRbadfid);
@@ -1272,15 +1273,18 @@
 */
 
pstrcpy( fname, dir_fsp-fsp_name );
-   dir_name_len = strlen(fname);
 
-   /*
-* Ensure it ends in a '\'.
-*/
+if (ISDOT(fname)) {
+   fname[0] = '\0';
+   } else {
+   size_t dir_name_len = strlen(fname);
+   /*
+* Ensure it ends in a '\'.
+*/
 
-   if((fname[dir_name_len-1] != '\\')  (fname[dir_name_len-1] != 
'/')) {
-   pstrcat(fname, /);
-   dir_name_len++;
+   if((fname[dir_name_len-1] != '\\')  
(fname[dir_name_len-1] != '/')) {
+   pstrcat(fname, /);
+   }
}
 
{

Modified: branches/SAMBA_3_2/source/smbd/nttrans.c
===
--- branches/SAMBA_3_2/source/smbd/nttrans.c2007-09-24 18:47:50 UTC (rev 
25308)
+++ branches/SAMBA_3_2/source/smbd/nttrans.c2007-09-24 19:11:42 UTC (rev 
25309)
@@ -586,7 +586,6 @@
char *rel_fname = NULL;
files_struct *dir_fsp = file_fsp(
SVAL(req-inbuf, smb_ntcreate_RootDirectoryFid));
-   size_t dir_name_len;
 
if(!dir_fsp) {
reply_doserror(req, ERRDOS, ERRbadfid);
@@ -629,29 +628,46 @@
return;
}
 
-   /*
-* Copy in the base directory name.
-*/
+   if (ISDOT(dir_fsp-fsp_name)) {
+   /*
+* We're at the toplevel dir, the final file name
+* must not contain ./, as this is filtered out
+* normally by srvstr_get_path and unix_convert
+* explicitly rejects paths containing ./.
+*/
+   fname = talloc_strdup(ctx,);
+   if (!fname) {
+   reply_nterror(req, NT_STATUS_NO_MEMORY);
+   END_PROFILE(SMBntcreateX);
+   return;
+   }
+   } else {
+   size_t dir_name_len = strlen(dir_fsp-fsp_name);
 
-   dir_name_len = strlen(dir_fsp-fsp_name);
-   fname = TALLOC_ARRAY(ctx, char, dir_name_len+2);
-   if (!fname) {
-   reply_nterror

svn commit: samba r25273 - in branches: SAMBA_3_2/source/winbindd SAMBA_3_2_0/source/winbindd

2007-09-21 Thread jra
Author: jra
Date: 2007-09-21 09:58:36 + (Fri, 21 Sep 2007)
New Revision: 25273

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

Log:
unistrX_to_ascii calls pull_ucs2 - ensure it's never
called with -1 (these calls were wrong anyway, target
was an fstring, not a pstring). Found by  Michael Adam [EMAIL PROTECTED],
now to check all other uses.
Michael - this version uses sizeof(target) not sizeof(fstring).
This way is more future proof.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/winbindd/winbindd_pam.c
   branches/SAMBA_3_2_0/source/winbindd/winbindd_pam.c


Changeset:
Modified: branches/SAMBA_3_2/source/winbindd/winbindd_pam.c
===
--- branches/SAMBA_3_2/source/winbindd/winbindd_pam.c   2007-09-21 09:52:28 UTC 
(rev 25272)
+++ branches/SAMBA_3_2/source/winbindd/winbindd_pam.c   2007-09-21 09:58:36 UTC 
(rev 25273)
@@ -61,22 +61,22 @@
state-response.data.auth.info3.num_other_sids = info3-num_other_sids;
 
unistr2_to_ascii(state-response.data.auth.info3.user_name, 
-   info3-uni_user_name, sizeof(fstring));
+   info3-uni_user_name, 
sizeof(state-response.data.auth.info3.user_name));
unistr2_to_ascii(state-response.data.auth.info3.full_name, 
-   info3-uni_full_name, sizeof(fstring));
+   info3-uni_full_name, 
sizeof(state-response.data.auth.info3.full_name));
unistr2_to_ascii(state-response.data.auth.info3.logon_script, 
-   info3-uni_logon_script, sizeof(fstring));
+   info3-uni_logon_script, 
sizeof(state-response.data.auth.info3.logon_script));
unistr2_to_ascii(state-response.data.auth.info3.profile_path, 
-   info3-uni_profile_path, sizeof(fstring));
+   info3-uni_profile_path, 
sizeof(state-response.data.auth.info3.profile_path));
unistr2_to_ascii(state-response.data.auth.info3.home_dir, 
-   info3-uni_home_dir, sizeof(fstring));
+   info3-uni_home_dir, 
sizeof(state-response.data.auth.info3.home_dir));
unistr2_to_ascii(state-response.data.auth.info3.dir_drive, 
-   info3-uni_dir_drive, sizeof(fstring));
+   info3-uni_dir_drive, 
sizeof(state-response.data.auth.info3.dir_drive));
 
unistr2_to_ascii(state-response.data.auth.info3.logon_srv, 
-   info3-uni_logon_srv, sizeof(fstring));
+   info3-uni_logon_srv, 
sizeof(state-response.data.auth.info3.logon_srv));
unistr2_to_ascii(state-response.data.auth.info3.logon_dom, 
-   info3-uni_logon_dom, sizeof(fstring));
+   info3-uni_logon_dom, 
sizeof(state-response.data.auth.info3.logon_dom));
 
return NT_STATUS_OK;
 }

Modified: branches/SAMBA_3_2_0/source/winbindd/winbindd_pam.c
===
--- branches/SAMBA_3_2_0/source/winbindd/winbindd_pam.c 2007-09-21 09:52:28 UTC 
(rev 25272)
+++ branches/SAMBA_3_2_0/source/winbindd/winbindd_pam.c 2007-09-21 09:58:36 UTC 
(rev 25273)
@@ -61,22 +61,22 @@
state-response.data.auth.info3.num_other_sids = info3-num_other_sids;
 
unistr2_to_ascii(state-response.data.auth.info3.user_name, 
-   info3-uni_user_name, sizeof(fstring));
+   info3-uni_user_name, 
sizeof(state-response.data.auth.info3.user_name));
unistr2_to_ascii(state-response.data.auth.info3.full_name, 
-   info3-uni_full_name, sizeof(fstring));
+   info3-uni_full_name, 
sizeof(state-response.data.auth.info3.full_name));
unistr2_to_ascii(state-response.data.auth.info3.logon_script, 
-   info3-uni_logon_script, sizeof(fstring));
+   info3-uni_logon_script, 
sizeof(state-response.data.auth.info3.logon_script));
unistr2_to_ascii(state-response.data.auth.info3.profile_path, 
-   info3-uni_profile_path, sizeof(fstring));
+   info3-uni_profile_path, 
sizeof(state-response.data.auth.info3.profile_path));
unistr2_to_ascii(state-response.data.auth.info3.home_dir, 
-   info3-uni_home_dir, sizeof(fstring));
+   info3-uni_home_dir, 
sizeof(state-response.data.auth.info3.home_dir));
unistr2_to_ascii(state-response.data.auth.info3.dir_drive, 
-   info3-uni_dir_drive, sizeof(fstring));
+   info3-uni_dir_drive, 
sizeof(state-response.data.auth.info3.dir_drive));
 
unistr2_to_ascii(state-response.data.auth.info3.logon_srv, 
-   info3-uni_logon_srv, sizeof(fstring));
+   info3-uni_logon_srv, 
sizeof(state-response.data.auth.info3.logon_srv));
unistr2_to_ascii(state-response.data.auth.info3.logon_dom, 
-   info3-uni_logon_dom, sizeof(fstring));
+   info3-uni_logon_dom, 
sizeof(state-response.data.auth.info3.logon_dom));
 
return NT_STATUS_OK;
 }



svn commit: samba r25277 - in branches: SAMBA_3_2/source/lib SAMBA_3_2_0/source/lib

2007-09-21 Thread jra
Author: jra
Date: 2007-09-21 10:32:57 + (Fri, 21 Sep 2007)
New Revision: 25277

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

Log:
Belt-and-braces approach to Volker's fix for RPC-SAMBA3-GETUSERNAME.
If we promise dest is null terminated, ensure we do it even on
fast path exits.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/lib/charcnv.c
   branches/SAMBA_3_2_0/source/lib/charcnv.c


Changeset:
Modified: branches/SAMBA_3_2/source/lib/charcnv.c
===
--- branches/SAMBA_3_2/source/lib/charcnv.c 2007-09-21 10:32:12 UTC (rev 
25276)
+++ branches/SAMBA_3_2/source/lib/charcnv.c 2007-09-21 10:32:57 UTC (rev 
25277)
@@ -1403,15 +1403,18 @@
 {
size_t ret;
 
-   if (!src_len) {
-   return 0;
-   }
-
if (dest_len == (size_t)-1) {
/* No longer allow dest_len of -1. */
smb_panic(pull_ucs2 - invalid dest_len of -1);
}
 
+   if (!src_len) {
+   if (dest  dest_len  0) {
+   dest[0] = '\0';
+   }
+   return 0;
+   }
+
if (ucs2_align(base_ptr, src, flags)) {
src = (const void *)((const char *)src + 1);
if (src_len != (size_t)-1)

Modified: branches/SAMBA_3_2_0/source/lib/charcnv.c
===
--- branches/SAMBA_3_2_0/source/lib/charcnv.c   2007-09-21 10:32:12 UTC (rev 
25276)
+++ branches/SAMBA_3_2_0/source/lib/charcnv.c   2007-09-21 10:32:57 UTC (rev 
25277)
@@ -1403,15 +1403,18 @@
 {
size_t ret;
 
-   if (!src_len) {
-   return 0;
-   }
-
if (dest_len == (size_t)-1) {
/* No longer allow dest_len of -1. */
smb_panic(pull_ucs2 - invalid dest_len of -1);
}
 
+   if (!src_len) {
+   if (dest  dest_len  0) {
+   dest[0] = '\0';
+   }
+   return 0;
+   }
+
if (ucs2_align(base_ptr, src, flags)) {
src = (const void *)((const char *)src + 1);
if (src_len != (size_t)-1)



svn commit: samba r25222 - in branches: SAMBA_3_2/source/lib SAMBA_3_2/source/modules SAMBA_3_2_0/source/lib SAMBA_3_2_0/source/modules

2007-09-19 Thread jra
Author: jra
Date: 2007-09-19 09:40:40 + (Wed, 19 Sep 2007)
New Revision: 25222

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

Log:
Fix last assumptions that (size_t)-1 can be used
as a special dest_len of sizeof(pstring).
Jeremy.

Modified:
   branches/SAMBA_3_2/source/lib/charcnv.c
   branches/SAMBA_3_2/source/modules/vfs_catia.c
   branches/SAMBA_3_2_0/source/lib/charcnv.c
   branches/SAMBA_3_2_0/source/modules/vfs_catia.c


Changeset:
Modified: branches/SAMBA_3_2/source/lib/charcnv.c
===
--- branches/SAMBA_3_2/source/lib/charcnv.c 2007-09-19 01:59:06 UTC (rev 
25221)
+++ branches/SAMBA_3_2/source/lib/charcnv.c 2007-09-19 09:40:40 UTC (rev 
25222)
@@ -745,7 +745,7 @@
 
size = push_ucs2_allocate(buffer, src);
if (size == (size_t)-1) {
-   smb_panic(failed to create UCS2 buffer);
+   return 0;
}
if (!strupper_w(buffer)  (dest == src)) {
free(buffer);
@@ -1068,8 +1068,11 @@
 {
size_t ret;
 
-   if (dest_len == (size_t)-1)
-   dest_len = sizeof(pstring);
+   if (dest_len == (size_t)-1) {
+   /* No longer allow dest_len of -1. */
+   smb_panic(pull_ascii - invalid dest_len of -1);
+   return 0;
+   }
 
if (flags  STR_TERMINATE) {
if (src_len == (size_t)-1) {
@@ -1213,7 +1216,7 @@
  * /dl
  *
  * @param dest_len is the maximum length allowed in the
- * destination. If dest_len is -1 then no maxiumum is used.
+ * destination.
  **/
 
 size_t push_ucs2(const void *base_ptr, void *dest, const char *src, size_t 
dest_len, int flags)
@@ -1222,9 +1225,11 @@
size_t src_len;
size_t ret;
 
-   /* treat a pstring as unlimited length */
-   if (dest_len == (size_t)-1)
-   dest_len = sizeof(pstring);
+   if (dest_len == (size_t)-1) {
+   /* No longer allow dest_len of -1. */
+   smb_panic(push_ucs2 - invalid dest_len of -1);
+   return 0;
+   }
 
if (flags  STR_TERMINATE)
src_len = (size_t)-1;
@@ -1315,23 +1320,33 @@
 
 static size_t push_utf8(void *dest, const char *src, size_t dest_len, int 
flags)
 {
-   size_t src_len = strlen(src);
-   pstring tmpbuf;
+   size_t src_len = 0;
+   size_t ret;
+   char *tmpbuf = NULL;
 
-   /* treat a pstring as unlimited length */
-   if (dest_len == (size_t)-1)
-   dest_len = sizeof(pstring);
+   if (dest_len == (size_t)-1) {
+   /* No longer allow dest_len of -1. */
+   smb_panic(push_utf8 - invalid dest_len of -1);
+   return 0;
+   }
 
if (flags  STR_UPPER) {
-   pstrcpy(tmpbuf, src);
-   strupper_m(tmpbuf);
+   tmpbuf = strdup_upper(src);
+   if (!tmpbuf) {
+   return 0;
+   }
src = tmpbuf;
+   src_len = strlen(src);
}
 
-   if (flags  STR_TERMINATE)
+   src_len = strlen(src);
+   if (flags  STR_TERMINATE) {
src_len++;
+   }
 
-   return convert_string(CH_UNIX, CH_UTF8, src, src_len, dest, dest_len, 
True);
+   ret = convert_string(CH_UNIX, CH_UTF8, src, src_len, dest, dest_len, 
True);
+   SAFE_FREE(tmpbuf);
+   return ret;
 }
 
 size_t push_utf8_fstring(void *dest, const char *src)
@@ -1390,8 +1405,11 @@
return 0;
}
 
-   if (dest_len == (size_t)-1)
-   dest_len = sizeof(pstring);
+   if (dest_len == (size_t)-1) {
+   /* No longer allow dest_len of -1. */
+   smb_panic(push_utf8 - invalid dest_len of -1);
+   return 0;
+   }
 
if (ucs2_align(base_ptr, src, flags)) {
src = (const void *)((const char *)src + 1);

Modified: branches/SAMBA_3_2/source/modules/vfs_catia.c
===
--- branches/SAMBA_3_2/source/modules/vfs_catia.c   2007-09-19 01:59:06 UTC 
(rev 25221)
+++ branches/SAMBA_3_2/source/modules/vfs_catia.c   2007-09-19 09:40:40 UTC 
(rev 25222)
@@ -39,7 +39,7 @@
 for (;*ptr;ptr++)
 if (*ptr==old) *ptr=newc;
 
-pull_ucs2(NULL, s, tmpbuf, -1, sizeof(tmpbuf), STR_TERMINATE);
+pull_ucs2(NULL, s, tmpbuf, sizeof(pstring), sizeof(tmpbuf), 
STR_TERMINATE);
 }
 
 static void from_unix(char *s)

Modified: branches/SAMBA_3_2_0/source/lib/charcnv.c
===
--- branches/SAMBA_3_2_0/source/lib/charcnv.c   2007-09-19 01:59:06 UTC (rev 
25221)
+++ branches/SAMBA_3_2_0/source/lib/charcnv.c   2007-09-19 09:40:40 UTC (rev 
25222)
@@ -745,7 +745,7 @@
 
size = push_ucs2_allocate(buffer, src);
if (size == (size_t)-1) {
-   smb_panic(failed to create UCS2 buffer

svn commit: samba r25238 - in branches: SAMBA_3_2/source/lib SAMBA_3_2/source/nmbd SAMBA_3_2_0/source/lib SAMBA_3_2_0/source/nmbd

2007-09-19 Thread jra
Author: jra
Date: 2007-09-19 17:52:06 + (Wed, 19 Sep 2007)
New Revision: 25238

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

Log:
Make the error returns from the string functions
always consistent. Return -1 on error, and ensure
we check for this. In cases where the dest is already
specified and we've been asked to terminate with a
null, ensure we always do so even on error.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/lib/charcnv.c
   branches/SAMBA_3_2/source/nmbd/nmbd_processlogon.c
   branches/SAMBA_3_2_0/source/lib/charcnv.c
   branches/SAMBA_3_2_0/source/nmbd/nmbd_processlogon.c


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


svn commit: samba r25195 - in branches: SAMBA_3_2/source/lib SAMBA_3_2_0/source/lib

2007-09-17 Thread jra
Author: jra
Date: 2007-09-17 10:50:59 + (Mon, 17 Sep 2007)
New Revision: 25195

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

Log:
Fix issue with calling pull_uc2_*alloc with
str_len == 0. We should just return 0 in this
case.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/lib/charcnv.c
   branches/SAMBA_3_2_0/source/lib/charcnv.c


Changeset:
Modified: branches/SAMBA_3_2/source/lib/charcnv.c
===
--- branches/SAMBA_3_2/source/lib/charcnv.c 2007-09-17 05:31:49 UTC (rev 
25194)
+++ branches/SAMBA_3_2/source/lib/charcnv.c 2007-09-17 10:50:59 UTC (rev 
25195)
@@ -1369,6 +1369,10 @@
 {
size_t ret;
 
+   if (!src_len) {
+   return 0;
+   }
+
if (dest_len == (size_t)-1)
dest_len = sizeof(pstring);
 
@@ -1446,6 +1450,10 @@
}
 #endif
 
+   if (!src_len) {
+   return 0;
+   }
+
if (ucs2_align(base_ptr, src, flags)) {
src = (const void *)((const char *)src + 1);
if (src_len != (size_t)-1)

Modified: branches/SAMBA_3_2_0/source/lib/charcnv.c
===
--- branches/SAMBA_3_2_0/source/lib/charcnv.c   2007-09-17 05:31:49 UTC (rev 
25194)
+++ branches/SAMBA_3_2_0/source/lib/charcnv.c   2007-09-17 10:50:59 UTC (rev 
25195)
@@ -1369,6 +1369,10 @@
 {
size_t ret;
 
+   if (!src_len) {
+   return 0;
+   }
+
if (dest_len == (size_t)-1)
dest_len = sizeof(pstring);
 
@@ -1446,6 +1450,10 @@
}
 #endif
 
+   if (!src_len) {
+   return 0;
+   }
+
if (ucs2_align(base_ptr, src, flags)) {
src = (const void *)((const char *)src + 1);
if (src_len != (size_t)-1)



svn commit: samba r25199 - in branches: SAMBA_3_2/source/lib SAMBA_3_2_0/source/lib

2007-09-17 Thread jra
Author: jra
Date: 2007-09-17 19:43:06 + (Mon, 17 Sep 2007)
New Revision: 25199

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

Log:
Remove pstring from strdup_upper - make it the
same as talloc_strdup_upper.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/lib/charcnv.c
   branches/SAMBA_3_2_0/source/lib/charcnv.c


Changeset:
Modified: branches/SAMBA_3_2/source/lib/charcnv.c
===
--- branches/SAMBA_3_2/source/lib/charcnv.c 2007-09-17 15:34:22 UTC (rev 
25198)
+++ branches/SAMBA_3_2/source/lib/charcnv.c 2007-09-17 19:43:06 UTC (rev 
25199)
@@ -759,49 +759,68 @@
 
 /**
  strdup() a unix string to upper case.
- Max size is pstring.
 **/
 
 char *strdup_upper(const char *s)
 {
-   pstring out_buffer;
+   char *out_buffer = SMB_STRDUP(s);
const unsigned char *p = (const unsigned char *)s;
unsigned char *q = (unsigned char *)out_buffer;
 
+   if (!q) {
+   return NULL;
+   }
+
/* this is quite a common operation, so we want it to be
   fast. We optimise for the ascii case, knowing that all our
   supported multi-byte character sets are ascii-compatible
   (ie. they match for the first 128 chars) */
 
-   while (1) {
+   while (*p) {
if (*p  0x80)
break;
*q++ = toupper_ascii(*p);
-   if (!*p)
-   break;
p++;
-   if (p - ( const unsigned char *)s = sizeof(pstring))
-   break;
}
 
if (*p) {
/* MB case. */
size_t size;
-   wpstring buffer;
-   size = convert_string(CH_UNIX, CH_UTF16LE, s, -1, buffer, 
sizeof(buffer), True);
+   smb_ucs2_t *buffer = NULL;
+
+   SAFE_FREE(out_buffer);
+   size = convert_string_allocate(NULL,
+   CH_UNIX,
+   CH_UTF16LE,
+   s,
+   strlen(s) + 1,
+   (void **)(void *)buffer,
+   True);
if (size == (size_t)-1) {
return NULL;
}
 
strupper_w(buffer);
 
-   size = convert_string(CH_UTF16LE, CH_UNIX, buffer, -1, 
out_buffer, sizeof(out_buffer), True);
+   size = convert_string_allocate(NULL,
+   CH_UTF16LE,
+   CH_UNIX,
+   buffer,
+   size,
+   (void **)(void *)out_buffer,
+   True);
+
+   /* Don't need the intermediate buffer
+* anymore.
+*/
+
+   TALLOC_FREE(buffer);
if (size == (size_t)-1) {
return NULL;
}
}
 
-   return SMB_STRDUP(out_buffer);
+   return out_buffer;
 }
 
 /**
@@ -823,12 +842,10 @@
   supported multi-byte character sets are ascii-compatible
   (ie. they match for the first 128 chars) */
 
-   while (1) {
+   while (*p) {
if (*p  0x80)
break;
*q++ = toupper_ascii(*p);
-   if (!*p)
-   break;
p++;
}
 

Modified: branches/SAMBA_3_2_0/source/lib/charcnv.c
===
--- branches/SAMBA_3_2_0/source/lib/charcnv.c   2007-09-17 15:34:22 UTC (rev 
25198)
+++ branches/SAMBA_3_2_0/source/lib/charcnv.c   2007-09-17 19:43:06 UTC (rev 
25199)
@@ -759,49 +759,68 @@
 
 /**
  strdup() a unix string to upper case.
- Max size is pstring.
 **/
 
 char *strdup_upper(const char *s)
 {
-   pstring out_buffer;
+   char *out_buffer = SMB_STRDUP(s);
const unsigned char *p = (const unsigned char *)s;
unsigned char *q = (unsigned char *)out_buffer;
 
+   if (!q) {
+   return NULL;
+   }
+
/* this is quite a common operation, so we want it to be
   fast. We optimise for the ascii case, knowing that all our
   supported multi-byte character sets are ascii-compatible
   (ie. they match for the first 128 chars) */
 
-   while (1) {
+   while (*p) {
if (*p  0x80)
break;
*q++ = toupper_ascii(*p);
-   if (!*p)
-   break;
p++;
-   if (p - ( const unsigned char *)s = sizeof(pstring))
-   break;
}
 
if (*p) {
/* MB case. */
size_t size;
-   wpstring buffer

svn commit: samba r25163 - in branches: SAMBA_3_2/source/smbd SAMBA_3_2_0/source/smbd

2007-09-14 Thread jra
Author: jra
Date: 2007-09-14 16:50:54 + (Fri, 14 Sep 2007)
New Revision: 25163

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

Log:
Fix wrong ctx passed to talloc_asprintf_append().
Found by Metze's code review (thanks Metze !).
Jeremy.

Modified:
   branches/SAMBA_3_2/source/smbd/trans2.c
   branches/SAMBA_3_2_0/source/smbd/trans2.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/trans2.c
===
--- branches/SAMBA_3_2/source/smbd/trans2.c 2007-09-14 16:12:38 UTC (rev 
25162)
+++ branches/SAMBA_3_2/source/smbd/trans2.c 2007-09-14 16:50:54 UTC (rev 
25163)
@@ -4876,7 +4876,7 @@
return NT_STATUS_NO_MEMORY;
}
}
-   rel_name = talloc_asprintf_append(ctx,
+   rel_name = talloc_asprintf_append(rel_name,
%s,
link_target);
if (!rel_name) {

Modified: branches/SAMBA_3_2_0/source/smbd/trans2.c
===
--- branches/SAMBA_3_2_0/source/smbd/trans2.c   2007-09-14 16:12:38 UTC (rev 
25162)
+++ branches/SAMBA_3_2_0/source/smbd/trans2.c   2007-09-14 16:50:54 UTC (rev 
25163)
@@ -4829,7 +4829,7 @@
return NT_STATUS_NO_MEMORY;
}
}
-   rel_name = talloc_asprintf_append(ctx,
+   rel_name = talloc_asprintf_append(rel_name,
%s,
link_target);
if (!rel_name) {



svn commit: samba r25165 - in branches: SAMBA_3_2/source/libads SAMBA_3_2/source/libgpo SAMBA_3_2/source/passdb SAMBA_3_2/source/winbindd SAMBA_3_2_0/source/libads SAMBA_3_2_0/source/libgpo SAMBA_3_2_

2007-09-14 Thread jra
Author: jra
Date: 2007-09-14 17:42:10 + (Fri, 14 Sep 2007)
New Revision: 25165

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

Log:
Use talloc_asprintf_append_buffer with an unmodified
string.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/libads/ldap_schema.c
   branches/SAMBA_3_2/source/libgpo/gpo_fetch.c
   branches/SAMBA_3_2/source/passdb/pdb_ldap.c
   branches/SAMBA_3_2/source/winbindd/idmap_ad.c
   branches/SAMBA_3_2/source/winbindd/idmap_ldap.c
   branches/SAMBA_3_2/source/winbindd/winbindd_dual.c
   branches/SAMBA_3_2_0/source/libads/ldap_schema.c
   branches/SAMBA_3_2_0/source/libgpo/gpo_fetch.c
   branches/SAMBA_3_2_0/source/passdb/pdb_ldap.c
   branches/SAMBA_3_2_0/source/winbindd/idmap_ad.c
   branches/SAMBA_3_2_0/source/winbindd/idmap_ldap.c
   branches/SAMBA_3_2_0/source/winbindd/winbindd_dual.c


Changeset:
Modified: branches/SAMBA_3_2/source/libads/ldap_schema.c
===
--- branches/SAMBA_3_2/source/libads/ldap_schema.c  2007-09-14 17:40:58 UTC 
(rev 25164)
+++ branches/SAMBA_3_2/source/libads/ldap_schema.c  2007-09-14 17:42:10 UTC 
(rev 25165)
@@ -48,13 +48,13 @@
 
for (i=0; inum_OIDs; i++) {
 
-   if ((expr = talloc_asprintf_append(expr, (attributeId=%s), 
+   if ((expr = talloc_asprintf_append_buffer(expr, 
(attributeId=%s), 
   OIDs[i])) == NULL) {
return ADS_ERROR(LDAP_NO_MEMORY);
}
}
 
-   if ((expr = talloc_asprintf_append(expr, ))) == NULL) {
+   if ((expr = talloc_asprintf_append_buffer(expr, ))) == NULL) {
return ADS_ERROR(LDAP_NO_MEMORY);
}
 

Modified: branches/SAMBA_3_2/source/libgpo/gpo_fetch.c
===
--- branches/SAMBA_3_2/source/libgpo/gpo_fetch.c2007-09-14 17:40:58 UTC 
(rev 25164)
+++ branches/SAMBA_3_2/source/libgpo/gpo_fetch.c2007-09-14 17:42:10 UTC 
(rev 25165)
@@ -102,7 +102,7 @@
 
while (next_token(unix_path, tok, /, sizeof(tok))) {
 
-   current_dir = talloc_asprintf_append(current_dir, /%s, tok);
+   current_dir = talloc_asprintf_append_buffer(current_dir, /%s, 
tok);
NT_STATUS_HAVE_NO_MEMORY(current_dir);
 
if ((mkdir(current_dir, 0644))  0  errno != EEXIST) {

Modified: branches/SAMBA_3_2/source/passdb/pdb_ldap.c
===
--- branches/SAMBA_3_2/source/passdb/pdb_ldap.c 2007-09-14 17:40:58 UTC (rev 
25164)
+++ branches/SAMBA_3_2/source/passdb/pdb_ldap.c 2007-09-14 17:42:10 UTC (rev 
25165)
@@ -2437,7 +2437,7 @@
goto done;
}

-   filter = talloc_asprintf_append(filter, (uid=%s), 
escape_memberuid);
+   filter = talloc_asprintf_append_buffer(filter, 
(uid=%s), escape_memberuid);
if (filter == NULL) {
SAFE_FREE(escape_memberuid);
ret = NT_STATUS_NO_MEMORY;
@@ -2447,7 +2447,7 @@
SAFE_FREE(escape_memberuid);
}
 
-   filter = talloc_asprintf_append(filter, )));
+   filter = talloc_asprintf_append_buffer(filter, )));
if (filter == NULL) {
ret = NT_STATUS_NO_MEMORY;
goto done;
@@ -3726,7 +3726,7 @@
for (i=0; inum_rids; i++) {
DOM_SID sid;
sid_compose(sid, domain_sid, rids[i]);
-   allsids = talloc_asprintf_append(allsids, (sambaSid=%s),
+   allsids = talloc_asprintf_append_buffer(allsids, 
(sambaSid=%s),
 sid_string_static(sid));
if (allsids == NULL) {
goto done;

Modified: branches/SAMBA_3_2/source/winbindd/idmap_ad.c
===
--- branches/SAMBA_3_2/source/winbindd/idmap_ad.c   2007-09-14 17:40:58 UTC 
(rev 25164)
+++ branches/SAMBA_3_2/source/winbindd/idmap_ad.c   2007-09-14 17:42:10 UTC 
(rev 25165)
@@ -315,7 +315,7 @@
   
ATYPE_WORKSTATION_TRUST,
   
ATYPE_INTERDOMAIN_TRUST);
}
-   u_filter = talloc_asprintf_append(u_filter, (%s=%lu),
+   u_filter = talloc_asprintf_append_buffer(u_filter, 
(%s=%lu),
  
ad_schema-posix_uidnumber_attr,
  (unsigned 
long)ids[idx]-xid.id);
CHECK_ALLOC_DONE(u_filter);
@@ -329,7 +329,7

svn commit: samba r25167 - in branches: SAMBA_3_2/source/smbd SAMBA_3_2_0/source/smbd

2007-09-14 Thread jra
Author: jra
Date: 2007-09-14 18:24:31 + (Fri, 14 Sep 2007)
New Revision: 25167

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

Log:
Fix breakage from mangling rewrite. Use the
new name if unmangling succeeded, not if it
failed. Jerry - please re-test, this should
fix your bug.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/smbd/filename.c
   branches/SAMBA_3_2_0/source/smbd/filename.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/filename.c
===
--- branches/SAMBA_3_2/source/smbd/filename.c   2007-09-14 18:06:51 UTC (rev 
25166)
+++ branches/SAMBA_3_2/source/smbd/filename.c   2007-09-14 18:24:31 UTC (rev 
25167)
@@ -755,7 +755,8 @@
name,
unmangled_name,
conn-params);
-   if (mangled) {
+   if (!mangled) {
+   /* Name is now unmangled. */
name = unmangled_name;
}
}

Modified: branches/SAMBA_3_2_0/source/smbd/filename.c
===
--- branches/SAMBA_3_2_0/source/smbd/filename.c 2007-09-14 18:06:51 UTC (rev 
25166)
+++ branches/SAMBA_3_2_0/source/smbd/filename.c 2007-09-14 18:24:31 UTC (rev 
25167)
@@ -755,7 +755,8 @@
name,
unmangled_name,
conn-params);
-   if (mangled) {
+   if (!mangled) {
+   /* Name is now unmangled. */
name = unmangled_name;
}
}



svn commit: samba r25170 - in branches: SAMBA_3_2/source/lib SAMBA_3_2/source/nmbd SAMBA_3_2_0/source/lib SAMBA_3_2_0/source/nmbd

2007-09-14 Thread jra
Author: jra
Date: 2007-09-14 22:03:41 + (Fri, 14 Sep 2007)
New Revision: 25170

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

Log:
Remove pstring limits from ms_fnmatch and module load.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/lib/module.c
   branches/SAMBA_3_2/source/lib/ms_fnmatch.c
   branches/SAMBA_3_2/source/nmbd/nmbd_processlogon.c
   branches/SAMBA_3_2_0/source/lib/module.c
   branches/SAMBA_3_2_0/source/lib/ms_fnmatch.c
   branches/SAMBA_3_2_0/source/nmbd/nmbd_processlogon.c


Changeset:
Modified: branches/SAMBA_3_2/source/lib/module.c
===
--- branches/SAMBA_3_2/source/lib/module.c  2007-09-14 18:31:33 UTC (rev 
25169)
+++ branches/SAMBA_3_2/source/lib/module.c  2007-09-14 22:03:41 UTC (rev 
25170)
@@ -76,7 +76,7 @@
return do_smb_load_module(module_name, False);
 }
 
-/* Load all modules in list and return number of 
+/* Load all modules in list and return number of
  * modules that has been successfully loaded */
 int smb_load_modules(const char **modules)
 {
@@ -96,28 +96,38 @@
 
 NTSTATUS smb_probe_module(const char *subsystem, const char *module)
 {
-   pstring full_path;
-   
+   char *full_path = NULL;
+   TALLOC_CTX *ctx = talloc_stackframe();
+   NTSTATUS status;
+
/* Check for absolute path */
 
-   /* if we make any 'samba multibyte string' 
-  calls here, we break 
+   /* if we make any 'samba multibyte string'
+  calls here, we break
   for loading string modules */
 
DEBUG(5, (Probing module '%s'\n, module));
 
if (module[0] == '/')
return do_smb_load_module(module, True);
-   
-   pstrcpy(full_path, lib_path(subsystem));
-   pstrcat(full_path, /);
-   pstrcat(full_path, module);
-   pstrcat(full_path, .);
-   pstrcat(full_path, shlib_ext());
 
-   DEBUG(5, (Probing module '%s': Trying to load from %s\n, module, 
full_path));
-   
-   return do_smb_load_module(full_path, True);
+   full_path = talloc_asprintf(ctx,
+   %s/%s.%s,
+   lib_path(subsystem),
+   module,
+   shlib_ext());
+   if (!full_path) {
+   TALLOC_FREE(ctx);
+   return NT_STATUS_NO_MEMORY;
+   }
+
+   DEBUG(5, (Probing module '%s': Trying to load from %s\n,
+   module, full_path));
+
+   status = do_smb_load_module(full_path, True);
+
+   TALLOC_FREE(ctx);
+   return status;
 }
 
 #else /* HAVE_DLOPEN */

Modified: branches/SAMBA_3_2/source/lib/ms_fnmatch.c
===
--- branches/SAMBA_3_2/source/lib/ms_fnmatch.c  2007-09-14 18:31:33 UTC (rev 
25169)
+++ branches/SAMBA_3_2/source/lib/ms_fnmatch.c  2007-09-14 22:03:41 UTC (rev 
25170)
@@ -1,4 +1,4 @@
-/* 
+/*
Unix SMB/CIFS implementation.
filename matching routine
Copyright (C) Andrew Tridgell 1992-2004
@@ -7,21 +7,21 @@
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-   
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
-   
+
You should have received a copy of the GNU General Public License
-   along with this program.  If not, see http://www.gnu.org/licenses/.  
+   along with this program.  If not, see http://www.gnu.org/licenses/.
 */
 
 /*
This module was originally based on fnmatch.c copyright by the Free
Software Foundation. It bears little (if any) resemblence to that
code now
-*/  
+*/
 
 
 #include includes.h
@@ -53,7 +53,7 @@
   an optimisation only. The ldot pointer is NULL if the string does
   not contain a '.', otherwise it points at the last dot in 'n'.
 */
-static int ms_fnmatch_core(const smb_ucs2_t *p, const smb_ucs2_t *n, 
+static int ms_fnmatch_core(const smb_ucs2_t *p, const smb_ucs2_t *n,
   struct max_n *max_n, const smb_ucs2_t *ldot,
   BOOL is_case_sensitive)
 {
@@ -137,22 +137,23 @@
break;
}
}
-   
+
if (! *n) {
return 0;
}
-   
+
return -1;
 }
 
 int ms_fnmatch(const char *pattern, const char *string, BOOL translate_pattern,
   BOOL is_case_sensitive)
 {
-   wpstring p, s;
+   smb_ucs2_t *p = NULL;
+   smb_ucs2_t *s = NULL;
int ret, count, i;
struct max_n *max_n = NULL;
 
-   if (strcmp(string, ..) == 0) {
+   if (ISDOTDOT(string)) {
string = .;
}
 
@@ -166,15 +167,12 @@
}
}
 
-   if (push_ucs2

svn commit: samba r25172 - in branches: SAMBA_3_2/source/lib SAMBA_3_2_0/source/lib

2007-09-14 Thread jra
Author: jra
Date: 2007-09-14 22:16:21 + (Fri, 14 Sep 2007)
New Revision: 25172

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

Log:
Remove commented out code we will never enable.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/lib/system.c
   branches/SAMBA_3_2_0/source/lib/system.c


Changeset:
Modified: branches/SAMBA_3_2/source/lib/system.c
===
--- branches/SAMBA_3_2/source/lib/system.c  2007-09-14 22:14:39 UTC (rev 
25171)
+++ branches/SAMBA_3_2/source/lib/system.c  2007-09-14 22:16:21 UTC (rev 
25172)
@@ -1197,179 +1197,7 @@
return getgrgid(gid);
 }
 
-#if 0 /* NOT CURRENTLY USED - JRA */
 /**
- The following are the UNICODE versions of *all* system interface functions
- called within Samba. Ok, ok, the exceptions are the gethostbyXX calls,
- which currently are left as ascii as they are not used other than in name
- resolution.
-/
-
-/**
- Wide stat. Just narrow and call sys_xxx.
-/
-
-int wsys_stat(const smb_ucs2_t *wfname,SMB_STRUCT_STAT *sbuf)
-{
-   pstring fname;
-   return sys_stat(unicode_to_unix(fname,wfname,sizeof(fname)), sbuf);
-}
-
-/**
- Wide lstat. Just narrow and call sys_xxx.
-/
-
-int wsys_lstat(const smb_ucs2_t *wfname,SMB_STRUCT_STAT *sbuf)
-{
-   pstring fname;
-   return sys_lstat(unicode_to_unix(fname,wfname,sizeof(fname)), sbuf);
-}
-
-/**
- Wide creat. Just narrow and call sys_xxx.
-/
-
-int wsys_creat(const smb_ucs2_t *wfname, mode_t mode)
-{
-   pstring fname;
-   return sys_creat(unicode_to_unix(fname,wfname,sizeof(fname)), mode);
-}
-
-/**
- Wide open. Just narrow and call sys_xxx.
-/
-
-int wsys_open(const smb_ucs2_t *wfname, int oflag, mode_t mode)
-{
-   pstring fname;
-   return sys_open(unicode_to_unix(fname,wfname,sizeof(fname)), oflag, 
mode);
-}
-
-/**
- Wide fopen. Just narrow and call sys_xxx.
-/
-
-FILE *wsys_fopen(const smb_ucs2_t *wfname, const char *type)
-{
-   pstring fname;
-   return sys_fopen(unicode_to_unix(fname,wfname,sizeof(fname)), type);
-}
-
-/**
- Wide opendir. Just narrow and call sys_xxx.
-/
-
-SMB_STRUCT_DIR *wsys_opendir(const smb_ucs2_t *wfname)
-{
-   pstring fname;
-   return opendir(unicode_to_unix(fname,wfname,sizeof(fname)));
-}
-
-/**
- Wide readdir. Return a structure pointer containing a wide filename.
-/
-
-SMB_STRUCT_WDIRENT *wsys_readdir(SMB_STRUCT_DIR *dirp)
-{
-   static SMB_STRUCT_WDIRENT retval;
-   SMB_STRUCT_DIRENT *dirval = sys_readdir(dirp);
-
-   if(!dirval)
-   return NULL;
-
-   /*
-* The only POSIX defined member of this struct is d_name.
-*/
-
-   unix_to_unicode(retval.d_name,dirval-d_name,sizeof(retval.d_name));
-
-   return retval;
-}
-
-/**
- Wide getwd. Call sys_xxx and widen. Assumes s points to a wpstring.
-/
-
-smb_ucs2_t *wsys_getwd(smb_ucs2_t *s)
-{
-   pstring fname;
-   char *p = sys_getwd(fname);
-
-   if(!p)
-   return NULL;
-
-   return unix_to_unicode(s, p, sizeof(wpstring));
-}
-
-/**
- Wide chown. Just narrow and call sys_xxx.
-/
-
-int wsys_chown(const smb_ucs2_t *wfname, uid_t uid, gid_t gid)
-{
-   pstring fname;
-   return chown(unicode_to_unix(fname,wfname,sizeof(fname)), uid, gid);
-}
-
-/**
- Wide chroot. Just narrow and call sys_xxx.
-/
-
-int

svn commit: samba r25173 - in branches: SAMBA_3_2/source/smbd SAMBA_3_2_0/source/smbd

2007-09-14 Thread jra
Author: jra
Date: 2007-09-14 22:27:27 + (Fri, 14 Sep 2007)
New Revision: 25173

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

Log:
Use the append_buffer version in a loop.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/smbd/msdfs.c
   branches/SAMBA_3_2_0/source/smbd/msdfs.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/msdfs.c
===
--- branches/SAMBA_3_2/source/smbd/msdfs.c  2007-09-14 22:16:21 UTC (rev 
25172)
+++ branches/SAMBA_3_2/source/smbd/msdfs.c  2007-09-14 22:27:27 UTC (rev 
25173)
@@ -1309,11 +1309,11 @@
continue;
}
if (i  0  insert_comma) {
-   msdfs_link = talloc_asprintf_append(msdfs_link,
+   msdfs_link = talloc_asprintf_append_buffer(msdfs_link,
,%s,
refpath);
} else {
-   msdfs_link = talloc_asprintf_append(msdfs_link,
+   msdfs_link = talloc_asprintf_append_buffer(msdfs_link,
%s,
refpath);
}

Modified: branches/SAMBA_3_2_0/source/smbd/msdfs.c
===
--- branches/SAMBA_3_2_0/source/smbd/msdfs.c2007-09-14 22:16:21 UTC (rev 
25172)
+++ branches/SAMBA_3_2_0/source/smbd/msdfs.c2007-09-14 22:27:27 UTC (rev 
25173)
@@ -1309,11 +1309,11 @@
continue;
}
if (i  0  insert_comma) {
-   msdfs_link = talloc_asprintf_append(msdfs_link,
+   msdfs_link = talloc_asprintf_append_buffer(msdfs_link,
,%s,
refpath);
} else {
-   msdfs_link = talloc_asprintf_append(msdfs_link,
+   msdfs_link = talloc_asprintf_append_buffer(msdfs_link,
%s,
refpath);
}



svn commit: samba r25175 - in branches/SAMBA_4_0/source: client lib/talloc lib/util libcli/cldap libcli/nbt libcli/security libcli/util libnet librpc/ndr librpc/rpc nbt_server/wins scripting/ejs tortu

2007-09-14 Thread jra
Author: jra
Date: 2007-09-14 23:21:00 + (Fri, 14 Sep 2007)
New Revision: 25175

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

Log:
Change to talloc_asprintf_append_buffer().
Jeremy.

Modified:
   branches/SAMBA_4_0/source/client/client.c
   branches/SAMBA_4_0/source/lib/talloc/testsuite.c
   branches/SAMBA_4_0/source/lib/util/util_strlist.c
   branches/SAMBA_4_0/source/libcli/cldap/cldap.c
   branches/SAMBA_4_0/source/libcli/nbt/nbtname.c
   branches/SAMBA_4_0/source/libcli/security/sddl.c
   branches/SAMBA_4_0/source/libcli/util/asn1.c
   branches/SAMBA_4_0/source/libnet/libnet_become_dc.c
   branches/SAMBA_4_0/source/libnet/libnet_unbecome_dc.c
   branches/SAMBA_4_0/source/librpc/ndr/ndr.c
   branches/SAMBA_4_0/source/librpc/rpc/dcerpc_util.c
   branches/SAMBA_4_0/source/nbt_server/wins/wins_hook.c
   branches/SAMBA_4_0/source/scripting/ejs/smbcalls_string.c
   branches/SAMBA_4_0/source/torture/basic/denytest.c
   branches/SAMBA_4_0/source/torture/libnet/libnet_BecomeDC.c
   branches/SAMBA_4_0/source/torture/rpc/session_key.c
   branches/SAMBA_4_0/source/torture/rpc/srvsvc.c
   branches/SAMBA_4_0/source/utils/nmblookup.c
   branches/SAMBA_4_0/source/utils/ntlm_auth.c
   branches/SAMBA_4_0/source/web_server/http.c
   branches/SAMBA_4_0/source/winbind/wb_cmd_list_users.c
   branches/SAMBA_4_0/source/winbind/wb_samba3_cmd.c


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


svn commit: samba r25136 - in branches: SAMBA_3_2/source/lib SAMBA_3_2_0/source/lib

2007-09-13 Thread jra
Author: jra
Date: 2007-09-13 17:25:57 + (Thu, 13 Sep 2007)
New Revision: 25136

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

Log:
When tallocing a string to uppercase remember the terminating
'\0' in size calculations.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/lib/charcnv.c
   branches/SAMBA_3_2_0/source/lib/charcnv.c


Changeset:
Modified: branches/SAMBA_3_2/source/lib/charcnv.c
===
--- branches/SAMBA_3_2/source/lib/charcnv.c 2007-09-13 16:48:46 UTC (rev 
25135)
+++ branches/SAMBA_3_2/source/lib/charcnv.c 2007-09-13 17:25:57 UTC (rev 
25136)
@@ -841,7 +841,7 @@
TALLOC_FREE(out_buffer);
 
size = convert_string_talloc(ctx, CH_UNIX, CH_UTF16LE,
-   s, strlen(s),
+   s, strlen(s)+1,
(void *)ubuf,
True);
if (size == (size_t)-1) {

Modified: branches/SAMBA_3_2_0/source/lib/charcnv.c
===
--- branches/SAMBA_3_2_0/source/lib/charcnv.c   2007-09-13 16:48:46 UTC (rev 
25135)
+++ branches/SAMBA_3_2_0/source/lib/charcnv.c   2007-09-13 17:25:57 UTC (rev 
25136)
@@ -841,7 +841,7 @@
TALLOC_FREE(out_buffer);
 
size = convert_string_talloc(ctx, CH_UNIX, CH_UTF16LE,
-   s, strlen(s),
+   s, strlen(s)+1,
(void *)ubuf,
True);
if (size == (size_t)-1) {



svn commit: samba r25141 - in branches: SAMBA_3_2/source/smbd SAMBA_3_2_0/source/smbd

2007-09-13 Thread jra
Author: jra
Date: 2007-09-14 01:07:57 + (Fri, 14 Sep 2007)
New Revision: 25141

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

Log:
More pstring removal.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/smbd/oplock_irix.c
   branches/SAMBA_3_2_0/source/smbd/oplock_irix.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/oplock_irix.c
===
--- branches/SAMBA_3_2/source/smbd/oplock_irix.c2007-09-13 22:41:04 UTC 
(rev 25140)
+++ branches/SAMBA_3_2/source/smbd/oplock_irix.c2007-09-14 01:07:57 UTC 
(rev 25141)
@@ -33,17 +33,25 @@
 {
int fd;
int pfd[2];
-   pstring tmpname;
+   TALLOC_CTX *ctx = talloc_stackframe();
+   char *tmpname = NULL;
 
set_effective_capability(KERNEL_OPLOCK_CAPABILITY);
 
-   slprintf(tmpname,sizeof(tmpname)-1, %s/koplock.%d, lp_lockdir(),
-(int)sys_getpid());
+   tmpname = talloc_asprintf(ctx,
+   %s/koplock.%d,
+   lp_lockdir(),
+   (int)sys_getpid());
+   if (!tmpname) {
+   TALLOC_FREE(ctx);
+   return False;
+   }
 
if(pipe(pfd) != 0) {
DEBUG(0,(check_kernel_oplocks: Unable to create pipe. Error 
 was %s\n,
 strerror(errno) ));
+   TALLOC_FREE(ctx);
return False;
}
 
@@ -54,11 +62,14 @@
unlink( tmpname );
close(pfd[0]);
close(pfd[1]);
+   TALLOC_FREE(ctx);
return False;
}
 
unlink(tmpname);
 
+   TALLOC_FREE(ctx);
+
if(sys_fcntl_long(fd, F_OPLKREG, pfd[1]) == -1) {
DEBUG(0,(check_kernel_oplocks: Kernel oplocks are not 
 available on this machine. Disabling kernel oplock 

Modified: branches/SAMBA_3_2_0/source/smbd/oplock_irix.c
===
--- branches/SAMBA_3_2_0/source/smbd/oplock_irix.c  2007-09-13 22:41:04 UTC 
(rev 25140)
+++ branches/SAMBA_3_2_0/source/smbd/oplock_irix.c  2007-09-14 01:07:57 UTC 
(rev 25141)
@@ -33,17 +33,25 @@
 {
int fd;
int pfd[2];
-   pstring tmpname;
+   TALLOC_CTX *ctx = talloc_stackframe();
+   char *tmpname = NULL;
 
set_effective_capability(KERNEL_OPLOCK_CAPABILITY);
 
-   slprintf(tmpname,sizeof(tmpname)-1, %s/koplock.%d, lp_lockdir(),
-(int)sys_getpid());
+   tmpname = talloc_asprintf(ctx,
+   %s/koplock.%d,
+   lp_lockdir(),
+   (int)sys_getpid());
+   if (!tmpname) {
+   TALLOC_FREE(ctx);
+   return False;
+   }
 
if(pipe(pfd) != 0) {
DEBUG(0,(check_kernel_oplocks: Unable to create pipe. Error 
 was %s\n,
 strerror(errno) ));
+   TALLOC_FREE(ctx);
return False;
}
 
@@ -54,11 +62,14 @@
unlink( tmpname );
close(pfd[0]);
close(pfd[1]);
+   TALLOC_FREE(ctx);
return False;
}
 
unlink(tmpname);
 
+   TALLOC_FREE(ctx);
+
if(sys_fcntl_long(fd, F_OPLKREG, pfd[1]) == -1) {
DEBUG(0,(check_kernel_oplocks: Kernel oplocks are not 
 available on this machine. Disabling kernel oplock 



svn commit: samba r25116 - in branches: SAMBA_3_0_MAINT/source/lib/talloc SAMBA_3_2/source/lib/talloc SAMBA_3_2_0/source/lib/talloc SAMBA_4_0/source/lib/talloc

2007-09-12 Thread jra
Author: jra
Date: 2007-09-12 21:41:36 + (Wed, 12 Sep 2007)
New Revision: 25116

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

Log:
Fix talloc_asprintf_append to do the right thing with
truncated strings.
Jeremy.

Modified:
   branches/SAMBA_3_0_MAINT/source/lib/talloc/talloc.c
   branches/SAMBA_3_2/source/lib/talloc/talloc.c
   branches/SAMBA_3_2_0/source/lib/talloc/talloc.c
   branches/SAMBA_4_0/source/lib/talloc/talloc.c


Changeset:
Modified: branches/SAMBA_3_0_MAINT/source/lib/talloc/talloc.c
===
--- branches/SAMBA_3_0_MAINT/source/lib/talloc/talloc.c 2007-09-12 12:36:42 UTC 
(rev 25115)
+++ branches/SAMBA_3_0_MAINT/source/lib/talloc/talloc.c 2007-09-12 21:41:36 UTC 
(rev 25116)
@@ -1215,8 +1215,7 @@
  * accumulating output into a string buffer.
  **/
 char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap)
-{  
-   struct talloc_chunk *tc;
+{
int len, s_len;
va_list ap2;
char c;
@@ -1225,10 +1224,8 @@
return talloc_vasprintf(NULL, fmt, ap);
}
 
-   tc = talloc_chunk_from_ptr(s);
+   s_len = strlen(s);
 
-   s_len = tc-size - 1;
-
va_copy(ap2, ap);
len = vsnprintf(c, 1, fmt, ap2);
va_end(ap2);

Modified: branches/SAMBA_3_2/source/lib/talloc/talloc.c
===
--- branches/SAMBA_3_2/source/lib/talloc/talloc.c   2007-09-12 12:36:42 UTC 
(rev 25115)
+++ branches/SAMBA_3_2/source/lib/talloc/talloc.c   2007-09-12 21:41:36 UTC 
(rev 25116)
@@ -1226,8 +1226,7 @@
  * accumulating output into a string buffer.
  **/
 char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap)
-{  
-   struct talloc_chunk *tc;
+{
int len, s_len;
va_list ap2;
char c;
@@ -1236,10 +1235,8 @@
return talloc_vasprintf(NULL, fmt, ap);
}
 
-   tc = talloc_chunk_from_ptr(s);
+   s_len = strlen(s);
 
-   s_len = tc-size - 1;
-
va_copy(ap2, ap);
len = vsnprintf(c, 1, fmt, ap2);
va_end(ap2);

Modified: branches/SAMBA_3_2_0/source/lib/talloc/talloc.c
===
--- branches/SAMBA_3_2_0/source/lib/talloc/talloc.c 2007-09-12 12:36:42 UTC 
(rev 25115)
+++ branches/SAMBA_3_2_0/source/lib/talloc/talloc.c 2007-09-12 21:41:36 UTC 
(rev 25116)
@@ -1226,8 +1226,7 @@
  * accumulating output into a string buffer.
  **/
 char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap)
-{  
-   struct talloc_chunk *tc;
+{
int len, s_len;
va_list ap2;
char c;
@@ -1236,10 +1235,8 @@
return talloc_vasprintf(NULL, fmt, ap);
}
 
-   tc = talloc_chunk_from_ptr(s);
+   s_len = strlen(s);
 
-   s_len = tc-size - 1;
-
va_copy(ap2, ap);
len = vsnprintf(c, 1, fmt, ap2);
va_end(ap2);

Modified: branches/SAMBA_4_0/source/lib/talloc/talloc.c
===
--- branches/SAMBA_4_0/source/lib/talloc/talloc.c   2007-09-12 12:36:42 UTC 
(rev 25115)
+++ branches/SAMBA_4_0/source/lib/talloc/talloc.c   2007-09-12 21:41:36 UTC 
(rev 25116)
@@ -1226,8 +1226,7 @@
  * accumulating output into a string buffer.
  **/
 char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap)
-{  
-   struct talloc_chunk *tc;
+{
int len, s_len;
va_list ap2;
char c;
@@ -1236,10 +1235,8 @@
return talloc_vasprintf(NULL, fmt, ap);
}
 
-   tc = talloc_chunk_from_ptr(s);
+   s_len = strlen(s);
 
-   s_len = tc-size - 1;
-
va_copy(ap2, ap);
len = vsnprintf(c, 1, fmt, ap2);
va_end(ap2);



svn commit: samba r25117 - in branches: SAMBA_3_2/source/lib SAMBA_3_2/source/printing SAMBA_3_2/source/smbd SAMBA_3_2_0/source/lib SAMBA_3_2_0/source/printing SAMBA_3_2_0/source/smbd

2007-09-12 Thread jra
Author: jra
Date: 2007-09-12 21:48:20 + (Wed, 12 Sep 2007)
New Revision: 25117

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

Log:
The mega-patch Jerry was waiting for. Remove all pstrings from
the main server code paths. We should now be able to cope with
paths up to PATH_MAX length now.
Final job will be to add the TALLOC_CTX * parameter to
unix_convert to make it explicit (for Volker).
Jeremy.

Modified:
   branches/SAMBA_3_2/source/lib/charcnv.c
   branches/SAMBA_3_2/source/lib/system.c
   branches/SAMBA_3_2/source/lib/util.c
   branches/SAMBA_3_2/source/printing/nt_printing.c
   branches/SAMBA_3_2/source/smbd/close.c
   branches/SAMBA_3_2/source/smbd/dir.c
   branches/SAMBA_3_2/source/smbd/mangle.c
   branches/SAMBA_3_2/source/smbd/nttrans.c
   branches/SAMBA_3_2/source/smbd/open.c
   branches/SAMBA_3_2/source/smbd/posix_acls.c
   branches/SAMBA_3_2/source/smbd/process.c
   branches/SAMBA_3_2/source/smbd/reply.c
   branches/SAMBA_3_2/source/smbd/service.c
   branches/SAMBA_3_2/source/smbd/trans2.c
   branches/SAMBA_3_2/source/smbd/vfs.c
   branches/SAMBA_3_2_0/source/lib/charcnv.c
   branches/SAMBA_3_2_0/source/lib/system.c
   branches/SAMBA_3_2_0/source/lib/util.c
   branches/SAMBA_3_2_0/source/printing/nt_printing.c
   branches/SAMBA_3_2_0/source/smbd/close.c
   branches/SAMBA_3_2_0/source/smbd/dir.c
   branches/SAMBA_3_2_0/source/smbd/mangle.c
   branches/SAMBA_3_2_0/source/smbd/nttrans.c
   branches/SAMBA_3_2_0/source/smbd/open.c
   branches/SAMBA_3_2_0/source/smbd/posix_acls.c
   branches/SAMBA_3_2_0/source/smbd/reply.c
   branches/SAMBA_3_2_0/source/smbd/service.c
   branches/SAMBA_3_2_0/source/smbd/trans2.c
   branches/SAMBA_3_2_0/source/smbd/vfs.c


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


svn commit: samba r25118 - in branches: SAMBA_3_2/source/include SAMBA_3_2/source/rpc_server SAMBA_3_2/source/smbd SAMBA_3_2_0/source/include SAMBA_3_2_0/source/rpc_server SAMBA_3_2_0/source/smbd

2007-09-12 Thread jra
Author: jra
Date: 2007-09-12 23:50:21 + (Wed, 12 Sep 2007)
New Revision: 25118

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

Log:
More pstring elimination.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/include/ntdomain.h
   branches/SAMBA_3_2/source/rpc_server/srv_pipe_hnd.c
   branches/SAMBA_3_2/source/smbd/close.c
   branches/SAMBA_3_2/source/smbd/dfree.c
   branches/SAMBA_3_2/source/smbd/pipes.c
   branches/SAMBA_3_2_0/source/include/ntdomain.h
   branches/SAMBA_3_2_0/source/rpc_server/srv_pipe_hnd.c
   branches/SAMBA_3_2_0/source/smbd/close.c
   branches/SAMBA_3_2_0/source/smbd/dfree.c
   branches/SAMBA_3_2_0/source/smbd/pipes.c


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


svn commit: samba r25119 - in branches: SAMBA_3_2/source/rpc_server SAMBA_3_2_0/source/rpc_server

2007-09-12 Thread jra
Author: jra
Date: 2007-09-13 00:29:25 + (Thu, 13 Sep 2007)
New Revision: 25119

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

Log:
Fix a couple of warnings.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/rpc_server/srv_dfs_nt.c
   branches/SAMBA_3_2/source/rpc_server/srv_lsa_hnd.c
   branches/SAMBA_3_2_0/source/rpc_server/srv_dfs_nt.c
   branches/SAMBA_3_2_0/source/rpc_server/srv_lsa_hnd.c


Changeset:
Modified: branches/SAMBA_3_2/source/rpc_server/srv_dfs_nt.c
===
--- branches/SAMBA_3_2/source/rpc_server/srv_dfs_nt.c   2007-09-12 23:50:21 UTC 
(rev 25118)
+++ branches/SAMBA_3_2/source/rpc_server/srv_dfs_nt.c   2007-09-13 00:29:25 UTC 
(rev 25119)
@@ -291,7 +291,8 @@
}
vfs_ChDir(p-conn,p-conn-connectpath);
 
-   DEBUG(5,(_dfs_Enum: %d junctions found in Dfs, doing level %d\n, 
num_jn, r-in.level));
+   DEBUG(5,(_dfs_Enum: %u junctions found in Dfs, doing level %d\n,
+   (unsigned int)num_jn, r-in.level));
 
*r-out.total = num_jn;
 

Modified: branches/SAMBA_3_2/source/rpc_server/srv_lsa_hnd.c
===
--- branches/SAMBA_3_2/source/rpc_server/srv_lsa_hnd.c  2007-09-12 23:50:21 UTC 
(rev 25118)
+++ branches/SAMBA_3_2/source/rpc_server/srv_lsa_hnd.c  2007-09-13 00:29:25 UTC 
(rev 25119)
@@ -44,7 +44,7 @@
  pipes of the same name.
 /
 
-BOOL init_pipe_handle_list(pipes_struct *p, char *pipe_name)
+BOOL init_pipe_handle_list(pipes_struct *p, const char *pipe_name)
 {
pipes_struct *plist = get_first_internal_pipe();
struct handle_list *hl = NULL;

Modified: branches/SAMBA_3_2_0/source/rpc_server/srv_dfs_nt.c
===
--- branches/SAMBA_3_2_0/source/rpc_server/srv_dfs_nt.c 2007-09-12 23:50:21 UTC 
(rev 25118)
+++ branches/SAMBA_3_2_0/source/rpc_server/srv_dfs_nt.c 2007-09-13 00:29:25 UTC 
(rev 25119)
@@ -291,7 +291,8 @@
}
vfs_ChDir(p-conn,p-conn-connectpath);
 
-   DEBUG(5,(_dfs_Enum: %d junctions found in Dfs, doing level %d\n, 
num_jn, r-in.level));
+   DEBUG(5,(_dfs_Enum: %u junctions found in Dfs, doing level %d\n,
+   (unsigned int)num_jn, r-in.level));
 
*r-out.total = num_jn;
 

Modified: branches/SAMBA_3_2_0/source/rpc_server/srv_lsa_hnd.c
===
--- branches/SAMBA_3_2_0/source/rpc_server/srv_lsa_hnd.c2007-09-12 
23:50:21 UTC (rev 25118)
+++ branches/SAMBA_3_2_0/source/rpc_server/srv_lsa_hnd.c2007-09-13 
00:29:25 UTC (rev 25119)
@@ -44,7 +44,7 @@
  pipes of the same name.
 /
 
-BOOL init_pipe_handle_list(pipes_struct *p, char *pipe_name)
+BOOL init_pipe_handle_list(pipes_struct *p, const char *pipe_name)
 {
pipes_struct *plist = get_first_internal_pipe();
struct handle_list *hl = NULL;



svn commit: samba r25120 - in branches: SAMBA_3_2/source/lib SAMBA_3_2_0/source/lib

2007-09-12 Thread jra
Author: jra
Date: 2007-09-13 00:31:02 + (Thu, 13 Sep 2007)
New Revision: 25120

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

Log:
One more warning.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/lib/charcnv.c
   branches/SAMBA_3_2_0/source/lib/charcnv.c


Changeset:
Modified: branches/SAMBA_3_2/source/lib/charcnv.c
===
--- branches/SAMBA_3_2/source/lib/charcnv.c 2007-09-13 00:29:25 UTC (rev 
25119)
+++ branches/SAMBA_3_2/source/lib/charcnv.c 2007-09-13 00:31:02 UTC (rev 
25120)
@@ -1109,7 +1109,7 @@
char *msg = talloc_asprintf(ctx,
Bad src length (%u) in 
pull_ascii_base_talloc,
-   src_len);
+   (unsigned int)src_len);
smb_panic(msg);
}
}

Modified: branches/SAMBA_3_2_0/source/lib/charcnv.c
===
--- branches/SAMBA_3_2_0/source/lib/charcnv.c   2007-09-13 00:29:25 UTC (rev 
25119)
+++ branches/SAMBA_3_2_0/source/lib/charcnv.c   2007-09-13 00:31:02 UTC (rev 
25120)
@@ -1109,7 +1109,7 @@
char *msg = talloc_asprintf(ctx,
Bad src length (%u) in 
pull_ascii_base_talloc,
-   src_len);
+   (unsigned int)src_len);
smb_panic(msg);
}
}



svn commit: samba r25121 - in branches: SAMBA_3_2/source/lib SAMBA_3_2_0/source/lib

2007-09-12 Thread jra
Author: jra
Date: 2007-09-13 01:10:01 + (Thu, 13 Sep 2007)
New Revision: 25121

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

Log:
Remove pstring limits from much of our string handling function.
Still a few left (mainly the substitute ones).
Jeremy.

Modified:
   branches/SAMBA_3_2/source/lib/util_str.c
   branches/SAMBA_3_2_0/source/lib/util_str.c


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


svn commit: samba r25102 - in branches: SAMBA_3_2/source/include SAMBA_3_2/source/rpc_server SAMBA_3_2/source/script/tests SAMBA_3_2/source/smbd SAMBA_3_2_0/source/include SAMBA_3_2_0/source/rpc_serve

2007-09-11 Thread jra
Author: jra
Date: 2007-09-11 18:31:29 + (Tue, 11 Sep 2007)
New Revision: 25102

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

Log:
Rewrite msdfs code to use talloced filenames. Passes make test
and make valgrindtest. Final step will be to change srvstr_get_path()
to return talloced memory in the major codepaths.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/include/msdfs.h
   branches/SAMBA_3_2/source/rpc_server/srv_dfs_nt.c
   branches/SAMBA_3_2/source/script/tests/selftest.sh
   branches/SAMBA_3_2/source/smbd/dir.c
   branches/SAMBA_3_2/source/smbd/msdfs.c
   branches/SAMBA_3_2/source/smbd/nttrans.c
   branches/SAMBA_3_2/source/smbd/reply.c
   branches/SAMBA_3_2/source/smbd/trans2.c
   branches/SAMBA_3_2_0/source/include/msdfs.h
   branches/SAMBA_3_2_0/source/rpc_server/srv_dfs_nt.c
   branches/SAMBA_3_2_0/source/smbd/dir.c
   branches/SAMBA_3_2_0/source/smbd/msdfs.c
   branches/SAMBA_3_2_0/source/smbd/nttrans.c
   branches/SAMBA_3_2_0/source/smbd/reply.c
   branches/SAMBA_3_2_0/source/smbd/trans2.c


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


svn commit: samba r25103 - in branches: SAMBA_3_2/source/include SAMBA_3_2/source/smbd SAMBA_3_2_0/source/include SAMBA_3_2_0/source/smbd

2007-09-11 Thread jra
Author: jra
Date: 2007-09-11 19:27:34 + (Tue, 11 Sep 2007)
New Revision: 25103

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

Log:
Ensure we don't return unwritten memory (valgrind caught).
Jeremy.

Modified:
   branches/SAMBA_3_2/source/include/smb_macros.h
   branches/SAMBA_3_2/source/smbd/ipc.c
   branches/SAMBA_3_2/source/smbd/lanman.c
   branches/SAMBA_3_2_0/source/include/smb_macros.h
   branches/SAMBA_3_2_0/source/smbd/ipc.c
   branches/SAMBA_3_2_0/source/smbd/lanman.c


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


svn commit: samba r25104 - in branches/SAMBA_3_2/source/script/tests: .

2007-09-11 Thread jra
Author: jra
Date: 2007-09-11 21:52:44 + (Tue, 11 Sep 2007)
New Revision: 25104

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

Log:
Fix extra lines added by mistake.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/script/tests/selftest.sh


Changeset:
Modified: branches/SAMBA_3_2/source/script/tests/selftest.sh
===
--- branches/SAMBA_3_2/source/script/tests/selftest.sh  2007-09-11 19:27:34 UTC 
(rev 25103)
+++ branches/SAMBA_3_2/source/script/tests/selftest.sh  2007-09-11 21:52:44 UTC 
(rev 25104)
@@ -139,8 +139,8 @@
printing = bsd
printcap name = /dev/null
 
-   host msdfs = yes
-   panic action = /bin/sleep 9
+#  host msdfs = yes
+#  panic action = /bin/sleep 9
 
 [tmp]
path = $PREFIX_ABS/tmp



svn commit: samba r25111 - in branches: SAMBA_3_2/source/lib SAMBA_3_2/source/smbd SAMBA_3_2_0/source/lib SAMBA_3_2_0/source/smbd

2007-09-11 Thread jra
Author: jra
Date: 2007-09-11 23:57:59 + (Tue, 11 Sep 2007)
New Revision: 25111

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

Log:
Move to talloced pathnames on most code paths.
There are now ony 17 pstrings left in reply.c,
and these will be easy to remove (and I'll be
doing that shortly). Had to fix an interesting
bug in pull_ucs2_base_talloc() when a source
string is not null terminated :-).
Jeremy.

Modified:
   branches/SAMBA_3_2/source/lib/charcnv.c
   branches/SAMBA_3_2/source/smbd/dir.c
   branches/SAMBA_3_2/source/smbd/filename.c
   branches/SAMBA_3_2/source/smbd/msdfs.c
   branches/SAMBA_3_2/source/smbd/nttrans.c
   branches/SAMBA_3_2/source/smbd/reply.c
   branches/SAMBA_3_2/source/smbd/trans2.c
   branches/SAMBA_3_2_0/source/lib/charcnv.c
   branches/SAMBA_3_2_0/source/smbd/dir.c
   branches/SAMBA_3_2_0/source/smbd/filename.c
   branches/SAMBA_3_2_0/source/smbd/msdfs.c
   branches/SAMBA_3_2_0/source/smbd/nttrans.c
   branches/SAMBA_3_2_0/source/smbd/reply.c
   branches/SAMBA_3_2_0/source/smbd/trans2.c


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


svn commit: samba r25067 - in branches/SAMBA_3_2_0/source: . include lib param printing rpc_server smbd

2007-09-10 Thread jra
Author: jra
Date: 2007-09-10 22:12:49 + (Mon, 10 Sep 2007)
New Revision: 25067

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

Log:
As agreed with Jerry. Move unix_convert to a talloc-based
interface. More development will come on top of this. Remove the
mangled map parameter.
Jeremy.


Removed:
   branches/SAMBA_3_2_0/source/smbd/mangle_map.c
Modified:
   branches/SAMBA_3_2_0/source/Makefile.in
   branches/SAMBA_3_2_0/source/include/mangle.h
   branches/SAMBA_3_2_0/source/lib/charcnv.c
   branches/SAMBA_3_2_0/source/param/loadparm.c
   branches/SAMBA_3_2_0/source/printing/nt_printing.c
   branches/SAMBA_3_2_0/source/rpc_server/srv_srvsvc_nt.c
   branches/SAMBA_3_2_0/source/smbd/dir.c
   branches/SAMBA_3_2_0/source/smbd/filename.c
   branches/SAMBA_3_2_0/source/smbd/mangle.c
   branches/SAMBA_3_2_0/source/smbd/mangle_hash.c
   branches/SAMBA_3_2_0/source/smbd/mangle_hash2.c
   branches/SAMBA_3_2_0/source/smbd/msdfs.c
   branches/SAMBA_3_2_0/source/smbd/nttrans.c
   branches/SAMBA_3_2_0/source/smbd/reply.c
   branches/SAMBA_3_2_0/source/smbd/statcache.c
   branches/SAMBA_3_2_0/source/smbd/trans2.c


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


svn commit: samba r25009 - in branches/SAMBA_3_2/source: . include lib param printing rpc_server smbd

2007-09-07 Thread jra
Author: jra
Date: 2007-09-07 20:57:01 + (Fri, 07 Sep 2007)
New Revision: 25009

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

Log:
Large patch discussed with Volker. Move unix_convert to a talloc-based
interface. More development will come on top of this. Remove the
mangled map parameter.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/Makefile.in
   branches/SAMBA_3_2/source/include/mangle.h
   branches/SAMBA_3_2/source/lib/charcnv.c
   branches/SAMBA_3_2/source/param/loadparm.c
   branches/SAMBA_3_2/source/printing/nt_printing.c
   branches/SAMBA_3_2/source/rpc_server/srv_srvsvc_nt.c
   branches/SAMBA_3_2/source/smbd/dir.c
   branches/SAMBA_3_2/source/smbd/filename.c
   branches/SAMBA_3_2/source/smbd/mangle.c
   branches/SAMBA_3_2/source/smbd/mangle_hash.c
   branches/SAMBA_3_2/source/smbd/mangle_hash2.c
   branches/SAMBA_3_2/source/smbd/msdfs.c
   branches/SAMBA_3_2/source/smbd/nttrans.c
   branches/SAMBA_3_2/source/smbd/reply.c
   branches/SAMBA_3_2/source/smbd/statcache.c
   branches/SAMBA_3_2/source/smbd/trans2.c


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


svn commit: samba r25011 - in branches/SAMBA_3_2/source/smbd: .

2007-09-07 Thread jra
Author: jra
Date: 2007-09-07 22:54:43 + (Fri, 07 Sep 2007)
New Revision: 25011

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

Log:
We don't use mangle_map any more.
Jeremy.

Removed:
   branches/SAMBA_3_2/source/smbd/mangle_map.c


Changeset:
Deleted: branches/SAMBA_3_2/source/smbd/mangle_map.c
===
--- branches/SAMBA_3_2/source/smbd/mangle_map.c 2007-09-07 22:01:15 UTC (rev 
25010)
+++ branches/SAMBA_3_2/source/smbd/mangle_map.c 2007-09-07 22:54:43 UTC (rev 
25011)
@@ -1,211 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   Name mapping code 
-   Copyright (C) Jeremy Allison 1998
-   Copyright (C) Andrew Tridgell 2002
-   
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-   
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-   
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see http://www.gnu.org/licenses/.
-*/
-
-#include includes.h
-
-
-/* ** 
**
- * Used only in do_fwd_mangled_map(), below.
- * ** 
**
- */
-static char *map_filename( char *s, /* This is null terminated */
-   const char *pattern,   /* This isn't. */
-   int len )/* This is the length of pattern. 
*/
-  {
-  static pstring matching_bit;  /* The bit of the string which matches */
-/* a * in pattern if indeed there is a * */
-  char *sp; /* Pointer into s. */
-  char *pp; /* Pointer into p. */
-  char *match_start;/* Where the matching bit starts. */
-  pstring pat;
-
-  StrnCpy( pat, pattern, len ); /* Get pattern into a proper string! */
-  pstrcpy( matching_bit,  );  /* Match but no star gets this. */
-  pp = pat; /* Initialize the pointers. */
-  sp = s;
-
-  if( strequal(s, .) || strequal(s, ..))
-{
-return NULL;/* Do not map '.' and '..' */
-}
-
-  if( (len == 1)  (*pattern == '*') )
-{
-return NULL;/* Impossible, too ambiguous for */
-}   /* words! */
-
-  while( (*sp)  /* Not the end of the string. */
-   (*pp)  /* Not the end of the pattern. */
-   (*sp == *pp)   /* The two match. */
-   (*pp != '*') ) /* No wildcard. */
-{
-sp++;   /* Keep looking. */
-pp++;
-}
-
-  if( !*sp  !*pp )/* End of pattern. */
-return( matching_bit ); /* Simple match.  Return empty string. */
-
-  if( *pp == '*' )
-{
-pp++;   /* Always interrested in the chacter */
-/* after the '*' */
-if( !*pp )  /* It is at the end of the pattern. */
-  {
-  StrnCpy( matching_bit, s, sp-s );
-  return( matching_bit );
-  }
-else
-  {
-  /* The next character in pattern must match a character further */
-  /* along s than sp so look for that character. */
-  match_start = sp;
-  while( (*sp)  /* Not the end of s. */
-   (*sp != *pp) ) /* Not the same  */
-sp++;   /* Keep looking. */
-  if( !*sp )/* Got to the end without a match. */
-{
-return( NULL );
-}   /* Still hope for a match. */
-  else
-{
-/* Now sp should point to a matching character. */
-StrnCpy(matching_bit, match_start, sp-match_start);
-/* Back to needing a stright match again. */
-while( (*sp)/* Not the end of the string. */
- (*pp)/* Not the end of the pattern. */
- (*sp == *pp) )   /* The two match. */
-  {
-  sp++; /* Keep looking. */
-  pp++;
-  }
-if( !*sp  !*pp )  /* Both at end so it matched */
-  return( matching_bit );
-else
-  return( NULL );
-}
-  }
-}
-  return( NULL );   /* No match. */
-  } /* map_filename */
-
-
-/* ** 
**
- * MangledMap is a series of name pairs in () separated by spaces.
- * If s matches the first of the pair then the name given is the
- * second of the pair.  A * means any number of any character

svn commit: samba r25019 - in branches: SAMBA_3_2/source/utils SAMBA_3_2_0/source/utils

2007-09-07 Thread jra
Author: jra
Date: 2007-09-08 04:45:59 + (Sat, 08 Sep 2007)
New Revision: 25019

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

Log:
Fix coverity bug #105, run #332. Use of uninitialized variable.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/utils/net_sam.c
   branches/SAMBA_3_2_0/source/utils/net_sam.c


Changeset:
Modified: branches/SAMBA_3_2/source/utils/net_sam.c
===
--- branches/SAMBA_3_2/source/utils/net_sam.c   2007-09-08 01:40:24 UTC (rev 
25018)
+++ branches/SAMBA_3_2/source/utils/net_sam.c   2007-09-08 04:45:59 UTC (rev 
25019)
@@ -362,7 +362,8 @@
 static int net_sam_policy_set(int argc, const char **argv)
 {
const char *account_policy = NULL;
-   uint32 value, old_value;
+   uint32 value = 0;
+   uint32 old_value = 0;
int field;
char *endptr;
 
@@ -409,19 +410,20 @@
if (!pdb_get_account_policy(field, old_value)) {
d_fprintf(stderr, Valid account policy, but unable to fetch 
  value!\n);
+   } else {
+   d_printf(Account policy \%s\ value was: %d\n, 
account_policy,
+   old_value);
}
 
if (!pdb_set_account_policy(field, value)) {
d_fprintf(stderr, Valid account policy, but unable to 
  set value!\n);
return -1;
+   } else {
+   d_printf(Account policy \%s\ value is now: %d\n, 
account_policy,
+   value);
}
 
-   d_printf(Account policy \%s\ value was: %d\n, account_policy,
-old_value);
-
-   d_printf(Account policy \%s\ value is now: %d\n, account_policy,
-value);
return 0;
 }
 

Modified: branches/SAMBA_3_2_0/source/utils/net_sam.c
===
--- branches/SAMBA_3_2_0/source/utils/net_sam.c 2007-09-08 01:40:24 UTC (rev 
25018)
+++ branches/SAMBA_3_2_0/source/utils/net_sam.c 2007-09-08 04:45:59 UTC (rev 
25019)
@@ -362,7 +362,8 @@
 static int net_sam_policy_set(int argc, const char **argv)
 {
const char *account_policy = NULL;
-   uint32 value, old_value;
+   uint32 value = 0;
+   uint32 old_value = 0;
int field;
char *endptr;
 
@@ -409,19 +410,20 @@
if (!pdb_get_account_policy(field, old_value)) {
d_fprintf(stderr, Valid account policy, but unable to fetch 
  value!\n);
+   } else {
+   d_printf(Account policy \%s\ value was: %d\n, 
account_policy,
+   old_value);
}
 
if (!pdb_set_account_policy(field, value)) {
d_fprintf(stderr, Valid account policy, but unable to 
  set value!\n);
return -1;
+   } else {
+   d_printf(Account policy \%s\ value is now: %d\n, 
account_policy,
+   value);
}
 
-   d_printf(Account policy \%s\ value was: %d\n, account_policy,
-old_value);
-
-   d_printf(Account policy \%s\ value is now: %d\n, account_policy,
-value);
return 0;
 }
 



svn commit: samba r25020 - in branches: SAMBA_3_2/source/nsswitch SAMBA_3_2_0/source/nsswitch

2007-09-07 Thread jra
Author: jra
Date: 2007-09-08 04:57:17 + (Sat, 08 Sep 2007)
New Revision: 25020

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

Log:
Fix coverity #374, possible null deref.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/nsswitch/winbindd_util.c
   branches/SAMBA_3_2_0/source/nsswitch/winbindd_util.c


Changeset:
Modified: branches/SAMBA_3_2/source/nsswitch/winbindd_util.c
===
--- branches/SAMBA_3_2/source/nsswitch/winbindd_util.c  2007-09-08 04:45:59 UTC 
(rev 25019)
+++ branches/SAMBA_3_2/source/nsswitch/winbindd_util.c  2007-09-08 04:57:17 UTC 
(rev 25020)
@@ -146,7 +146,7 @@
/* See if we found a match.  Check if we need to update the
   SID. */
 
-   if ( domain ) {
+   if ( domain  sid) {
if ( sid_equal( domain-sid, global_sid_NULL ) )
sid_copy( domain-sid, sid );
 
@@ -305,10 +305,10 @@
}   
}
 
-   /* use the real alt_name if we have one, else pass in 
NULL */
+   /* use the real alt_name if we have one, else pass in NULL */
 
-   if ( !strequal( alt_name, (null) ) )
-   alternate_name = alt_name;
+   if ( !strequal( alt_name, (null) ) )
+   alternate_name = alt_name;
 
/* If we have an existing domain structure, calling
   add_trusted_domain() will update the SID if

Modified: branches/SAMBA_3_2_0/source/nsswitch/winbindd_util.c
===
--- branches/SAMBA_3_2_0/source/nsswitch/winbindd_util.c2007-09-08 
04:45:59 UTC (rev 25019)
+++ branches/SAMBA_3_2_0/source/nsswitch/winbindd_util.c2007-09-08 
04:57:17 UTC (rev 25020)
@@ -147,7 +147,7 @@
/* See if we found a match.  Check if we need to update the
   SID. */
 
-   if ( domain ) {
+   if ( domain  sid) {
if ( sid_equal( domain-sid, global_sid_NULL ) )
sid_copy( domain-sid, sid );
 
@@ -306,10 +306,10 @@
}   
}
 
-   /* use the real alt_name if we have one, else pass in 
NULL */
+   /* use the real alt_name if we have one, else pass in NULL */
 
-   if ( !strequal( alt_name, (null) ) )
-   alternate_name = alt_name;
+   if ( !strequal( alt_name, (null) ) )
+   alternate_name = alt_name;
 
/* If we have an existing domain structure, calling
   add_trusted_domain() will update the SID if



svn commit: samba r25021 - in branches: SAMBA_3_2/source/nmbd SAMBA_3_2_0/source/nmbd

2007-09-07 Thread jra
Author: jra
Date: 2007-09-08 05:12:17 + (Sat, 08 Sep 2007)
New Revision: 25021

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

Log:
Fix coverity #435. Use of -1.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/nmbd/nmbd_subnetdb.c
   branches/SAMBA_3_2_0/source/nmbd/nmbd_subnetdb.c


Changeset:
Modified: branches/SAMBA_3_2/source/nmbd/nmbd_subnetdb.c
===
--- branches/SAMBA_3_2/source/nmbd/nmbd_subnetdb.c  2007-09-08 04:57:17 UTC 
(rev 25020)
+++ branches/SAMBA_3_2/source/nmbd/nmbd_subnetdb.c  2007-09-08 05:12:17 UTC 
(rev 25021)
@@ -124,8 +124,12 @@
subrec = SMB_MALLOC_P(struct subnet_record);
if (!subrec) {
DEBUG(0,(make_subnet: malloc fail !\n));
-   close(nmb_sock);
-   close(dgram_sock);
+   if (nmb_sock != -1) {
+   close(nmb_sock);
+   }
+   if (dgram_sock != -1) {
+   close(dgram_sock);
+   }
return(NULL);
}
   
@@ -133,8 +137,12 @@
 
if((subrec-subnet_name = SMB_STRDUP(name)) == NULL) {
DEBUG(0,(make_subnet: malloc fail for subnet name !\n));
-   close(nmb_sock);
-   close(dgram_sock);
+   if (nmb_sock != -1) {
+   close(nmb_sock);
+   }
+   if (dgram_sock != -1) {
+   close(dgram_sock);
+   }
ZERO_STRUCTP(subrec);
SAFE_FREE(subrec);
return(NULL);

Modified: branches/SAMBA_3_2_0/source/nmbd/nmbd_subnetdb.c
===
--- branches/SAMBA_3_2_0/source/nmbd/nmbd_subnetdb.c2007-09-08 04:57:17 UTC 
(rev 25020)
+++ branches/SAMBA_3_2_0/source/nmbd/nmbd_subnetdb.c2007-09-08 05:12:17 UTC 
(rev 25021)
@@ -124,8 +124,12 @@
subrec = SMB_MALLOC_P(struct subnet_record);
if (!subrec) {
DEBUG(0,(make_subnet: malloc fail !\n));
-   close(nmb_sock);
-   close(dgram_sock);
+   if (nmb_sock != -1) {
+   close(nmb_sock);
+   }
+   if (dgram_sock != -1) {
+   close(dgram_sock);
+   }
return(NULL);
}
   
@@ -133,8 +137,12 @@
 
if((subrec-subnet_name = SMB_STRDUP(name)) == NULL) {
DEBUG(0,(make_subnet: malloc fail for subnet name !\n));
-   close(nmb_sock);
-   close(dgram_sock);
+   if (nmb_sock != -1) {
+   close(nmb_sock);
+   }
+   if (dgram_sock != -1) {
+   close(dgram_sock);
+   }
ZERO_STRUCTP(subrec);
SAFE_FREE(subrec);
return(NULL);



svn commit: samba r25022 - in branches: SAMBA_3_2/source/nsswitch SAMBA_3_2_0/source/nsswitch

2007-09-07 Thread jra
Author: jra
Date: 2007-09-08 05:18:08 + (Sat, 08 Sep 2007)
New Revision: 25022

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

Log:
Fix coverity #395. Resource leak on error.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/nsswitch/wins.c
   branches/SAMBA_3_2_0/source/nsswitch/wins.c


Changeset:
Modified: branches/SAMBA_3_2/source/nsswitch/wins.c
===
--- branches/SAMBA_3_2/source/nsswitch/wins.c   2007-09-08 05:12:17 UTC (rev 
25021)
+++ branches/SAMBA_3_2/source/nsswitch/wins.c   2007-09-08 05:18:08 UTC (rev 
25022)
@@ -315,8 +315,10 @@
 
namelen = strlen(name) + 1;
 
-   if ((he-h_name = get_static(buffer, buflen, namelen)) == NULL)
+   if ((he-h_name = get_static(buffer, buflen, namelen)) == NULL) {
+   free(ip_list);
return NSS_STATUS_TRYAGAIN;
+   }
 
memcpy(he-h_name, name, namelen);
 
@@ -325,24 +327,29 @@
if ((i = (unsigned long)(buffer) % sizeof(char*)) != 0)
i = sizeof(char*) - i;
 
-   if (get_static(buffer, buflen, i) == NULL)
+   if (get_static(buffer, buflen, i) == NULL) {
+   free(ip_list);
return NSS_STATUS_TRYAGAIN;
+   }
 
if ((he-h_addr_list = (char **)get_static(
-buffer, buflen, (count + 1) * sizeof(char *))) == NULL)
+buffer, buflen, (count + 1) * sizeof(char *))) == NULL) {
+   free(ip_list);
return NSS_STATUS_TRYAGAIN;
+   }
 
for (i = 0; i  count; i++) {
if ((he-h_addr_list[i] = get_static(buffer, buflen,
-INADDRSZ)) == NULL)
+INADDRSZ)) == NULL) {
+   free(ip_list);
return NSS_STATUS_TRYAGAIN;
+   }
memcpy(he-h_addr_list[i], ip_list[i], INADDRSZ);
}
 
he-h_addr_list[count] = NULL;
 
-   if (ip_list)
-   free(ip_list);
+   free(ip_list);
 
/* Set h_addr_type and h_length */
 

Modified: branches/SAMBA_3_2_0/source/nsswitch/wins.c
===
--- branches/SAMBA_3_2_0/source/nsswitch/wins.c 2007-09-08 05:12:17 UTC (rev 
25021)
+++ branches/SAMBA_3_2_0/source/nsswitch/wins.c 2007-09-08 05:18:08 UTC (rev 
25022)
@@ -315,8 +315,10 @@
 
namelen = strlen(name) + 1;
 
-   if ((he-h_name = get_static(buffer, buflen, namelen)) == NULL)
+   if ((he-h_name = get_static(buffer, buflen, namelen)) == NULL) {
+   free(ip_list);
return NSS_STATUS_TRYAGAIN;
+   }
 
memcpy(he-h_name, name, namelen);
 
@@ -325,24 +327,29 @@
if ((i = (unsigned long)(buffer) % sizeof(char*)) != 0)
i = sizeof(char*) - i;
 
-   if (get_static(buffer, buflen, i) == NULL)
+   if (get_static(buffer, buflen, i) == NULL) {
+   free(ip_list);
return NSS_STATUS_TRYAGAIN;
+   }
 
if ((he-h_addr_list = (char **)get_static(
-buffer, buflen, (count + 1) * sizeof(char *))) == NULL)
+buffer, buflen, (count + 1) * sizeof(char *))) == NULL) {
+   free(ip_list);
return NSS_STATUS_TRYAGAIN;
+   }
 
for (i = 0; i  count; i++) {
if ((he-h_addr_list[i] = get_static(buffer, buflen,
-INADDRSZ)) == NULL)
+INADDRSZ)) == NULL) {
+   free(ip_list);
return NSS_STATUS_TRYAGAIN;
+   }
memcpy(he-h_addr_list[i], ip_list[i], INADDRSZ);
}
 
he-h_addr_list[count] = NULL;
 
-   if (ip_list)
-   free(ip_list);
+   free(ip_list);
 
/* Set h_addr_type and h_length */
 



svn commit: samba r25023 - in branches: SAMBA_3_2/source/rpc_server SAMBA_3_2_0/source/rpc_server

2007-09-07 Thread jra
Author: jra
Date: 2007-09-08 05:35:10 + (Sat, 08 Sep 2007)
New Revision: 25023

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

Log:
Coverity #455. Not actually a bug, but this clarifies
the code a lot.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/rpc_server/srv_pipe_hnd.c
   branches/SAMBA_3_2_0/source/rpc_server/srv_pipe_hnd.c


Changeset:
Modified: branches/SAMBA_3_2/source/rpc_server/srv_pipe_hnd.c
===
--- branches/SAMBA_3_2/source/rpc_server/srv_pipe_hnd.c 2007-09-08 05:18:08 UTC 
(rev 25022)
+++ branches/SAMBA_3_2/source/rpc_server/srv_pipe_hnd.c 2007-09-08 05:35:10 UTC 
(rev 25023)
@@ -1033,6 +1033,7 @@
if(n  RPC_MAX_PDU_FRAG_LEN) {
 DEBUG(5,(read_from_pipe: too large read (%u) requested on \
 pipe %s. We can only service %d sized reads.\n, (unsigned int)n, p-name, 
RPC_MAX_PDU_FRAG_LEN ));
+   n = RPC_MAX_PDU_FRAG_LEN;
}
 
/*

Modified: branches/SAMBA_3_2_0/source/rpc_server/srv_pipe_hnd.c
===
--- branches/SAMBA_3_2_0/source/rpc_server/srv_pipe_hnd.c   2007-09-08 
05:18:08 UTC (rev 25022)
+++ branches/SAMBA_3_2_0/source/rpc_server/srv_pipe_hnd.c   2007-09-08 
05:35:10 UTC (rev 25023)
@@ -1035,6 +1035,7 @@
if(n  RPC_MAX_PDU_FRAG_LEN) {
 DEBUG(5,(read_from_pipe: too large read (%u) requested on \
 pipe %s. We can only service %d sized reads.\n, (unsigned int)n, p-name, 
RPC_MAX_PDU_FRAG_LEN ));
+   n = RPC_MAX_PDU_FRAG_LEN;
}
 
/*



svn commit: samba r24808 - in branches: SAMBA_3_2/source/libaddns SAMBA_3_2_0/source/libaddns

2007-08-30 Thread jra
Author: jra
Date: 2007-08-30 17:34:47 + (Thu, 30 Aug 2007)
New Revision: 24808

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

Log:
Fix the same problem Volker noticed.

For some funny reason us4/gcc seems to fall over the '

Jeremy.

Modified:
   branches/SAMBA_3_2/source/libaddns/dns.h
   branches/SAMBA_3_2_0/source/libaddns/dns.h


Changeset:
Modified: branches/SAMBA_3_2/source/libaddns/dns.h
===
--- branches/SAMBA_3_2/source/libaddns/dns.h2007-08-30 16:24:51 UTC (rev 
24807)
+++ branches/SAMBA_3_2/source/libaddns/dns.h2007-08-30 17:34:47 UTC (rev 
24808)
@@ -88,7 +88,7 @@
 
 #if 0
 
-Disable these now we've checked all code paths and ensured
+Disable these now we have checked all code paths and ensured
 NULL returns on zero request. JRA.
 
 void *_talloc_zero_zeronull(const void *ctx, size_t size, const char *name);

Modified: branches/SAMBA_3_2_0/source/libaddns/dns.h
===
--- branches/SAMBA_3_2_0/source/libaddns/dns.h  2007-08-30 16:24:51 UTC (rev 
24807)
+++ branches/SAMBA_3_2_0/source/libaddns/dns.h  2007-08-30 17:34:47 UTC (rev 
24808)
@@ -88,7 +88,7 @@
 
 #if 0
 
-Disable these now we've checked all code paths and ensured
+Disable these now we have checked all code paths and ensured
 NULL returns on zero request. JRA.
 
 void *_talloc_zero_zeronull(const void *ctx, size_t size, const char *name);



svn commit: samba r24811 - in branches: SAMBA_3_2/source/smbd SAMBA_3_2_0/source/smbd

2007-08-30 Thread jra
Author: jra
Date: 2007-08-30 21:46:42 + (Thu, 30 Aug 2007)
New Revision: 24811

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

Log:
Simple reformatting to fit the 80 columns rule.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/smbd/filename.c
   branches/SAMBA_3_2_0/source/smbd/filename.c


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


svn commit: samba r24813 - in branches: SAMBA_3_2/source/smbd SAMBA_3_2_0/source/smbd

2007-08-30 Thread jra
Author: jra
Date: 2007-08-30 23:07:10 + (Thu, 30 Aug 2007)
New Revision: 24813

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

Log:
Reformat to 80 columns.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/smbd/statcache.c
   branches/SAMBA_3_2_0/source/smbd/statcache.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/statcache.c
===
--- branches/SAMBA_3_2/source/smbd/statcache.c  2007-08-30 22:25:59 UTC (rev 
24812)
+++ branches/SAMBA_3_2/source/smbd/statcache.c  2007-08-30 23:07:10 UTC (rev 
24813)
@@ -1,21 +1,21 @@
-/* 
+/*
Unix SMB/CIFS implementation.
stat cache code
Copyright (C) Andrew Tridgell 1992-2000
Copyright (C) Jeremy Allison 1999-2004
Copyright (C) Andrew Bartlett [EMAIL PROTECTED] 2003
Copyright (C) Volker Lendecke 2007
-   
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-   
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
-   
+
You should have received a copy of the GNU General Public License
along with this program.  If not, see http://www.gnu.org/licenses/.
 */
@@ -33,14 +33,15 @@
  *
  * @param full_orig_name   The original name as specified by the client
  * @param orig_translated_path The name on our filesystem.
- * 
- * @note Only the first strlen(orig_translated_path) characters are stored 
+ *
+ * @note Only the first strlen(orig_translated_path) characters are stored
  *   into the cache.  This means that full_orig_name will be internally
  *   truncated.
  *
  */
 
-void stat_cache_add( const char *full_orig_name, const char *translated_path, 
BOOL case_sensitive)
+void stat_cache_add( const char *full_orig_name, const char *translated_path,
+   BOOL case_sensitive)
 {
size_t translated_path_length;
TDB_DATA data_val;
@@ -111,8 +112,12 @@
 
if (original_path_length != translated_path_length) {
if (original_path_length  translated_path_length) {
-   DEBUG(0, (OOPS - tried to store stat cache entry for 
weird length paths [%s] %lu and [%s] %lu)!\n,
- original_path, (unsigned 
long)original_path_length, translated_path, (unsigned 
long)translated_path_length));
+   DEBUG(0, (OOPS - tried to store stat cache entry 
+   for weird length paths [%s] %lu and [%s] %lu)!\n,
+ original_path,
+ (unsigned long)original_path_length,
+ translated_path,
+ (unsigned long)translated_path_length));
SAFE_FREE(original_path);
return;
}
@@ -127,15 +132,20 @@
/*
 * New entry or replace old entry.
 */
-  
+
data_val.dsize = translated_path_length + 1;
data_val.dptr = (uint8 *)translated_path;
 
-   if (tdb_store_bystring(tdb_stat_cache, original_path, data_val, 
TDB_REPLACE) != 0) {
-   DEBUG(0,(stat_cache_add: Error storing entry %s - %s\n, 
original_path, translated_path));
+   if (tdb_store_bystring(tdb_stat_cache, original_path, data_val,
+   TDB_REPLACE) != 0) {
+   DEBUG(0,(stat_cache_add: Error storing entry %s - %s\n,
+   original_path, translated_path));
} else {
DEBUG(5,(stat_cache_add: Added entry (%lx:size%x) %s - %s\n,
-   (unsigned long)data_val.dptr, (unsigned 
int)data_val.dsize, original_path, translated_path));
+   (unsigned long)data_val.dptr,
+   (unsigned int)data_val.dsize,
+   original_path,
+   translated_path));
}
 
SAFE_FREE(original_path);
@@ -149,10 +159,12 @@
  *to be correct as far as the cache can tell us. We assume that
  *   it is a malloc'ed string, we free it if necessary.
  * @param dirpath The path as far as the stat cache told us.
- * @param start   A pointer into name, for where to 'start' in fixing the rest 
of the name up.
+ * @param start   A pointer into name, for where to 'start' in fixing the rest
+ *   of the name up.
  * @param psd A stat buffer, NOT from the cache, but just a side-effect.
  *
- * @return True if we translated (and did a scuccessful stat on) the entire 
name.
+ * @return True if we translated (and did a scuccessful stat on) the entire

svn commit: samba r24787 - in branches/SAMBA_3_2_0/source: rpc_parse utils

2007-08-29 Thread jra
Author: jra
Date: 2007-08-29 17:14:54 + (Wed, 29 Aug 2007)
New Revision: 24787

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

Log:
Janitor for Mimir. Mimir, you checked into SAMBA_3_2 and
SAMBA_3_0 - this second branch is defunct. You should
be checking into SAMBA_3_2_0 instead - this is what we
will be shipping as 3.2.0.
Jeremy.

Use infolevel 25 to set the machine account's password (just like winxp).
This correctly updates pwdLastSet field on win2k3 server.


Modified:
   branches/SAMBA_3_2_0/source/rpc_parse/parse_samr.c
   branches/SAMBA_3_2_0/source/utils/net_domain.c


Changeset:
Modified: branches/SAMBA_3_2_0/source/rpc_parse/parse_samr.c
===
--- branches/SAMBA_3_2_0/source/rpc_parse/parse_samr.c  2007-08-29 14:50:04 UTC 
(rev 24786)
+++ branches/SAMBA_3_2_0/source/rpc_parse/parse_samr.c  2007-08-29 17:14:54 UTC 
(rev 24787)
@@ -5860,6 +5860,25 @@
}
 }
 
+
+/*
+ init_samr_user_info25P
+ fields_present = ACCT_NT_PWD_SET | ACCT_LM_PWD_SET | ACCT_FLAGS
+*/
+
+void init_sam_user_info25P(SAM_USER_INFO_25 * usr,
+  uint32 fields_present, uint32 acb_info,
+  char newpass[532])
+{
+   usr-fields_present = fields_present;
+   ZERO_STRUCT(usr-padding1);
+   ZERO_STRUCT(usr-padding2);
+
+   usr-acb_info = acb_info;
+   memcpy(usr-pass, newpass, sizeof(usr-pass));
+}
+
+
 /***
 reads or writes a structure.
 /

Modified: branches/SAMBA_3_2_0/source/utils/net_domain.c
===
--- branches/SAMBA_3_2_0/source/utils/net_domain.c  2007-08-29 14:50:04 UTC 
(rev 24786)
+++ branches/SAMBA_3_2_0/source/utils/net_domain.c  2007-08-29 17:14:54 UTC 
(rev 24787)
@@ -208,10 +208,14 @@
uint32 num_rids, *name_types, *user_rids;
uint32 flags = 0x3e8;
uint32 acb_info = ACB_WSTRUST;
-   uchar pwbuf[516];
+   uint32 fields_present;
+   uchar pwbuf[532];
SAM_USERINFO_CTR ctr;
-   SAM_USER_INFO_24 p24;
-   SAM_USER_INFO_16 p16;
+   SAM_USER_INFO_25 p25;
+   const int infolevel = 25;
+   struct MD5Context md5ctx;
+   uchar md5buffer[16];
+   DATA_BLOB digested_session_key;
uchar md4_trust_password[16];
 
/* Open the domain */
@@ -282,24 +286,49 @@
 
status = rpccli_samr_open_user(pipe_hnd, mem_ctx, domain_pol,
SEC_RIGHTS_MAXIMUM_ALLOWED, user_rid, user_pol);
+   if (!NT_STATUS_IS_OK(status)) {
+   return status;
+   }

-   /* Create a random machine account password */
+   /* Create a random machine account password and generate the hash */
 
-   E_md4hash( clear_pw, md4_trust_password);
+   E_md4hash(clear_pw, md4_trust_password);
encode_pw_buffer(pwbuf, clear_pw, STR_UNICODE);
+   
+   generate_random_buffer((uint8*)md5buffer, sizeof(md5buffer));
+   digested_session_key = data_blob_talloc(mem_ctx, 0, 16);
+   
+   MD5Init(md5ctx);
+   MD5Update(md5ctx, md5buffer, sizeof(md5buffer));
+   MD5Update(md5ctx, cli-user_session_key.data, 
cli-user_session_key.length);
+   MD5Final(digested_session_key.data, md5ctx);
+   
+   SamOEMhashBlob(pwbuf, sizeof(pwbuf), digested_session_key);
+   memcpy(pwbuf[516], md5buffer, sizeof(md5buffer));
 
-   /* Set password on machine account */
+   /* Fill in the additional account flags now */
 
+   acb_info |= ACB_PWNOEXP;
+   if ( dom_type == ND_TYPE_AD ) {
+#if !defined(ENCTYPE_ARCFOUR_HMAC)
+   acb_info |= ACB_USE_DES_KEY_ONLY;
+#endif
+   ;;
+   }
+
+   /* Set password and account flags on machine account */
+
ZERO_STRUCT(ctr);
-   ZERO_STRUCT(p24);
+   ZERO_STRUCT(p25);
 
-   init_sam_user_info24(p24, (char *)pwbuf,24);
+   fields_present = ACCT_NT_PWD_SET | ACCT_LM_PWD_SET | ACCT_FLAGS;
+   init_sam_user_info25P(p25, fields_present, acb_info, (char *)pwbuf);
 
-   ctr.switch_value = 24;
-   ctr.info.id24 = p24;
+   ctr.switch_value = infolevel;
+   ctr.info.id25= p25;
 
-   status = rpccli_samr_set_userinfo(pipe_hnd, mem_ctx, user_pol, 
-   24, cli-user_session_key, ctr);
+   status = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, user_pol,
+  infolevel, cli-user_session_key, 
ctr);
 
if ( !NT_STATUS_IS_OK(status) ) {
d_fprintf( stderr, Failed to set password for machine account 
(%s)\n, 
@@ -307,35 +336,6 @@
return status;
}
 
-
-   /* Why do we have to try

svn commit: samba r24790 - in branches/SAMBA_3_0_25/source/smbd: .

2007-08-29 Thread jra
Author: jra
Date: 2007-08-29 20:36:42 + (Wed, 29 Aug 2007)
New Revision: 24790

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

Log:
Fix logic error in timeout of blocking lock processing found by
Volker. If a lock timeout expires, we must check we can get the
lock before responding with failure. I'll port this to 3.2.x
next. Volker is writing a torture test.
Jeremy.

Modified:
   branches/SAMBA_3_0_25/source/smbd/blocking.c


Changeset:
Modified: branches/SAMBA_3_0_25/source/smbd/blocking.c
===
--- branches/SAMBA_3_0_25/source/smbd/blocking.c2007-08-29 19:55:13 UTC 
(rev 24789)
+++ branches/SAMBA_3_0_25/source/smbd/blocking.c2007-08-29 20:36:42 UTC 
(rev 24790)
@@ -685,18 +685,14 @@
DEBUG(5,(process_blocking_lock_queue: examining pending lock 
fnum = %d for file %s\n,
fsp-fnum, fsp-fsp_name ));
 
-   if (!timeval_is_zero(blr-expire_time)  
timeval_compare(blr-expire_time, tv_curr) = 0) {
+   if(!change_to_user(conn,vuid)) {
struct byte_range_lock *br_lck = brl_get_locks(NULL, 
fsp);
 
/*
-* Lock expired - throw away all previously
-* obtained locks and return lock error.
+* Remove the entry and return an error to the client.
 */
 
if (br_lck) {
-   DEBUG(5,(process_blocking_lock_queue: pending 
lock fnum = %d for file %s timed out.\n,
-   fsp-fnum, fsp-fsp_name ));
-
brl_lock_cancel(br_lck,
blr-lock_pid,
procid_self(),
@@ -706,13 +702,15 @@
TALLOC_FREE(br_lck);
}
 
-   
blocking_lock_reply_error(blr,NT_STATUS_FILE_LOCK_CONFLICT);
+   DEBUG(0,(process_blocking_lock_queue: Unable to become 
user vuid=%d.\n,
+   vuid ));
+   blocking_lock_reply_error(blr,NT_STATUS_ACCESS_DENIED);
DLIST_REMOVE(blocking_lock_queue, blr);
free_blocking_lock_record(blr);
continue;
}
 
-   if(!change_to_user(conn,vuid)) {
+   if(!set_current_service(conn,SVAL(blr-inbuf,smb_flg),True)) {
struct byte_range_lock *br_lck = brl_get_locks(NULL, 
fsp);
 
/*
@@ -729,21 +727,23 @@
TALLOC_FREE(br_lck);
}
 
-   DEBUG(0,(process_blocking_lock_queue: Unable to become 
user vuid=%d.\n,
-   vuid ));
+   DEBUG(0,(process_blocking_lock_queue: Unable to become 
service Error was %s.\n, strerror(errno) ));
blocking_lock_reply_error(blr,NT_STATUS_ACCESS_DENIED);
DLIST_REMOVE(blocking_lock_queue, blr);
free_blocking_lock_record(blr);
+   change_to_root_user();
continue;
}
 
-   if(!set_current_service(conn,SVAL(blr-inbuf,smb_flg),True)) {
+   /*
+* Go through the remaining locks and try and obtain them.
+* The call returns True if all locks were obtained successfully
+* and False if we still need to wait.
+*/
+
+   if(blocking_lock_record_process(blr)) {
struct byte_range_lock *br_lck = brl_get_locks(NULL, 
fsp);
 
-   /*
-* Remove the entry and return an error to the client.
-*/
-
if (br_lck) {
brl_lock_cancel(br_lck,
blr-lock_pid,
@@ -754,24 +754,31 @@
TALLOC_FREE(br_lck);
}
 
-   DEBUG(0,(process_blocking_lock_queue: Unable to become 
service Error was %s.\n, strerror(errno) ));
-   blocking_lock_reply_error(blr,NT_STATUS_ACCESS_DENIED);
DLIST_REMOVE(blocking_lock_queue, blr);
free_blocking_lock_record(blr);
change_to_root_user();
continue;
}
 
+   change_to_root_user();
+
/*
-* Go through the remaining locks and try and obtain them.
-* The call returns True if all locks were obtained successfully
-* and False if we still need to wait.
+* We couldn't get the locks for this record on the list

svn commit: samba r24791 - in branches: SAMBA_3_2/source/smbd SAMBA_3_2_0/source/smbd

2007-08-29 Thread jra
Author: jra
Date: 2007-08-29 20:49:09 + (Wed, 29 Aug 2007)
New Revision: 24791

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

Log:
Fix logic error in timeout of blocking lock processing found by
Ronnie. If a lock timeout expires, we must check we can get the
lock before responding with failure. Volker is writing a torture test.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/smbd/blocking.c
   branches/SAMBA_3_2_0/source/smbd/blocking.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/blocking.c
===
--- branches/SAMBA_3_2/source/smbd/blocking.c   2007-08-29 20:36:42 UTC (rev 
24790)
+++ branches/SAMBA_3_2/source/smbd/blocking.c   2007-08-29 20:49:09 UTC (rev 
24791)
@@ -702,18 +702,14 @@
DEBUG(5,(process_blocking_lock_queue: examining pending lock 
fnum = %d for file %s\n,
fsp-fnum, fsp-fsp_name ));
 
-   if (!timeval_is_zero(blr-expire_time)  
timeval_compare(blr-expire_time, tv_curr) = 0) {
+   if(!change_to_user(conn,vuid)) {
struct byte_range_lock *br_lck = brl_get_locks(NULL, 
fsp);
 
/*
-* Lock expired - throw away all previously
-* obtained locks and return lock error.
+* Remove the entry and return an error to the client.
 */
 
if (br_lck) {
-   DEBUG(5,(process_blocking_lock_queue: pending 
lock fnum = %d for file %s timed out.\n,
-   fsp-fnum, fsp-fsp_name ));
-
brl_lock_cancel(br_lck,
blr-lock_pid,
procid_self(),
@@ -723,14 +719,16 @@
TALLOC_FREE(br_lck);
}
 
-   
blocking_lock_reply_error(blr,NT_STATUS_FILE_LOCK_CONFLICT);
+   DEBUG(0,(process_blocking_lock_queue: Unable to become 
user vuid=%d.\n,
+   vuid ));
+   blocking_lock_reply_error(blr,NT_STATUS_ACCESS_DENIED);
DLIST_REMOVE(blocking_lock_queue, blr);
free_blocking_lock_record(blr);
recalc_timeout = True;
continue;
}
 
-   if(!change_to_user(conn,vuid)) {
+   if(!set_current_service(conn,SVAL(blr-inbuf,smb_flg),True)) {
struct byte_range_lock *br_lck = brl_get_locks(NULL, 
fsp);
 
/*
@@ -747,22 +745,24 @@
TALLOC_FREE(br_lck);
}
 
-   DEBUG(0,(process_blocking_lock_queue: Unable to become 
user vuid=%d.\n,
-   vuid ));
+   DEBUG(0,(process_blocking_lock_queue: Unable to become 
service Error was %s.\n, strerror(errno) ));
blocking_lock_reply_error(blr,NT_STATUS_ACCESS_DENIED);
DLIST_REMOVE(blocking_lock_queue, blr);
free_blocking_lock_record(blr);
recalc_timeout = True;
+   change_to_root_user();
continue;
}
 
-   if(!set_current_service(conn,SVAL(blr-inbuf,smb_flg),True)) {
+   /*
+* Go through the remaining locks and try and obtain them.
+* The call returns True if all locks were obtained successfully
+* and False if we still need to wait.
+*/
+
+   if(blocking_lock_record_process(blr)) {
struct byte_range_lock *br_lck = brl_get_locks(NULL, 
fsp);
 
-   /*
-* Remove the entry and return an error to the client.
-*/
-
if (br_lck) {
brl_lock_cancel(br_lck,
blr-lock_pid,
@@ -773,8 +773,6 @@
TALLOC_FREE(br_lck);
}
 
-   DEBUG(0,(process_blocking_lock_queue: Unable to become 
service Error was %s.\n, strerror(errno) ));
-   blocking_lock_reply_error(blr,NT_STATUS_ACCESS_DENIED);
DLIST_REMOVE(blocking_lock_queue, blr);
free_blocking_lock_record(blr);
recalc_timeout = True;
@@ -782,16 +780,25 @@
continue;
}
 
+   change_to_root_user();
+
/*
-* Go through the remaining locks and try and obtain them.
-* The call returns True if all locks were obtained successfully
-* and False

svn commit: samba r24759 - in branches: SAMBA_3_2/source/include SAMBA_3_2/source/lib SAMBA_3_2/source/libaddns SAMBA_3_2/source/rpc_parse SAMBA_3_2_0/source/include SAMBA_3_2_0/source/lib SAMBA_3_2_0

2007-08-28 Thread jra
Author: jra
Date: 2007-08-29 01:23:31 + (Wed, 29 Aug 2007)
New Revision: 24759

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

Log:
Comment out the _nonnull calls for 3.2.x, as agreed with tridge.
Leaving the commented out code for now, in case I need to re-test
some stuff.
Jeremy

Modified:
   branches/SAMBA_3_2/source/include/smb_macros.h
   branches/SAMBA_3_2/source/lib/util.c
   branches/SAMBA_3_2/source/libaddns/dns.h
   branches/SAMBA_3_2/source/rpc_parse/parse_prs.c
   branches/SAMBA_3_2_0/source/include/smb_macros.h
   branches/SAMBA_3_2_0/source/lib/util.c
   branches/SAMBA_3_2_0/source/libaddns/dns.h
   branches/SAMBA_3_2_0/source/rpc_parse/parse_prs.c


Changeset:
Modified: branches/SAMBA_3_2/source/include/smb_macros.h
===
--- branches/SAMBA_3_2/source/include/smb_macros.h  2007-08-29 00:56:13 UTC 
(rev 24758)
+++ branches/SAMBA_3_2/source/include/smb_macros.h  2007-08-29 01:23:31 UTC 
(rev 24759)
@@ -275,6 +275,11 @@
 
 /* The new talloc is paranoid malloc checker safe. */
 
+#if 0
+
+Disable these now we've checked all code paths and ensured
+NULL returns on zero request. JRA.
+
 #define TALLOC(ctx, size) talloc_zeronull(ctx, size, __location__)
 #define TALLOC_P(ctx, type) (type *)talloc_zeronull(ctx, sizeof(type), #type)
 #define TALLOC_ARRAY(ctx, type, count) (type *)_talloc_array_zeronull(ctx, 
sizeof(type), count, #type)
@@ -282,12 +287,27 @@
 #define TALLOC_ZERO(ctx, size) _talloc_zero_zeronull(ctx, size, __location__)
 #define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero_zeronull(ctx, 
sizeof(type), #type)
 #define TALLOC_ZERO_ARRAY(ctx, type, count) (type 
*)_talloc_zero_array_zeronull(ctx, sizeof(type), count, #type)
+#define TALLOC_SIZE(ctx, size) talloc_zeronull(ctx, size, __location__)
+#define TALLOC_ZERO_SIZE(ctx, size) _talloc_zero_zeronull(ctx, size, 
__location__)
+
+#else
+
+#define TALLOC(ctx, size) talloc_named_const(ctx, size, __location__)
+#define TALLOC_P(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), 
#type)
+#define TALLOC_ARRAY(ctx, type, count) (type *)_talloc_array(ctx, 
sizeof(type), count, #type)
+#define TALLOC_MEMDUP(ctx, ptr, size) _talloc_memdup(ctx, ptr, size, 
__location__)
+#define TALLOC_ZERO(ctx, size) _talloc_zero(ctx, size, __location__)
+#define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type)
+#define TALLOC_ZERO_ARRAY(ctx, type, count) (type *)_talloc_zero_array(ctx, 
sizeof(type), count, #type)
+#define TALLOC_SIZE(ctx, size) talloc(ctx, size, __location__)
+#define TALLOC_ZERO_SIZE(ctx, size) _talloc_zero(ctx, size, __location__)
+
+#endif
+
 #define TALLOC_REALLOC(ctx, ptr, count) _talloc_realloc(ctx, ptr, count, 
__location__)
 #define TALLOC_REALLOC_ARRAY(ctx, ptr, type, count) (type 
*)_talloc_realloc_array(ctx, ptr, sizeof(type), count, #type)
 #define talloc_destroy(ctx) talloc_free(ctx)
 #define TALLOC_FREE(ctx) do { if ((ctx) != NULL) {talloc_free(ctx); ctx=NULL;} 
} while(0)
-#define TALLOC_SIZE(ctx, size) talloc_zeronull(ctx, size, __location__)
-#define TALLOC_ZERO_SIZE(ctx, size) _talloc_zero_zeronull(ctx, size, 
__location__)
 
 /* only define PARANOID_MALLOC_CHECKER with --enable-developer and not 
compiling
the smbmount utils */

Modified: branches/SAMBA_3_2/source/lib/util.c
===
--- branches/SAMBA_3_2/source/lib/util.c2007-08-29 00:56:13 UTC (rev 
24758)
+++ branches/SAMBA_3_2/source/lib/util.c2007-08-29 01:23:31 UTC (rev 
24759)
@@ -3314,6 +3314,11 @@
return IVAL(ptr,off);
 }
 
+#if 0
+
+Disable these now we've checked all code paths and ensured
+NULL returns on zero request. JRA.
+
 /
  talloc wrapper functions that guarentee a null pointer return
  if size == 0.
@@ -3412,3 +3417,4 @@
}
return talloc_named_const(context, size, name);
 }
+#endif

Modified: branches/SAMBA_3_2/source/libaddns/dns.h
===
--- branches/SAMBA_3_2/source/libaddns/dns.h2007-08-29 00:56:13 UTC (rev 
24758)
+++ branches/SAMBA_3_2/source/libaddns/dns.h2007-08-29 01:23:31 UTC (rev 
24759)
@@ -86,6 +86,11 @@
 
 #include talloc.h
 
+#if 0
+
+Disable these now we've checked all code paths and ensured
+NULL returns on zero request. JRA.
+
 void *_talloc_zero_zeronull(const void *ctx, size_t size, const char *name);
 void *_talloc_memdup_zeronull(const void *t, const void *p, size_t size, const 
char *name);
 void *_talloc_array_zeronull(const void *ctx, size_t el_size, unsigned count, 
const char *name);
@@ -99,12 +104,27 @@
 #define TALLOC_ZERO(ctx, size) _talloc_zero_zeronull(ctx, size, __location__)
 #define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero_zeronull(ctx, 
sizeof(type), #type)
 #define TALLOC_ZERO_ARRAY(ctx, type, count) (type 
*)_talloc_zero_array_zeronull(ctx

svn commit: samba r24762 - in branches: SAMBA_3_2/source/include SAMBA_3_2_0/source/include

2007-08-28 Thread jra
Author: jra
Date: 2007-08-29 01:48:46 + (Wed, 29 Aug 2007)
New Revision: 24762

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

Log:
Fix the build, missed TALLOC_SIZE - talloc_named_const.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/include/smb_macros.h
   branches/SAMBA_3_2_0/source/include/smb_macros.h


Changeset:
Modified: branches/SAMBA_3_2/source/include/smb_macros.h
===
--- branches/SAMBA_3_2/source/include/smb_macros.h  2007-08-29 01:40:58 UTC 
(rev 24761)
+++ branches/SAMBA_3_2/source/include/smb_macros.h  2007-08-29 01:48:46 UTC 
(rev 24762)
@@ -299,7 +299,7 @@
 #define TALLOC_ZERO(ctx, size) _talloc_zero(ctx, size, __location__)
 #define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type)
 #define TALLOC_ZERO_ARRAY(ctx, type, count) (type *)_talloc_zero_array(ctx, 
sizeof(type), count, #type)
-#define TALLOC_SIZE(ctx, size) talloc(ctx, size, __location__)
+#define TALLOC_SIZE(ctx, size) talloc_named_const(ctx, size, __location__)
 #define TALLOC_ZERO_SIZE(ctx, size) _talloc_zero(ctx, size, __location__)
 
 #endif

Modified: branches/SAMBA_3_2_0/source/include/smb_macros.h
===
--- branches/SAMBA_3_2_0/source/include/smb_macros.h2007-08-29 01:40:58 UTC 
(rev 24761)
+++ branches/SAMBA_3_2_0/source/include/smb_macros.h2007-08-29 01:48:46 UTC 
(rev 24762)
@@ -300,7 +300,7 @@
 #define TALLOC_ZERO(ctx, size) _talloc_zero(ctx, size, __location__)
 #define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type)
 #define TALLOC_ZERO_ARRAY(ctx, type, count) (type *)_talloc_zero_array(ctx, 
sizeof(type), count, #type)
-#define TALLOC_SIZE(ctx, size) talloc(ctx, size, __location__)
+#define TALLOC_SIZE(ctx, size) talloc_named_const(ctx, size, __location__)
 #define TALLOC_ZERO_SIZE(ctx, size) _talloc_zero(ctx, size, __location__)
 
 #endif



svn commit: samba r24764 - in branches: SAMBA_3_2/source/libaddns SAMBA_3_2_0/source/libaddns

2007-08-28 Thread jra
Author: jra
Date: 2007-08-29 04:06:09 + (Wed, 29 Aug 2007)
New Revision: 24764

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

Log:
Fix second TALLOC_SIZE definition. Still watching the
build farm to see I didn't stuff this up...
Jeremy.

Modified:
   branches/SAMBA_3_2/source/libaddns/dns.h
   branches/SAMBA_3_2_0/source/libaddns/dns.h


Changeset:
Modified: branches/SAMBA_3_2/source/libaddns/dns.h
===
--- branches/SAMBA_3_2/source/libaddns/dns.h2007-08-29 02:01:56 UTC (rev 
24763)
+++ branches/SAMBA_3_2/source/libaddns/dns.h2007-08-29 04:06:09 UTC (rev 
24764)
@@ -116,7 +116,7 @@
 #define TALLOC_ZERO(ctx, size) _talloc_zero(ctx, size, __location__)
 #define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type)
 #define TALLOC_ZERO_ARRAY(ctx, type, count) (type *)_talloc_zero_array(ctx, 
sizeof(type), count, #type)
-#define TALLOC_SIZE(ctx, size) talloc(ctx, size, __location__)
+#define TALLOC_SIZE(ctx, size) talloc_named_const(ctx, size, __location__)
 #define TALLOC_ZERO_SIZE(ctx, size) _talloc_zero(ctx, size, __location__)
 
 #endif

Modified: branches/SAMBA_3_2_0/source/libaddns/dns.h
===
--- branches/SAMBA_3_2_0/source/libaddns/dns.h  2007-08-29 02:01:56 UTC (rev 
24763)
+++ branches/SAMBA_3_2_0/source/libaddns/dns.h  2007-08-29 04:06:09 UTC (rev 
24764)
@@ -116,7 +116,7 @@
 #define TALLOC_ZERO(ctx, size) _talloc_zero(ctx, size, __location__)
 #define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type)
 #define TALLOC_ZERO_ARRAY(ctx, type, count) (type *)_talloc_zero_array(ctx, 
sizeof(type), count, #type)
-#define TALLOC_SIZE(ctx, size) talloc(ctx, size, __location__)
+#define TALLOC_SIZE(ctx, size) talloc_named_const(ctx, size, __location__)
 #define TALLOC_ZERO_SIZE(ctx, size) _talloc_zero(ctx, size, __location__)
 
 #endif



svn commit: samba r24716 - in branches/SAMBA_3_0_25/source/nsswitch: .

2007-08-27 Thread jra
Author: jra
Date: 2007-08-27 18:33:08 + (Mon, 27 Aug 2007)
New Revision: 24716

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

Log:
Janitor for Guenther :-).
Fix obvious error in enum_dom_groups. We were returning NT_STATUS_OK when the 
realloc failed.
Jeremy.

Modified:
   branches/SAMBA_3_0_25/source/nsswitch/winbindd_rpc.c


Changeset:
Modified: branches/SAMBA_3_0_25/source/nsswitch/winbindd_rpc.c
===
--- branches/SAMBA_3_0_25/source/nsswitch/winbindd_rpc.c2007-08-27 
18:32:51 UTC (rev 24715)
+++ branches/SAMBA_3_0_25/source/nsswitch/winbindd_rpc.c2007-08-27 
18:33:08 UTC (rev 24716)
@@ -168,8 +168,7 @@
   (*num_entries) + count);
if (! *info) {
talloc_destroy(mem_ctx2);
-   status = NT_STATUS_NO_MEMORY;
-   break;
+   return NT_STATUS_NO_MEMORY;
}
 
memcpy((*info)[*num_entries], info2, count*sizeof(*info2));



svn commit: samba r24719 - in branches/SAMBA_3_0_25/source/nsswitch: .

2007-08-27 Thread jra
Author: jra
Date: 2007-08-27 19:02:53 + (Mon, 27 Aug 2007)
New Revision: 24719

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

Log:
Janitor for Guenther.
Fix confusing indent.
Jeremy.

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


Changeset:
Modified: branches/SAMBA_3_0_25/source/nsswitch/winbindd_cache.c
===
--- branches/SAMBA_3_0_25/source/nsswitch/winbindd_cache.c  2007-08-27 
18:56:46 UTC (rev 24718)
+++ branches/SAMBA_3_0_25/source/nsswitch/winbindd_cache.c  2007-08-27 
19:02:53 UTC (rev 24719)
@@ -1133,14 +1133,15 @@
domain-name ));
 
status = domain-backend-query_user_list(domain, mem_ctx, 
num_entries, info);
-   if (!NT_STATUS_IS_OK(status))
+   if (!NT_STATUS_IS_OK(status)) {
DEBUG(3, (query_user_list: returned 0x%08x, 
  retrying\n, NT_STATUS_V(status)));
-   if (NT_STATUS_EQUAL(status, NT_STATUS_UNSUCCESSFUL)) {
-   DEBUG(3, (query_user_list: flushing 
- connection cache\n));
-   invalidate_cm_connection(domain-conn);
-   }
+   }
+   if (NT_STATUS_EQUAL(status, NT_STATUS_UNSUCCESSFUL)) {
+   DEBUG(3, (query_user_list: flushing 
+ connection cache\n));
+   invalidate_cm_connection(domain-conn);
+   }
 
} while (NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_UNSUCCESSFUL)  
 (retry++  5));



svn commit: samba r24720 - in branches/SAMBA_3_2_0/source/smbd: .

2007-08-27 Thread jra
Author: jra
Date: 2007-08-27 19:16:37 + (Mon, 27 Aug 2007)
New Revision: 24720

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

Log:
Resolve differences in 3.2 and 3.2.0. 3.2 version
was correct.
Jeremy.

Modified:
   branches/SAMBA_3_2_0/source/smbd/sesssetup.c


Changeset:
Modified: branches/SAMBA_3_2_0/source/smbd/sesssetup.c
===
--- branches/SAMBA_3_2_0/source/smbd/sesssetup.c2007-08-27 19:02:53 UTC 
(rev 24719)
+++ branches/SAMBA_3_2_0/source/smbd/sesssetup.c2007-08-27 19:16:37 UTC 
(rev 24720)
@@ -574,7 +574,7 @@
SAFE_FREE(client);
 
reply_outbuf(req, 4, 0);
-   SSVAL(req-outbuf,smb_uid,vuid);
+   SSVAL(req-outbuf,smb_uid,sess_vuid);
 
if (sess_vuid == UID_FIELD_INVALID ) {
ret = NT_STATUS_LOGON_FAILURE;
@@ -1735,6 +1735,7 @@
if (sess_vuid == UID_FIELD_INVALID) {
data_blob_free(nt_resp);
data_blob_free(lm_resp);
+   data_blob_free(session_key);
reply_nterror(req, nt_status_squash(
  NT_STATUS_LOGON_FAILURE));
END_PROFILE(SMBsesssetupX);



svn commit: samba-docs r1165 - in trunk/smbdotconf/security: .

2007-08-23 Thread jra
Author: jra
Date: 2007-08-23 19:50:44 + (Thu, 23 Aug 2007)
New Revision: 1165

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

Log:
Update *securitymask* docs to match the code.
Jeremy.

Modified:
   trunk/smbdotconf/security/directorysecuritymask.xml
   trunk/smbdotconf/security/securitymask.xml


Changeset:
Modified: trunk/smbdotconf/security/directorysecuritymask.xml
===
--- trunk/smbdotconf/security/directorysecuritymask.xml 2007-08-22 13:25:00 UTC 
(rev 1164)
+++ trunk/smbdotconf/security/directorysecuritymask.xml 2007-08-23 19:50:44 UTC 
(rev 1165)
@@ -4,19 +4,19 @@
  xmlns:samba=http://www.samba.org/samba/DTD/samba-doc;
 description
 paraThis parameter controls what UNIX permission bits 
-can be modified when a Windows NT client is manipulating the UNIX 
+can be set when a Windows NT client is manipulating the UNIX 
 permission on a directory using the native NT security dialog 
 box./para
 
 para
-   This parameter is applied as a mask (AND'ed with) to the changed 
permission bits, thus preventing any bits not
-   in this mask from being modified.  Make sure not to mix up this 
parameter with smbconfoption name=force
+   This parameter is applied as a mask (AND'ed with) to the incoming 
permission bits, thus preventing any bits not
+   in this mask from being set.  Make sure not to mix up this parameter 
with smbconfoption name=force
directory security mode/, which works similar like this one but uses 
logical OR instead of AND.
-   Essentially, zero bits in this mask may be treated as a set of bits the 
user is not allowed to change.
+   Essentially, zero bits in this mask are a set of bits that will always 
be set to zero.
/para
 
 paraIf not set explicitly this parameter is set to 0777
-meaning a user is allowed to modify all the user/group/world
+meaning a user is allowed to set all the user/group/world
 permissions on a directory./para
 
 paraemphasisNote/emphasis that users who can access the 

Modified: trunk/smbdotconf/security/securitymask.xml
===
--- trunk/smbdotconf/security/securitymask.xml  2007-08-22 13:25:00 UTC (rev 
1164)
+++ trunk/smbdotconf/security/securitymask.xml  2007-08-23 19:50:44 UTC (rev 
1165)
@@ -4,22 +4,22 @@
  xmlns:samba=http://www.samba.org/samba/DTD/samba-doc;
 description
 para
-   This parameter controls what UNIX permission bits can be modified when 
a Windows NT client is manipulating the
+   This parameter controls what UNIX permission bits can be set when a 
Windows NT client is manipulating the
UNIX permission on a file using the native NT security dialog box.
/para
 
 para
-   This parameter is applied as a mask (AND'ed with) to the changed 
permission bits, thus preventing any bits not
-   in this mask from being modified.  Make sure not to mix up this 
parameter with smbconfoption name=force
+   This parameter is applied as a mask (AND'ed with) to the incoming 
permission bits, thus preventing any bits not
+   in this mask from being set.  Make sure not to mix up this parameter 
with smbconfoption name=force
security mode/, which works in a manner similar to this one but uses 
a logical OR instead of an AND. 
/para
 
para
-   Essentially, zero bits in this mask may be treated as a set of bits the 
user is not allowed to change.
+   Essentially, zero bits in this mask are a set of bits that will always 
be set to zero.
/para
 
 para
-   If not set explicitly this parameter is 0777, allowing a user to modify 
all the user/group/world permissions on a file.
+   If not set explicitly this parameter is 0777, allowing a user to set 
all the user/group/world permissions on a file.
 /para
 
 paraemphasis



svn commit: samba r24638 - in branches/SAMBA_3_2/source/smbd: .

2007-08-23 Thread jra
Author: jra
Date: 2007-08-23 21:34:08 + (Thu, 23 Aug 2007)
New Revision: 24638

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

Log:
Remove redundent setting of vuid.
Jeremy

Modified:
   branches/SAMBA_3_2/source/smbd/sesssetup.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/sesssetup.c
===
--- branches/SAMBA_3_2/source/smbd/sesssetup.c  2007-08-23 15:33:25 UTC (rev 
24637)
+++ branches/SAMBA_3_2/source/smbd/sesssetup.c  2007-08-23 21:34:08 UTC (rev 
24638)
@@ -1,4 +1,4 @@
-/* 
+/*
Unix SMB/CIFS implementation.
handle SMBsessionsetup
Copyright (C) Andrew Tridgell 1998-2001
@@ -680,8 +680,6 @@
SSVAL(req-outbuf,smb_vwv2,1);
}
 
-   SSVAL(req-outbuf,smb_uid,vuid);
-
sessionsetup_start_signing_engine(server_info, req-inbuf);
}
 



svn commit: samba r24639 - in branches: SAMBA_3_0_25/source/param SAMBA_3_0_25/source/smbd SAMBA_3_2/source/param SAMBA_3_2/source/smbd SAMBA_3_2_0/source/param SAMBA_3_2_0/source/smbd

2007-08-23 Thread jra
Author: jra
Date: 2007-08-23 21:53:00 + (Thu, 23 Aug 2007)
New Revision: 24639

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

Log:
Add parameter directory name cache size - parameterize
use of directory name cache, 100 by default. Will be needed
to turn this off for *BSD systems.
Jeremy.

Modified:
   branches/SAMBA_3_0_25/source/param/loadparm.c
   branches/SAMBA_3_0_25/source/smbd/dir.c
   branches/SAMBA_3_2/source/param/loadparm.c
   branches/SAMBA_3_2/source/smbd/dir.c
   branches/SAMBA_3_2_0/source/param/loadparm.c
   branches/SAMBA_3_2_0/source/smbd/dir.c


Changeset:
Modified: branches/SAMBA_3_0_25/source/param/loadparm.c
===
--- branches/SAMBA_3_0_25/source/param/loadparm.c   2007-08-23 21:34:08 UTC 
(rev 24638)
+++ branches/SAMBA_3_0_25/source/param/loadparm.c   2007-08-23 21:53:00 UTC 
(rev 24639)
@@ -456,6 +456,7 @@
int iAioReadSize;
int iAioWriteSize;
int iMap_readonly;
+   int iDirectoryNameCacheSize;
param_opt_struct *param_opt;
 
char dummy[3];  /* for alignment */
@@ -597,7 +598,11 @@
0,  /* iAioReadSize */
0,  /* iAioWriteSize */
MAP_READONLY_YES,   /* iMap_readonly */
-   
+#ifdef BROKEN_DIRECTORY_HANDLING
+   0,  /* iDirectoryNameCacheSize */
+#else
+   100,/* iDirectoryNameCacheSize */
+#endif
NULL,   /* Parametric options */
 
  /* dummy */
@@ -1012,6 +1017,7 @@
{getwd cache, P_BOOL, P_GLOBAL, use_getwd_cache, NULL, NULL, 
FLAG_ADVANCED}, 
{keepalive, P_INTEGER, P_GLOBAL, keepalive, NULL, NULL, 
FLAG_ADVANCED}, 
{change notify, P_BOOL, P_LOCAL, sDefault.bChangeNotify, NULL, NULL, 
FLAG_ADVANCED | FLAG_SHARE },
+   {directory name cache size, P_INTEGER, P_LOCAL, 
sDefault.iDirectoryNameCacheSize, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE },
{kernel change notify, P_BOOL, P_LOCAL, 
sDefault.bKernelChangeNotify, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE },
 
{lpq cache time, P_INTEGER, P_GLOBAL, Globals.lpqcachetime, NULL, 
NULL, FLAG_ADVANCED}, 
@@ -2140,6 +2146,7 @@
 FN_LOCAL_INTEGER(lp_aio_read_size, iAioReadSize)
 FN_LOCAL_INTEGER(lp_aio_write_size, iAioWriteSize)
 FN_LOCAL_INTEGER(lp_map_readonly, iMap_readonly)
+FN_LOCAL_INTEGER(lp_directory_name_cache_size, iDirectoryNameCacheSize)
 FN_LOCAL_CHAR(lp_magicchar, magic_char)
 FN_GLOBAL_INTEGER(lp_winbind_cache_time, Globals.winbind_cache_time)
 FN_GLOBAL_LIST(lp_winbind_nss_info, Globals.szWinbindNssInfo)

Modified: branches/SAMBA_3_0_25/source/smbd/dir.c
===
--- branches/SAMBA_3_0_25/source/smbd/dir.c 2007-08-23 21:34:08 UTC (rev 
24638)
+++ branches/SAMBA_3_0_25/source/smbd/dir.c 2007-08-23 21:53:00 UTC (rev 
24639)
@@ -33,8 +33,6 @@
 
 /* Make directory handle internals available. */
 
-#define NAME_CACHE_SIZE 100
-
 struct name_cache_entry {
char *name;
long offset;
@@ -45,6 +43,7 @@
SMB_STRUCT_DIR *dir;
long offset;
char *dir_path;
+   size_t name_cache_size;
struct name_cache_entry *name_cache;
unsigned int name_cache_index;
unsigned int file_number;
@@ -1062,12 +1061,14 @@
 struct smb_Dir *OpenDir(connection_struct *conn, const char *name, const char 
*mask, uint32 attr)
 {
struct smb_Dir *dirp = SMB_MALLOC_P(struct smb_Dir);
+
if (!dirp) {
return NULL;
}
ZERO_STRUCTP(dirp);
 
dirp-conn = conn;
+   dirp-name_cache_size = lp_directory_name_cache_size(SNUM(conn));
 
dirp-dir_path = SMB_STRDUP(name);
if (!dirp-dir_path) {
@@ -1079,9 +1080,14 @@
goto fail;
}
 
-   dirp-name_cache = SMB_CALLOC_ARRAY(struct name_cache_entry, 
NAME_CACHE_SIZE);
-   if (!dirp-name_cache) {
-   goto fail;
+   if (dirp-name_cache_size) {
+   dirp-name_cache = SMB_CALLOC_ARRAY(struct name_cache_entry,
+   dirp-name_cache_size);
+   if (!dirp-name_cache) {
+   goto fail;
+   }
+   } else {
+   dirp-name_cache = NULL;
}
 
dirhandles_open++;
@@ -1114,7 +1120,7 @@
}
SAFE_FREE(dirp-dir_path);
if (dirp-name_cache) {
-   for (i = 0; i  NAME_CACHE_SIZE; i++) {
+   for (i = 0; i  dirp-name_cache_size; i++) {
SAFE_FREE(dirp-name_cache[i].name);
}
}
@@ -1230,7 +1236,12 @@
 {
struct name_cache_entry *e;
 
-   dirp-name_cache_index = (dirp-name_cache_index+1) % NAME_CACHE_SIZE;
+   if (!dirp-name_cache_size || !dirp-name_cache) {
+   return;
+   }
+
+   dirp-name_cache_index = (dirp

svn commit: samba r24607 - in branches/SAMBA_3_2_0/source: lib smbd

2007-08-21 Thread jra
Author: jra
Date: 2007-08-21 20:36:05 + (Tue, 21 Aug 2007)
New Revision: 24607

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

Log:
Merge the sessionsetup fix from 3.2
Jeremy.

Modified:
   branches/SAMBA_3_2_0/source/lib/substitute.c
   branches/SAMBA_3_2_0/source/smbd/password.c
   branches/SAMBA_3_2_0/source/smbd/sesssetup.c


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


svn commit: samba r24608 - in branches/SAMBA_3_2_0/source/smbd: .

2007-08-21 Thread jra
Author: jra
Date: 2007-08-21 21:27:37 + (Tue, 21 Aug 2007)
New Revision: 24608

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

Log:
Minimize differences between 3.2 and 3.2.0. This is essentially a back-port
of the 3.2 sessionsetup code to enable vl's merge to go easier.
Jeremy.

Modified:
   branches/SAMBA_3_2_0/source/smbd/sesssetup.c


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


svn commit: samba r24590 - in branches/SAMBA_3_2/source/smbd: .

2007-08-20 Thread jra
Author: jra
Date: 2007-08-21 02:04:24 + (Tue, 21 Aug 2007)
New Revision: 24590

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

Log:
Reformatting to coding standards. Added my (C) in places it already should
have been :-).
Jeremy.

Modified:
   branches/SAMBA_3_2/source/smbd/password.c
   branches/SAMBA_3_2/source/smbd/sesssetup.c


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


svn commit: samba r24498 - in branches/SAMBA_3_2/source/smbd: .

2007-08-16 Thread jra
Author: jra
Date: 2007-08-16 17:42:34 + (Thu, 16 Aug 2007)
New Revision: 24498

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

Log:
More extra code into a function, reply_openerror.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/smbd/error.c
   branches/SAMBA_3_2/source/smbd/nttrans.c
   branches/SAMBA_3_2/source/smbd/reply.c
   branches/SAMBA_3_2/source/smbd/trans2.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/error.c
===
--- branches/SAMBA_3_2/source/smbd/error.c  2007-08-16 15:44:13 UTC (rev 
24497)
+++ branches/SAMBA_3_2/source/smbd/error.c  2007-08-16 17:42:34 UTC (rev 
24498)
@@ -179,3 +179,20 @@
error_packet_set((char *)req-outbuf, eclass, ecode, ntstatus,
 line, file);
 }
+
+void reply_openerror(struct smb_request *req, NTSTATUS status)
+{
+   if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) {
+   /*
+* We hit an existing file, and if we're returning DOS
+* error codes OBJECT_NAME_COLLISION would map to
+* ERRDOS/183, we need to return ERRDOS/80, see bug
+* 4852.
+*/
+   reply_botherror(req, NT_STATUS_OBJECT_NAME_COLLISION,
+   ERRDOS, ERRfilexists);
+   } else {
+   reply_nterror(req, status);
+   }
+}
+

Modified: branches/SAMBA_3_2/source/smbd/nttrans.c
===
--- branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-16 15:44:13 UTC (rev 
24497)
+++ branches/SAMBA_3_2/source/smbd/nttrans.c2007-08-16 17:42:34 UTC (rev 
24498)
@@ -816,51 +816,50 @@
oplock_request,
info, fsp);
 
-   if (!NT_STATUS_IS_OK(status)) { 
-   /* We cheat here. There are two cases we
-* care about. One is a directory rename,
-* where the NT client will attempt to
-* open the source directory for
-* DELETE access. Note that when the
-* NT client does this it does *not*
-* set the directory bit in the
-* request packet. This is translated
-* into a read/write open
-* request. POSIX states that any open
-* for write request on a directory
-* will generate an EISDIR error, so
-* we can catch this here and open a
-* pseudo handle that is flagged as a
-* directory. The second is an open
-* for a permissions read only, which
-* we handle in the open_file_stat case. JRA.
-*/
+   /* We cheat here. There are two cases we
+* care about. One is a directory rename,
+* where the NT client will attempt to
+* open the source directory for
+* DELETE access. Note that when the
+* NT client does this it does *not*
+* set the directory bit in the
+* request packet. This is translated
+* into a read/write open
+* request. POSIX states that any open
+* for write request on a directory
+* will generate an EISDIR error, so
+* we can catch this here and open a
+* pseudo handle that is flagged as a
+* directory. The second is an open
+* for a permissions read only, which
+* we handle in the open_file_stat case. JRA.
+*/
 
-   if (NT_STATUS_EQUAL(status,
-   NT_STATUS_FILE_IS_A_DIRECTORY)) {
+   if (NT_STATUS_EQUAL(status, NT_STATUS_FILE_IS_A_DIRECTORY)) {
 
-   /*
-* Fail the open if it was explicitly a 
non-directory file.
-*/
+   /*
+* Fail the open if it was explicitly a non-directory
+* file.
+*/
 
-   if (create_options  FILE_NON_DIRECTORY_FILE) {
-   TALLOC_FREE(case_state);
-   reply_force_nterror(req, 
NT_STATUS_FILE_IS_A_DIRECTORY);
-   END_PROFILE(SMBntcreateX);
-   return;
-   }
+   if (create_options  FILE_NON_DIRECTORY_FILE) {
+   TALLOC_FREE(case_state

svn commit: samba r24499 - in branches: SAMBA_3_0_25/source/include SAMBA_3_0_25/source/smbd SAMBA_3_2_0/source/include SAMBA_3_2_0/source/smbd

2007-08-16 Thread jra
Author: jra
Date: 2007-08-16 22:50:57 + (Thu, 16 Aug 2007)
New Revision: 24499

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

Log:
Move the checks for DOS error codes on open to a function.
Jeremy.

Modified:
   branches/SAMBA_3_0_25/source/include/smb_macros.h
   branches/SAMBA_3_0_25/source/smbd/error.c
   branches/SAMBA_3_0_25/source/smbd/nttrans.c
   branches/SAMBA_3_0_25/source/smbd/reply.c
   branches/SAMBA_3_0_25/source/smbd/trans2.c
   branches/SAMBA_3_2_0/source/include/smb_macros.h
   branches/SAMBA_3_2_0/source/smbd/error.c
   branches/SAMBA_3_2_0/source/smbd/nttrans.c
   branches/SAMBA_3_2_0/source/smbd/reply.c
   branches/SAMBA_3_2_0/source/smbd/trans2.c


Changeset:
Modified: branches/SAMBA_3_0_25/source/include/smb_macros.h
===
--- branches/SAMBA_3_0_25/source/include/smb_macros.h   2007-08-16 17:42:34 UTC 
(rev 24498)
+++ branches/SAMBA_3_0_25/source/include/smb_macros.h   2007-08-16 22:50:57 UTC 
(rev 24499)
@@ -166,6 +166,7 @@
 
 #define ERROR_DOS(class,code) 
error_packet(outbuf,class,code,NT_STATUS_OK,__LINE__,__FILE__)
 #define ERROR_NT(status) error_packet(outbuf,0,0,status,__LINE__,__FILE__)
+#define ERROR_OPEN(status) error_open(outbuf,status,__LINE__,__FILE__)
 #define ERROR_FORCE_NT(status) 
error_packet(outbuf,-1,-1,status,__LINE__,__FILE__)
 #define ERROR_BOTH(status,class,code) 
error_packet(outbuf,class,code,status,__LINE__,__FILE__)
 

Modified: branches/SAMBA_3_0_25/source/smbd/error.c
===
--- branches/SAMBA_3_0_25/source/smbd/error.c   2007-08-16 17:42:34 UTC (rev 
24498)
+++ branches/SAMBA_3_0_25/source/smbd/error.c   2007-08-16 22:50:57 UTC (rev 
24499)
@@ -132,3 +132,22 @@
error_packet_set(outbuf, eclass, ecode, ntstatus, line, file);
return outsize;
 }
+
+/***
+ Special error map processing needed for returning DOS errors on open calls.
+***/
+
+int error_open(char *outbuf, NTSTATUS status, int line, const char *file)
+{
+   if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) {
+   /*
+* We hit an existing file, and if we're returning DOS
+* error codes OBJECT_NAME_COLLISION would map to
+* ERRDOS/183, we need to return ERRDOS/80, see bug
+* 4852.
+*/
+   return error_packet(outbuf, ERRDOS, ERRfilexists,
+   NT_STATUS_OBJECT_NAME_COLLISION, line, file);
+   }
+   return error_packet(outbuf,0,0,status,line,file);
+}

Modified: branches/SAMBA_3_0_25/source/smbd/nttrans.c
===
--- branches/SAMBA_3_0_25/source/smbd/nttrans.c 2007-08-16 17:42:34 UTC (rev 
24498)
+++ branches/SAMBA_3_0_25/source/smbd/nttrans.c 2007-08-16 22:50:57 UTC (rev 
24499)
@@ -800,18 +800,7 @@
return -1;
}
 
-   if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) {
-   /*
-* We hit an existing file, and if we're returning DOS
-* error codes OBJECT_NAME_COLLISION would map to
-* ERRDOS/183, we need to return ERRDOS/80, see bug
-* 4852.
-*/
-   return ERROR_BOTH(NT_STATUS_OBJECT_NAME_COLLISION,
-   ERRDOS, ERRfilexists);
-
-   }
-   return ERROR_NT(status);
+   return ERROR_OPEN(status);
}
 
file_len = sbuf.st_size;
@@ -1457,18 +1446,7 @@
return -1;
}
 
-   if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) {
-   /*
-* We hit an existing file, and if we're returning DOS
-* error codes OBJECT_NAME_COLLISION would map to
-* ERRDOS/183, we need to return ERRDOS/80, see bug
-* 4852.
-*/
-   return ERROR_BOTH(NT_STATUS_OBJECT_NAME_COLLISION,
-   ERRDOS, ERRfilexists);
-
-   }
-   return ERROR_NT(status);
+   return ERROR_OPEN(status);
}
 
/*

Modified: branches/SAMBA_3_0_25/source/smbd/reply.c
===
--- branches/SAMBA_3_0_25/source/smbd/reply.c   2007-08-16 17:42:34 UTC (rev 
24498)
+++ branches/SAMBA_3_0_25/source/smbd/reply.c   2007-08-16 22:50:57 UTC (rev 
24499)
@@ -1321,17 +1321,7 @@
/* We have re-scheduled this call. */
return -1

svn commit: samba r24500 - in branches/SAMBA_3_2/source/smbd: .

2007-08-16 Thread jra
Author: jra
Date: 2007-08-16 23:53:51 + (Thu, 16 Aug 2007)
New Revision: 24500

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

Log:
Add check that bcc is correct in an incoming packet.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/smbd/process.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/process.c
===
--- branches/SAMBA_3_2/source/smbd/process.c2007-08-16 22:50:57 UTC (rev 
24499)
+++ branches/SAMBA_3_2/source/smbd/process.c2007-08-16 23:53:51 UTC (rev 
24500)
@@ -70,13 +70,22 @@
req-vuid   = SVAL(inbuf, smb_uid);
req-tid= SVAL(inbuf, smb_tid);
req-wct= CVAL(inbuf, smb_wct);
-   /* Ensure we have at least wct words. */
+   /* Ensure we have at least wct words and 2 bytes of bcc. */
if (smb_size + req-wct*2  req_size) {
DEBUG(0,(init_smb_request: invalid wct number %u (size %u)\n,
(unsigned int)req-wct,
(unsigned int)req_size));
exit_server_cleanly(Invalid SMB request);
}
+   /* Ensure bcc is correct. */
+   if (((uint8 *)smb_buf(inbuf)) + smb_buflen(inbuf)  inbuf + req_size) {
+   DEBUG(0,(init_smb_request: invalid bcc number %u 
+   (wct = %u, size %u)\n,
+   (unsigned int)smb_buflen(inbuf),
+   (unsigned int)req-wct,
+   (unsigned int)req_size));
+   exit_server_cleanly(Invalid SMB request);
+   }
req-inbuf  = inbuf;
req-outbuf = NULL;
 }



svn commit: samba r24501 - in branches/SAMBA_3_2/source/smbd: .

2007-08-16 Thread jra
Author: jra
Date: 2007-08-17 01:55:58 + (Fri, 17 Aug 2007)
New Revision: 24501

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

Log:
Added bcc test for reply_tcon  removed Vl's comment :-).
Jeremy.

Modified:
   branches/SAMBA_3_2/source/smbd/reply.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/reply.c
===
--- branches/SAMBA_3_2/source/smbd/reply.c  2007-08-16 23:53:51 UTC (rev 
24500)
+++ branches/SAMBA_3_2/source/smbd/reply.c  2007-08-17 01:55:58 UTC (rev 
24501)
@@ -442,12 +442,11 @@
 
START_PROFILE(SMBtcon);
 
-   /
-* Warning! I'm not sure that the inbuf length check is actually 
-* correct here. -- vl
-*
-* Jeremy, please check and remove this comment :-)
-/
+   if (smb_buflen(req-inbuf)  4) {
+   reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+   END_PROFILE(SMBtcon);
+   return;
+   }
 
p = smb_buf(req-inbuf)+1;
p += srvstr_pull_buf_talloc(req, req-inbuf, req-flags2,



svn commit: samba r24464 - in branches/SAMBA_3_2/source: include printing smbd

2007-08-15 Thread jra
Author: jra
Date: 2007-08-15 16:58:29 + (Wed, 15 Aug 2007)
New Revision: 24464

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

Log:
Now Volker removed the readbmpx we don't need cached errors any more.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/include/smb.h
   branches/SAMBA_3_2/source/include/smb_macros.h
   branches/SAMBA_3_2/source/printing/printfsp.c
   branches/SAMBA_3_2/source/smbd/close.c
   branches/SAMBA_3_2/source/smbd/error.c


Changeset:
Modified: branches/SAMBA_3_2/source/include/smb.h
===
--- branches/SAMBA_3_2/source/include/smb.h 2007-08-15 14:02:23 UTC (rev 
24463)
+++ branches/SAMBA_3_2/source/include/smb.h 2007-08-15 16:58:29 UTC (rev 
24464)
@@ -387,17 +387,6 @@
uint32 time;
 } UTIME;
 
-/* Structure used when SMBwritebmpx is active */
-typedef struct {
-   size_t wr_total_written; /* So we know when to discard this */
-   int32 wr_timeout;
-   int32 wr_errclass; /* Cached errors */
-   int32 wr_error; /* Cached errors */
-   NTSTATUS wr_status; /* Cached errors */
-   BOOL  wr_mode; /* write through mode) */
-   BOOL  wr_discard; /* discard all further data */
-} write_bmpx_struct;
-
 typedef struct write_cache {
SMB_OFF_T file_size;
SMB_OFF_T offset;
@@ -495,7 +484,6 @@
mode_t mode;
uint16 file_pid;
uint16 vuid;
-   write_bmpx_struct *wbmpx_ptr;
write_cache *wcp;
struct timeval open_time;
uint32 access_mask; /* NTCreateX access bits 
(FILE_READ_DATA etc.) */

Modified: branches/SAMBA_3_2/source/include/smb_macros.h
===
--- branches/SAMBA_3_2/source/include/smb_macros.h  2007-08-15 14:02:23 UTC 
(rev 24463)
+++ branches/SAMBA_3_2/source/include/smb_macros.h  2007-08-15 16:58:29 UTC 
(rev 24464)
@@ -158,12 +158,6 @@
 #define SMB_LARGE_LKLEN_OFFSET_HIGH(indx) (12 + (20 * (indx)))
 #define SMB_LARGE_LKLEN_OFFSET_LOW(indx) (16 + (20 * (indx)))
 
-/* Macro to test if an error has been cached for this fnum */
-#define HAS_CACHED_ERROR(fsp) ((fsp)-wbmpx_ptr  \
-(fsp)-wbmpx_ptr-wr_discard)
-/* Macro to turn the cached error into an error packet */
-#define CACHED_ERROR(fsp) 
cached_error_packet(inbuf,outbuf,fsp,__LINE__,__FILE__)
-
 #define ERROR_DOS(class,code) 
error_packet(inbuf,outbuf,class,code,NT_STATUS_OK,__LINE__,__FILE__)
 #define ERROR_NT(status) 
error_packet(inbuf,outbuf,0,0,status,__LINE__,__FILE__)
 #define ERROR_FORCE_NT(status) 
error_packet(inbuf,outbuf,-1,-1,status,__LINE__,__FILE__)

Modified: branches/SAMBA_3_2/source/printing/printfsp.c
===
--- branches/SAMBA_3_2/source/printing/printfsp.c   2007-08-15 14:02:23 UTC 
(rev 24463)
+++ branches/SAMBA_3_2/source/printing/printfsp.c   2007-08-15 16:58:29 UTC 
(rev 24464)
@@ -82,7 +82,6 @@
fsp-sent_oplock_break = NO_BREAK_SENT;
fsp-is_directory = False;

string_set(fsp-fsp_name,print_job_fname(lp_const_servicename(SNUM(conn)),jobid));
-   fsp-wbmpx_ptr = NULL;  
fsp-wcp = NULL; 
SMB_VFS_FSTAT(fsp,fsp-fh-fd, sbuf);
fsp-mode = sbuf.st_mode;

Modified: branches/SAMBA_3_2/source/smbd/close.c
===
--- branches/SAMBA_3_2/source/smbd/close.c  2007-08-15 14:02:23 UTC (rev 
24463)
+++ branches/SAMBA_3_2/source/smbd/close.c  2007-08-15 16:58:29 UTC (rev 
24464)
@@ -102,7 +102,6 @@
}
 
conn-num_files_open--;
-   SAFE_FREE(fsp-wbmpx_ptr);
return status;
 }
 

Modified: branches/SAMBA_3_2/source/smbd/error.c
===
--- branches/SAMBA_3_2/source/smbd/error.c  2007-08-15 14:02:23 UTC (rev 
24463)
+++ branches/SAMBA_3_2/source/smbd/error.c  2007-08-15 16:58:29 UTC (rev 
24464)
@@ -25,22 +25,6 @@
 extern uint32 global_client_caps;
 
 /
- Create an error packet from a cached error.
-/
- 
-int cached_error_packet(const char *inbuf,char *outbuf,files_struct *fsp,int 
line,const char *file)
-{
-   write_bmpx_struct *wbmpx = fsp-wbmpx_ptr;
-   int32 eclass = wbmpx-wr_errclass;
-   int32 err = wbmpx-wr_error;
-   NTSTATUS ntstatus = wbmpx-wr_status;
- 
-   /* We can now delete the auxiliary struct */
-   SAFE_FREE(fsp-wbmpx_ptr);
-   return error_packet(inbuf,outbuf,eclass,err,ntstatus,line,file);
-}
-
-/
  Create an error packet from errno.
 /
 



  1   2   3   4   5   6   7   8   9   10   >