svn commit: samba r23030 - in branches/SAMBA_4_0/source: auth/gensec auth/kerberos ldap_server libcli/cldap libcli/ldap libcli/util librpc/ndr

2007-05-21 Thread tridge
Author: tridge
Date: 2007-05-21 06:12:06 + (Mon, 21 May 2007)
New Revision: 23030

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

Log:

finally fixed up our asn1 code to use better memory allocation. This
should allow us to fix some long standing memory leaks.

Modified:
   branches/SAMBA_4_0/source/auth/gensec/spnego.c
   branches/SAMBA_4_0/source/auth/gensec/spnego_parse.c
   branches/SAMBA_4_0/source/auth/kerberos/gssapi_parse.c
   branches/SAMBA_4_0/source/ldap_server/ldap_server.c
   branches/SAMBA_4_0/source/libcli/cldap/cldap.c
   branches/SAMBA_4_0/source/libcli/cldap/cldap.h
   branches/SAMBA_4_0/source/libcli/ldap/ldap.c
   branches/SAMBA_4_0/source/libcli/ldap/ldap_client.c
   branches/SAMBA_4_0/source/libcli/ldap/ldap_controls.c
   branches/SAMBA_4_0/source/libcli/util/asn1.c
   branches/SAMBA_4_0/source/librpc/ndr/ndr_drsuapi.c


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


svn commit: samba r23031 - in branches/SAMBA_4_0/source/torture/raw: .

2007-05-21 Thread tridge
Author: tridge
Date: 2007-05-21 07:27:24 + (Mon, 21 May 2007)
New Revision: 23031

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

Log:

removed bogus event_loop_once() calls in RAW-CONTEXT test - they could
hang forever if an ealier one caused two operations to complete at
once

this is why RAW-CONTEXT was taking 5 minutes on the build farm

Modified:
   branches/SAMBA_4_0/source/torture/raw/context.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/raw/context.c
===
--- branches/SAMBA_4_0/source/torture/raw/context.c 2007-05-21 06:12:06 UTC 
(rev 23030)
+++ branches/SAMBA_4_0/source/torture/raw/context.c 2007-05-21 07:27:24 UTC 
(rev 23031)
@@ -235,11 +235,6 @@
}
 
 
-   /* flush the queue */
-   for (i=0; i  ARRAY_SIZE(sessions); i++) {
-   event_loop_once(composite_contexts[0]-event_ctx);
-   }
-
printf(finishing %d secondary security contexts on the same 
transport\n, 
   (int)ARRAY_SIZE(sessions));
for (i=0; i ARRAY_SIZE(sessions); i++) {



svn commit: samba r23032 - in branches/SAMBA_4_0/source/scripting/libjs: .

2007-05-21 Thread abartlet
Author: abartlet
Date: 2007-05-21 08:33:22 + (Mon, 21 May 2007)
New Revision: 23032

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

Log:
Remove calls to println(), and ensure we print the ldb errstring().

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/scripting/libjs/provision.js


Changeset:
Modified: branches/SAMBA_4_0/source/scripting/libjs/provision.js
===
--- branches/SAMBA_4_0/source/scripting/libjs/provision.js  2007-05-21 
07:27:24 UTC (rev 23031)
+++ branches/SAMBA_4_0/source/scripting/libjs/provision.js  2007-05-21 
08:33:22 UTC (rev 23032)
@@ -140,9 +140,9 @@
 /* the ldb is in bad shape, possibly due to being built from an
incompatible previous version of the code, so delete it
completely */
-function ldb_delete(ldb)
+function ldb_delete(info, ldb)
 {
-   println(Deleting  + ldb.filename);
+   info.message(Deleting  + ldb.filename + \n);
var lp = loadparm_init();
sys.unlink(sprintf(%s/%s, lp.get(private dir), ldb.filename));
ldb.transaction_cancel();
@@ -155,7 +155,7 @@
 /*
   erase an ldb, removing all records
 */
-function ldb_erase(ldb)
+function ldb_erase(info, ldb)
 {
var res;
 
@@ -173,7 +173,7 @@
var res = ldb.search(((|(objectclass=*)(dn=*))(!([EMAIL 
PROTECTED]))), basedn, ldb.SCOPE_SUBTREE, attrs);
var i;
if (res.error != 0) {
-   ldb_delete(ldb);
+   ldb_delete(info, ldb);
return;
}
for (i=0;ires.msgs.length;i++) {
@@ -182,7 +182,7 @@
 
var res = ldb.search(((|(objectclass=*)(dn=*))(!([EMAIL 
PROTECTED]))), basedn, ldb.SCOPE_SUBTREE, attrs);
if (res.error != 0 || res.msgs.length != 0) {
-   ldb_delete(ldb);
+   ldb_delete(info, ldb);
return;
}
assert(res.msgs.length == 0);
@@ -260,7 +260,7 @@
ldb.transaction_start();
 
if (erase) {
-   ldb_erase(ldb); 
+   ldb_erase(info, ldb);   
}
return ldb;
 }
@@ -571,7 +571,7 @@
var modify_ok = setup_ldb_modify(provision_basedn_modify.ldif, info, 
samdb);
if (!modify_ok) {
if (!add_ok) {
-   message(Failed to both add and modify  + 
subobj.DOMAINDN +  in target  + subobj.DOMAINDN_LDB + \n);
+   message(Failed to both add and modify  + 
subobj.DOMAINDN +  in target  + subobj.DOMAINDN_LDB + :  + 
samdb.errstring() + \n);
message(Perhaps you need to run the provision script 
with the --ldap-base-dn option, and add this record to the backend 
manually\n); 
};
assert(modify_ok);
@@ -583,7 +583,8 @@
var modify_ok = 
setup_ldb_modify(provision_configuration_basedn_modify.ldif, info, samdb);
if (!modify_ok) {
if (!add_ok) {
-   message(Failed to both add and modify the 
configuration container\n);
+   message(Failed to both add and modify configuration 
dn:  + samdb.errstring() + \n);
+   message(Perhaps you need to run the provision script 
with the --ldap-base-dn option, and add this record to the backend 
manually\n); 
assert(modify_ok);
}
assert(modify_ok);
@@ -595,7 +596,8 @@
var modify_ok = setup_ldb_modify(provision_schema_basedn_modify.ldif, 
info, samdb);
if (!modify_ok) {
if (!add_ok) {
-   message(Failed to both add and modify the schema 
container:  + samdb.errstring() + \n);
+   message(Failed to both add and modify schema dn: + 
samdb.errstring() + \n);
+   message(Perhaps you need to run the provision script 
with the --ldap-base-dn option, and add this record to the backend 
manually\n); 
assert(modify_ok);
}
message(Failed to modify the schema container:  + 
samdb.errstring() + \n);



Re: svn commit: samba r23030 - in branches/SAMBA_4_0/source: auth/gensec auth/kerberos ldap_server libcli/cldap libcli/ldap libcli/util librpc/ndr

2007-05-21 Thread Stefan (metze) Metzmacher
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

[EMAIL PROTECTED] schrieb:
 Author: tridge
 Date: 2007-05-21 06:12:06 + (Mon, 21 May 2007)
 New Revision: 23030
 
 WebSVN: 
 http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=23030
 
 Log:
 
 finally fixed up our asn1 code to use better memory allocation. This
 should allow us to fix some long standing memory leaks.

Hi Tridge,

thanks!

can you change:

+   struct asn1_data *asn1 = asn1_init(mem_ctx);

into:

+   struct asn1_data *asn1;


asn1 = asn1_init(mem_ctx);
if (!asn1) error...;

?

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

iD8DBQFGUV6Jm70gjA5TCD8RAsdOAJ0Tb8/kTdEAZ1Rs8zvmRrQTSJjW3wCfYxK1
tFyXg+PK4hzA0fn2imEdlSs=
=T0F/
-END PGP SIGNATURE-


svn commit: samba r23033 - in branches/SAMBA_4_0/source/setup: .

2007-05-21 Thread metze
Author: metze
Date: 2007-05-21 09:15:27 + (Mon, 21 May 2007)
New Revision: 23033

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

Log:
regenerate schema.ldif with minischema.js

metze
Modified:
   branches/SAMBA_4_0/source/setup/schema.ldif


Changeset:
Modified: branches/SAMBA_4_0/source/setup/schema.ldif
===
--- branches/SAMBA_4_0/source/setup/schema.ldif 2007-05-21 08:33:22 UTC (rev 
23032)
+++ branches/SAMBA_4_0/source/setup/schema.ldif 2007-05-21 09:15:27 UTC (rev 
23033)
@@ -900,6 +900,23 @@
 systemFlags: 16
 objectCategory: CN=Attribute-Schema,${SCHEMADN}
 
+dn: CN=GPC-WQL-Filter,${SCHEMADN}
+objectClass: top
+objectClass: attributeSchema
+attributeID: 1.2.840.113556.1.4.1694
+attributeSyntax: 2.5.5.12
+isSingleValued: TRUE
+showInAdvancedViewOnly: TRUE
+adminDisplayName: GPC-WQL-Filter
+adminDescription: GPC-WQL-Filter
+oMSyntax: 64
+searchFlags: 0
+lDAPDisplayName: gPCWQLFilter
+schemaIDGUID: 7bd4c7a6-1add-4436-8c04-3999a880154c
+systemOnly: FALSE
+systemFlags: 16
+objectCategory: CN=Attribute-Schema,${SCHEMADN}
+
 dn: CN=Server-Reference-BL,${SCHEMADN}
 objectClass: top
 objectClass: attributeSchema
@@ -1365,6 +1382,24 @@
 systemFlags: 16
 objectCategory: CN=Attribute-Schema,${SCHEMADN}
 
+dn: CN=Version-Number,${SCHEMADN}
+objectClass: top
+objectClass: attributeSchema
+attributeID: 1.2.840.113556.1.4.141
+attributeSyntax: 2.5.5.9
+isSingleValued: TRUE
+showInAdvancedViewOnly: TRUE
+adminDisplayName: Version-Number
+adminDescription: Version-Number
+oMSyntax: 2
+searchFlags: 0
+lDAPDisplayName: versionNumber
+schemaIDGUID: bf967a76-0de6-11d0-a285-00aa003049e2
+systemOnly: FALSE
+systemFlags: 16
+isMemberOfPartialAttributeSet: TRUE
+objectCategory: CN=Attribute-Schema,${SCHEMADN}
+
 dn: CN=Object-Class,${SCHEMADN}
 objectClass: top
 objectClass: attributeSchema
@@ -5220,6 +5255,23 @@
 schemaIDGUID: a8df7394-c5ea-11d1-bbcb-0080c76670c0
 objectCategory: CN=Attribute-Schema,${SCHEMADN}
 
+dn: CN=GPC-User-Extension-Names,${SCHEMADN}
+objectClass: top
+objectClass: attributeSchema
+attributeID: 1.2.840.113556.1.4.1349
+attributeSyntax: 2.5.5.12
+isSingleValued: TRUE
+showInAdvancedViewOnly: TRUE
+adminDisplayName: GPC-User-Extension-Names
+adminDescription: GPC-User-Extension-Names
+oMSyntax: 64
+searchFlags: 0
+lDAPDisplayName: gPCUserExtensionNames
+schemaIDGUID: 42a75fc6-783f-11d2-9916-f87a57d4
+systemOnly: FALSE
+systemFlags: 16
+objectCategory: CN=Attribute-Schema,${SCHEMADN}
+
 dn: CN=ms-DS-Non-Members-BL,${SCHEMADN}
 objectClass: top
 objectClass: attributeSchema
@@ -5462,6 +5514,23 @@
 systemOnly: FALSE
 objectCategory: CN=Attribute-Schema,${SCHEMADN}
 
+dn: CN=GPC-Functionality-Version,${SCHEMADN}
+objectClass: top
+objectClass: attributeSchema
+attributeID: 1.2.840.113556.1.4.893
+attributeSyntax: 2.5.5.9
+isSingleValued: TRUE
+showInAdvancedViewOnly: TRUE
+adminDisplayName: GPC-Functionality-Version
+adminDescription: GPC-Functionality-Version
+oMSyntax: 2
+searchFlags: 0
+lDAPDisplayName: gPCFunctionalityVersion
+schemaIDGUID: f30e3bc0-9ff0-11d1-b603-f80367c1
+systemOnly: FALSE
+systemFlags: 16
+objectCategory: CN=Attribute-Schema,${SCHEMADN}
+
 dn: CN=USN-DSA-Last-Obj-Removed,${SCHEMADN}
 objectClass: top
 objectClass: attributeSchema
@@ -7877,6 +7946,7 @@
 lDAPDisplayName: msDRM-IdentityCertificate
 schemaIDGUID: e85e1204-3434-41ad-9b56-e2901228fff0
 systemFlags: 16
+isMemberOfPartialAttributeSet: TRUE
 objectCategory: CN=Attribute-Schema,${SCHEMADN}
 
 dn: CN=Last-Logoff,${SCHEMADN}
@@ -8285,6 +8355,23 @@
 systemFlags: 134217748
 objectCategory: CN=Attribute-Schema,${SCHEMADN}
 
+dn: CN=GPC-Machine-Extension-Names,${SCHEMADN}
+objectClass: top
+objectClass: attributeSchema
+attributeID: 1.2.840.113556.1.4.1348
+attributeSyntax: 2.5.5.12
+isSingleValued: TRUE
+showInAdvancedViewOnly: TRUE
+adminDisplayName: GPC-Machine-Extension-Names
+adminDescription: GPC-Machine-Extension-Names
+oMSyntax: 64
+searchFlags: 0
+lDAPDisplayName: gPCMachineExtensionNames
+schemaIDGUID: 32ff8ecc-783f-11d2-9916-f87a57d4
+systemOnly: FALSE
+systemFlags: 16
+objectCategory: CN=Attribute-Schema,${SCHEMADN}
+
 dn: CN=USN-Created,${SCHEMADN}
 objectClass: top
 objectClass: attributeSchema
@@ -8799,6 +8886,23 @@
 systemFlags: 16
 objectCategory: CN=Attribute-Schema,${SCHEMADN}
 
+dn: CN=GPC-File-Sys-Path,${SCHEMADN}
+objectClass: top
+objectClass: attributeSchema
+attributeID: 1.2.840.113556.1.4.894
+attributeSyntax: 2.5.5.12
+isSingleValued: TRUE
+showInAdvancedViewOnly: TRUE
+adminDisplayName: GPC-File-Sys-Path
+adminDescription: GPC-File-Sys-Path
+oMSyntax: 64
+searchFlags: 0
+lDAPDisplayName: gPCFileSysPath
+schemaIDGUID: f30e3bc1-9ff0-11d1-b603-f80367c1
+systemOnly: FALSE
+systemFlags: 16
+objectCategory: CN=Attribute-Schema,${SCHEMADN}
+
 dn: CN=Top,${SCHEMADN}
 objectClass: top
 objectClass: classSchema
@@ -10390,6 +10494,32 @@
 objectCategory: CN=Class-Schema,${SCHEMADN}
 

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

2007-05-21 Thread abartlet
Author: abartlet
Date: 2007-05-21 11:57:56 + (Mon, 21 May 2007)
New Revision: 23034

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

Log:
Thanks to metze for providing some vital clues in the 'kerberos ccache
on credentials don't do anything' bug.

The problem was simple, we didn't set the ccache as having been
initialised, so we always created a new one.

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/auth/credentials/credentials_krb5.c


Changeset:
Modified: branches/SAMBA_4_0/source/auth/credentials/credentials_krb5.c
===
--- branches/SAMBA_4_0/source/auth/credentials/credentials_krb5.c   
2007-05-21 09:15:27 UTC (rev 23033)
+++ branches/SAMBA_4_0/source/auth/credentials/credentials_krb5.c   
2007-05-21 11:57:56 UTC (rev 23034)
@@ -247,6 +247,9 @@
*_ccc = ccc;
}
 
+   cred-ccache_obtained = (MAX(MAX(cred-principal_obtained, 
+cred-username_obtained), 
+cred-password_obtained));
return ret;
 }
 
@@ -259,8 +262,9 @@
cli_credentials_set_machine_account(cred);
}
 
-   if (cred-ccache_obtained = (MAX(cred-principal_obtained, 
- cred-username_obtained))) {
+   if (cred-ccache_obtained =(MAX(MAX(cred-principal_obtained, 
+cred-username_obtained), 
+cred-password_obtained))) {
*ccc = cred-ccache;
return 0;
}



svn commit: samba r23035 - in branches/SAMBA_4_0/source/selftest: .

2007-05-21 Thread abartlet
Author: abartlet
Date: 2007-05-21 12:03:15 + (Mon, 21 May 2007)
New Revision: 23035

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

Log:
We don't need to add this entry, and I hope to figure out how to avoid
adding the other two manually.

However, to do this we do need to skip the check (with -u) that
slaptest can access the db.

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/selftest/Samba4.pm


Changeset:
Modified: branches/SAMBA_4_0/source/selftest/Samba4.pm
===
--- branches/SAMBA_4_0/source/selftest/Samba4.pm2007-05-21 11:57:56 UTC 
(rev 23034)
+++ branches/SAMBA_4_0/source/selftest/Samba4.pm2007-05-21 12:03:15 UTC 
(rev 23035)
@@ -435,11 +435,10 @@
}
 
system(slaptest -u -f $slapd_conf) == 0 or die(slaptest still fails 
after adding modules);
-   system(slapadd -b $basedn -f $slapd_conf -l $privatedir/$dnsname.ldif 
/dev/null) == 0 or die(slapadd failed);
system(slapadd -b cn=Configuration,$basedn -f $slapd_conf -l 
$privatedir/$dnsname-config.ldif /dev/null) == 0 or die(slapadd failed);
system(slapadd -b cn=Schema,cn=Configuration,$basedn -f $slapd_conf -l 
$privatedir/$dnsname-schema.ldif /dev/null) == 0 or die(slapadd failed);
 
-system(slaptest -f $slapd_conf /dev/null) == 0 or 
+system(slaptest -u -f $slapd_conf /dev/null) == 0 or 
die (slaptest after database load failed);
 
$ENV{PATH} = $oldpath;



svn commit: samba r23036 - in branches/SAMBA_4_0/source: auth/gensec auth/kerberos ldap_server libcli/cldap libcli/ldap libcli/util

2007-05-21 Thread tridge
Author: tridge
Date: 2007-05-21 12:47:18 + (Mon, 21 May 2007)
New Revision: 23036

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

Log:

error checking on asn1_init() failure

Modified:
   branches/SAMBA_4_0/source/auth/gensec/spnego_parse.c
   branches/SAMBA_4_0/source/auth/kerberos/gssapi_parse.c
   branches/SAMBA_4_0/source/ldap_server/ldap_server.c
   branches/SAMBA_4_0/source/libcli/cldap/cldap.c
   branches/SAMBA_4_0/source/libcli/ldap/ldap.c
   branches/SAMBA_4_0/source/libcli/ldap/ldap_client.c
   branches/SAMBA_4_0/source/libcli/ldap/ldap_controls.c
   branches/SAMBA_4_0/source/libcli/util/asn1.c


Changeset:
Modified: branches/SAMBA_4_0/source/auth/gensec/spnego_parse.c
===
--- branches/SAMBA_4_0/source/auth/gensec/spnego_parse.c2007-05-21 
12:03:15 UTC (rev 23035)
+++ branches/SAMBA_4_0/source/auth/gensec/spnego_parse.c2007-05-21 
12:47:18 UTC (rev 23036)
@@ -265,7 +265,7 @@
 
 ssize_t spnego_read_data(TALLOC_CTX *mem_ctx, DATA_BLOB data, struct 
spnego_data *token)
 {
-   struct asn1_data *asn1 = asn1_init(mem_ctx);
+   struct asn1_data *asn1;
ssize_t ret = -1;
uint8_t context;
 
@@ -275,6 +275,11 @@
return ret;
}
 
+   asn1 = asn1_init(mem_ctx);
+   if (asn1 == NULL) {
+   return -1;
+   }
+
asn1_load(asn1, data);
 
if (!asn1_peek_uint8(asn1, context)) {
@@ -311,6 +316,10 @@
struct asn1_data *asn1 = asn1_init(mem_ctx);
ssize_t ret = -1;
 
+   if (asn1 == NULL) {
+   return -1;
+   }
+
switch (spnego-type) {
case SPNEGO_NEG_TOKEN_INIT:
asn1_push_tag(asn1, ASN1_APPLICATION(0));

Modified: branches/SAMBA_4_0/source/auth/kerberos/gssapi_parse.c
===
--- branches/SAMBA_4_0/source/auth/kerberos/gssapi_parse.c  2007-05-21 
12:03:15 UTC (rev 23035)
+++ branches/SAMBA_4_0/source/auth/kerberos/gssapi_parse.c  2007-05-21 
12:47:18 UTC (rev 23036)
@@ -31,13 +31,18 @@
 */
 DATA_BLOB gensec_gssapi_gen_krb5_wrap(TALLOC_CTX *mem_ctx, const DATA_BLOB 
*ticket, const uint8_t tok_id[2])
 {
-   struct asn1_data *data = asn1_init(mem_ctx);
+   struct asn1_data *data;
DATA_BLOB ret;
 
if (!data || !ticket-data) {
return data_blob(NULL,0);
}
 
+   data = asn1_init(mem_ctx);
+   if (data == NULL) {
+   return data_blob(NULL,0);
+   }
+
asn1_push_tag(data, ASN1_APPLICATION(0));
asn1_write_OID(data, GENSEC_OID_KERBEROS5);
 
@@ -66,6 +71,10 @@
struct asn1_data *data = asn1_init(mem_ctx);
int data_remaining;
 
+   if (!data) {
+   return False;
+   }
+
asn1_load(data, *blob);
asn1_start_tag(data, ASN1_APPLICATION(0));
asn1_check_OID(data, GENSEC_OID_KERBEROS5);
@@ -99,6 +108,8 @@
BOOL ret;
struct asn1_data *data = asn1_init(NULL);
 
+   if (!data) return False;
+
asn1_load(data, *blob);
asn1_start_tag(data, ASN1_APPLICATION(0));
asn1_check_OID(data, oid);

Modified: branches/SAMBA_4_0/source/ldap_server/ldap_server.c
===
--- branches/SAMBA_4_0/source/ldap_server/ldap_server.c 2007-05-21 12:03:15 UTC 
(rev 23035)
+++ branches/SAMBA_4_0/source/ldap_server/ldap_server.c 2007-05-21 12:47:18 UTC 
(rev 23036)
@@ -137,11 +137,13 @@
struct asn1_data *asn1 = asn1_init(conn);
struct ldap_message *msg = talloc(conn, struct ldap_message);
 
-   if (msg == NULL) {
+   if (asn1 == NULL || msg == NULL) {
return NT_STATUS_NO_MEMORY;
}
 
if (!asn1_load(asn1, blob)) {
+   talloc_free(msg);
+   talloc_free(asn1);
return NT_STATUS_NO_MEMORY;
}
 

Modified: branches/SAMBA_4_0/source/libcli/cldap/cldap.c
===
--- branches/SAMBA_4_0/source/libcli/cldap/cldap.c  2007-05-21 12:03:15 UTC 
(rev 23035)
+++ branches/SAMBA_4_0/source/libcli/cldap/cldap.c  2007-05-21 12:47:18 UTC 
(rev 23036)
@@ -70,6 +70,8 @@
struct ldap_message *ldap_msg;
struct cldap_request *req;
 
+   if (!asn1) return;
+
status = socket_pending(cldap-sock, dsize);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(tmp_ctx);

Modified: branches/SAMBA_4_0/source/libcli/ldap/ldap.c
===
--- branches/SAMBA_4_0/source/libcli/ldap/ldap.c2007-05-21 12:03:15 UTC 
(rev 23035)
+++ branches/SAMBA_4_0/source/libcli/ldap/ldap.c2007-05-21 12:47:18 UTC 
(rev 23036)
@@ -193,6 +193,8 @@
struct asn1_data *data = asn1_init(mem_ctx);
int i, j;
 
+   if (!data) return False;
+

svn commit: samba r23037 - in branches/SAMBA_4_0/source/libcli/util: .

2007-05-21 Thread metze
Author: metze
Date: 2007-05-21 13:33:46 + (Mon, 21 May 2007)
New Revision: 23037

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

Log:
actually fix the asn1 memory leak :-)

metze
Modified:
   branches/SAMBA_4_0/source/libcli/util/asn1.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/util/asn1.c
===
--- branches/SAMBA_4_0/source/libcli/util/asn1.c2007-05-21 12:47:18 UTC 
(rev 23036)
+++ branches/SAMBA_4_0/source/libcli/util/asn1.c2007-05-21 13:33:46 UTC 
(rev 23037)
@@ -24,7 +24,7 @@
 /* allocate an asn1 structure */
 struct asn1_data *asn1_init(TALLOC_CTX *mem_ctx)
 {
-   struct asn1_data *ret = talloc_zero(NULL, struct asn1_data);
+   struct asn1_data *ret = talloc_zero(mem_ctx, struct asn1_data);
if (ret == NULL) {
DEBUG(0,(asn1_init failed! out of memory\n));
}



svn commit: samba r23038 - in branches/SAMBA_3_0_26/source/nsswitch: .

2007-05-21 Thread metze
Author: metze
Date: 2007-05-21 13:39:34 + (Mon, 21 May 2007)
New Revision: 23038

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

Log:
use a helper function to construct the TDB_DATA key
as strlen_m() is totally wrong here anyway

metze
Modified:
   branches/SAMBA_3_0_26/source/nsswitch/winbindd_cache.c


Changeset:
Modified: branches/SAMBA_3_0_26/source/nsswitch/winbindd_cache.c
===
--- branches/SAMBA_3_0_26/source/nsswitch/winbindd_cache.c  2007-05-21 
13:33:46 UTC (rev 23037)
+++ branches/SAMBA_3_0_26/source/nsswitch/winbindd_cache.c  2007-05-21 
13:39:34 UTC (rev 23038)
@@ -3566,8 +3566,7 @@
   

asprintf( keystr, TRUSTDOMCACHE/%s, domain_name );
-   key.dptr = (unsigned char*)keystr;
-   key.dsize = strlen_m(keystr) + 1;
+   key = string_term_tdb_data(keystr);

return key; 
 }



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

2007-05-21 Thread metze
Author: metze
Date: 2007-05-21 13:40:27 + (Mon, 21 May 2007)
New Revision: 23039

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

Log:
merge from SAMBA_3_0_26:

use a helper function to construct the TDB_DATA key
as strlen_m() is totally wrong here anyway

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


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c 2007-05-21 13:39:34 UTC 
(rev 23038)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c 2007-05-21 13:40:27 UTC 
(rev 23039)
@@ -3566,8 +3566,7 @@
   

asprintf( keystr, TRUSTDOMCACHE/%s, domain_name );
-   key.dptr = (unsigned char*)keystr;
-   key.dsize = strlen_m(keystr) + 1;
+   key = string_term_tdb_data(keystr);

return key; 
 }



Re: svn commit: samba r23034 - in branches/SAMBA_4_0/source/auth/credentials: .

2007-05-21 Thread Stefan (metze) Metzmacher
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

[EMAIL PROTECTED] schrieb:
 Author: abartlet
 Date: 2007-05-21 11:57:56 + (Mon, 21 May 2007)
 New Revision: 23034
 
 WebSVN: 
 http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=23034
 
 Log:
 Thanks to metze for providing some vital clues in the 'kerberos ccache
 on credentials don't do anything' bug.
 
 The problem was simple, we didn't set the ccache as having been
 initialised, so we always created a new one.

Hi Andrew,

now we need to reset a lot more stuff than cred-nt_hash in
cli_credentials_set_username(), cli_credentials_set_principal()
and cli_credentials_set_password()...so that make test passes again:-)

metze

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

iD8DBQFGUaJxm70gjA5TCD8RAgvUAJ0YMEp8g8pJvny9wGkqd+A//g6fBwCeKT/h
eV2NVEM4FJ4If5Qc5m9F1Tc=
=UIeZ
-END PGP SIGNATURE-


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

2007-05-21 Thread obnox
Author: obnox
Date: 2007-05-21 15:58:27 + (Mon, 21 May 2007)
New Revision: 23040

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

Log:
Activate the winbindd cache validation code in the 
winbindd main function.

I have tested and somewhat extended the code, and it seems 
to do a good job. I have possibly not caught all error
conditions though.

Michael


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


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd.c   2007-05-21 13:40:27 UTC 
(rev 23039)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd.c   2007-05-21 15:58:27 UTC 
(rev 23040)
@@ -1103,7 +1103,6 @@
 
pidfile_create(winbindd);
 
-#if 0  /* not finished yet */
/* Ensure all cache and idmap caches are consistent
   before we startup. */
 
@@ -1117,7 +1116,6 @@
}
return execve(argv[0], argv, envp);
}
-#endif
 
 #if HAVE_SETPGID
/*



svn commit: samba r23041 - in branches: SAMBA_3_0/source/lib SAMBA_3_0_25/source/lib SAMBA_3_0_26/source/lib

2007-05-21 Thread jmcd
Author: jmcd
Date: 2007-05-21 16:01:22 + (Mon, 21 May 2007)
New Revision: 23041

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

Log:
Remainder of fix for 4630: fix special case of unix_to_nt_time() for
TIME_T_MAX, and also display of it in http_timestring()

Modified:
   branches/SAMBA_3_0/source/lib/time.c
   branches/SAMBA_3_0_25/source/lib/time.c
   branches/SAMBA_3_0_26/source/lib/time.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/time.c
===
--- branches/SAMBA_3_0/source/lib/time.c2007-05-21 15:58:27 UTC (rev 
23040)
+++ branches/SAMBA_3_0/source/lib/time.c2007-05-21 16:01:22 UTC (rev 
23041)
@@ -95,7 +95,13 @@
if (t == (time_t)-1) {
*nt = (NTTIME)-1LL;
return;
-   }   
+   }   
+
+   if (t == TIME_T_MAX) {
+   *nt = 0x7fffLL;
+   return;
+   }
+
if (t == 0) {
*nt = 0;
return;
@@ -301,7 +307,9 @@
static fstring buf;
struct tm *tm = localtime(t);
 
-   if (!tm) {
+   if (t == TIME_T_MAX) {
+   slprintf(buf,sizeof(buf)-1,never);
+   } else if (!tm) {
slprintf(buf,sizeof(buf)-1,%ld seconds since the 
Epoch,(long)t);
} else {
 #ifndef HAVE_STRFTIME

Modified: branches/SAMBA_3_0_25/source/lib/time.c
===
--- branches/SAMBA_3_0_25/source/lib/time.c 2007-05-21 15:58:27 UTC (rev 
23040)
+++ branches/SAMBA_3_0_25/source/lib/time.c 2007-05-21 16:01:22 UTC (rev 
23041)
@@ -95,7 +95,13 @@
if (t == (time_t)-1) {
*nt = (NTTIME)-1LL;
return;
-   }   
+   }   
+
+   if (t == TIME_T_MAX) {
+   *nt = 0x7fffLL;
+   return;
+   }
+
if (t == 0) {
*nt = 0;
return;
@@ -301,7 +307,9 @@
static fstring buf;
struct tm *tm = localtime(t);
 
-   if (!tm) {
+   if (t == TIME_T_MAX) {
+   slprintf(buf,sizeof(buf)-1,never);
+   } else if (!tm) {
slprintf(buf,sizeof(buf)-1,%ld seconds since the 
Epoch,(long)t);
} else {
 #ifndef HAVE_STRFTIME

Modified: branches/SAMBA_3_0_26/source/lib/time.c
===
--- branches/SAMBA_3_0_26/source/lib/time.c 2007-05-21 15:58:27 UTC (rev 
23040)
+++ branches/SAMBA_3_0_26/source/lib/time.c 2007-05-21 16:01:22 UTC (rev 
23041)
@@ -95,7 +95,13 @@
if (t == (time_t)-1) {
*nt = (NTTIME)-1LL;
return;
-   }   
+   }   
+
+   if (t == TIME_T_MAX) {
+   *nt = 0x7fffLL;
+   return;
+   }
+
if (t == 0) {
*nt = 0;
return;
@@ -301,7 +307,9 @@
static fstring buf;
struct tm *tm = localtime(t);
 
-   if (!tm) {
+   if (t == TIME_T_MAX) {
+   slprintf(buf,sizeof(buf)-1,never);
+   } else if (!tm) {
slprintf(buf,sizeof(buf)-1,%ld seconds since the 
Epoch,(long)t);
} else {
 #ifndef HAVE_STRFTIME



svn commit: samba r23042 - in branches/SAMBA_3_0_26/source/librpc: . idl

2007-05-21 Thread vlendec
Author: vlendec
Date: 2007-05-21 16:14:22 + (Mon, 21 May 2007)
New Revision: 23042

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

Log:
Add the IDL files necessary to build gen_ndr for informational purposes

Added:
   branches/SAMBA_3_0_26/source/librpc/idl/
   branches/SAMBA_3_0_26/source/librpc/idl/notify.idl
   branches/SAMBA_3_0_26/source/librpc/idl/security.idl
   branches/SAMBA_3_0_26/source/librpc/idl/srvsvc.idl
   branches/SAMBA_3_0_26/source/librpc/idl/svcctl.idl
   branches/SAMBA_3_0_26/source/librpc/idl/wkssvc.idl


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


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

2007-05-21 Thread metze
Author: metze
Date: 2007-05-21 17:12:49 + (Mon, 21 May 2007)
New Revision: 23043

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

Log:
allow more than UINT16_MAX - 1 handles on smb2 connections

metze
Modified:
   branches/SAMBA_4_0/source/smb_server/tcon.c


Changeset:
Modified: branches/SAMBA_4_0/source/smb_server/tcon.c
===
--- branches/SAMBA_4_0/source/smb_server/tcon.c 2007-05-21 16:14:22 UTC (rev 
23042)
+++ branches/SAMBA_4_0/source/smb_server/tcon.c 2007-05-21 17:12:49 UTC (rev 
23043)
@@ -147,6 +147,7 @@
 {
TALLOC_CTX *mem_ctx;
struct smbsrv_tcons_context *tcons_ctx;
+   uint32_t handle_uint_max;
struct smbsrv_tcon *tcon;
NTSTATUS status;
int i;
@@ -154,9 +155,11 @@
if (smb_sess) {
mem_ctx = smb_sess;
tcons_ctx = smb_sess-smb2_tcons;
+   handle_uint_max = UINT32_MAX;
} else {
mem_ctx = smb_conn;
tcons_ctx = smb_conn-smb_tcons;
+   handle_uint_max = UINT16_MAX;
}
 
tcon = talloc_zero(mem_ctx, struct smbsrv_tcon);
@@ -170,7 +173,7 @@
 * the use -1 here, because we don't want to give away the wildcard
 * fnum used in SMBflush
 */
-   status = smbsrv_init_handles(tcon, UINT16_MAX - 1);
+   status = smbsrv_init_handles(tcon, handle_uint_max - 1);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1,(ERROR! failed to init handles: %s\n, 
nt_errstr(status)));
goto failed;



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

2007-05-21 Thread metze
Author: metze
Date: 2007-05-21 17:23:56 + (Mon, 21 May 2007)
New Revision: 23044

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

Log:
- use uint32_t for handle id's
- include the session vuid in the SMB2 128-Bit wire handles
  as SMB2 oplock breaks doesn't include a TID or VUID in the header
  we need to make sure the handle is unique for the whole TCP connection

metze  
Modified:
   branches/SAMBA_4_0/source/smb_server/handle.c
   branches/SAMBA_4_0/source/smb_server/smb2/tcon.c
   branches/SAMBA_4_0/source/smb_server/smb_server.h


Changeset:
Modified: branches/SAMBA_4_0/source/smb_server/handle.c
===
--- branches/SAMBA_4_0/source/smb_server/handle.c   2007-05-21 17:12:49 UTC 
(rev 23043)
+++ branches/SAMBA_4_0/source/smb_server/handle.c   2007-05-21 17:23:56 UTC 
(rev 23044)
@@ -27,7 +27,7 @@
 /
 init the handle structures
 /
-NTSTATUS smbsrv_init_handles(struct smbsrv_tcon *tcon, uint64_t limit)
+NTSTATUS smbsrv_init_handles(struct smbsrv_tcon *tcon, uint32_t limit)
 {
/* 
 * the idr_* functions take 'int' as limit,
@@ -47,7 +47,7 @@
 find a handle given a handle id
 /
 static struct smbsrv_handle *smbsrv_handle_find(struct smbsrv_handles_context 
*handles_ctx,
-   uint64_t hid, struct timeval 
request_time)
+   uint32_t hid, struct timeval 
request_time)
 {
void *p;
struct smbsrv_handle *handle;
@@ -77,7 +77,7 @@
 }
 
 struct smbsrv_handle *smbsrv_smb2_handle_find(struct smbsrv_tcon *smb_tcon,
- uint64_t hid, struct timeval 
request_time)
+ uint32_t hid, struct timeval 
request_time)
 {
return smbsrv_handle_find(smb_tcon-handles, hid, request_time);
 }

Modified: branches/SAMBA_4_0/source/smb_server/smb2/tcon.c
===
--- branches/SAMBA_4_0/source/smb_server/smb2/tcon.c2007-05-21 17:12:49 UTC 
(rev 23043)
+++ branches/SAMBA_4_0/source/smb_server/smb2/tcon.c2007-05-21 17:23:56 UTC 
(rev 23044)
@@ -41,9 +41,9 @@
 {
struct smbsrv_tcon *tcon;
struct smbsrv_handle *handle;
-   uint64_t hid;
+   uint32_t hid;
uint32_t tid;
-   uint32_t pad;
+   uint64_t uid;
 
/*
 * if there're chained requests used the cached handle
@@ -56,16 +56,20 @@
offset = 0;
}
 
-   hid = BVAL(base, offset);
-   tid = IVAL(base, offset + 8);
-   pad = IVAL(base, offset + 12);
+   hid = IVAL(base, offset);
+   tid = IVAL(base, offset + 4);
+   uid = BVAL(base, offset + 8);
 
-   if (pad != UINT32_MAX) {
+   /* if it's the wildcard handle, don't waste time to search it... */
+   if (hid == UINT32_MAX  tid == UINT32_MAX  uid == UINT64_MAX) {
return NULL;
}
 
-   /* if it's the wildcard handle, don't waste time to search it... */
-   if (hid == UINT64_MAX  tid == UINT32_MAX) {
+   /*
+* if the (v)uid part doesn't match the given session the handle isn't
+* valid
+*/
+   if (uid != req-session-vuid) {
return NULL;
}
 
@@ -74,7 +78,7 @@
 * as that TID in the SMB2 header says, but
 * the request should succeed nevertheless!
 *
-* because if this we put the 32 bit TID into the
+* because of this we put the 32 bit TID into the
 * 128 bit handle, so that we can extract the tcon from the
 * handle
 */
@@ -102,6 +106,8 @@
 * as the handle may have overwritten the tcon
 * we need to set it on the request so that the
 * correct ntvfs context will be used for the ntvfs_*() request
+*
+* TODO: check if that's correct for chained requests as well!
 */
req-tcon = tcon;
return handle-ntvfs;
@@ -115,9 +121,9 @@
/* 
 * the handle is 128 bit on the wire
 */
-   SBVAL(base, offset, handle-hid);
-   SIVAL(base, offset + 8, handle-tcon-tid);
-   SIVAL(base, offset + 12,UINT32_MAX);
+   SIVAL(base, offset, handle-hid);
+   SIVAL(base, offset + 4, handle-tcon-tid);
+   SBVAL(base, offset + 8, handle-session-vuid);
 }
 
 static NTSTATUS smb2srv_handle_create_new(void *private_data, struct 
ntvfs_request *ntvfs, struct ntvfs_handle **_h)

Modified: branches/SAMBA_4_0/source/smb_server/smb_server.h
===
--- branches/SAMBA_4_0/source/smb_server/smb_server.h   2007-05-21 17:12:49 UTC 
(rev 23043)
+++ 

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

2007-05-21 Thread metze
Author: metze
Date: 2007-05-21 17:39:05 + (Mon, 21 May 2007)
New Revision: 23045

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

Log:
forward SMB2 oplock breaks to the client

metze
Modified:
   branches/SAMBA_4_0/source/smb_server/smb2/receive.c
   branches/SAMBA_4_0/source/smb_server/smb2/tcon.c


Changeset:
Modified: branches/SAMBA_4_0/source/smb_server/smb2/receive.c
===
--- branches/SAMBA_4_0/source/smb_server/smb2/receive.c 2007-05-21 17:23:56 UTC 
(rev 23044)
+++ branches/SAMBA_4_0/source/smb_server/smb2/receive.c 2007-05-21 17:39:05 UTC 
(rev 23045)
@@ -44,7 +44,7 @@
return -1;
 }
 
-static struct smb2srv_request *smb2srv_init_request(struct smbsrv_connection 
*smb_conn)
+struct smb2srv_request *smb2srv_init_request(struct smbsrv_connection 
*smb_conn)
 {
struct smb2srv_request *req;
 

Modified: branches/SAMBA_4_0/source/smb_server/smb2/tcon.c
===
--- branches/SAMBA_4_0/source/smb_server/smb2/tcon.c2007-05-21 17:23:56 UTC 
(rev 23044)
+++ branches/SAMBA_4_0/source/smb_server/smb2/tcon.c2007-05-21 17:39:05 UTC 
(rev 23045)
@@ -31,9 +31,56 @@
 /*
   send an oplock break request to a client
 */
-static NTSTATUS smb2srv_send_oplock_break(void *p, struct ntvfs_handle *ntvfs, 
uint8_t level)
+static NTSTATUS smb2srv_send_oplock_break(void *p, struct ntvfs_handle *h, 
uint8_t level)
 {
-   DEBUG(0,(TODO: we don't pass SMB2 oplock breaks to the Clients 
yet!\n));
+   struct smbsrv_handle *handle = 
talloc_get_type(h-frontend_data.private_data,
+  struct smbsrv_handle);
+   struct smb2srv_request *req;
+   NTSTATUS status;
+
+   /* setup a dummy request structure */
+   req = smb2srv_init_request(handle-tcon-smb_conn);
+   NT_STATUS_HAVE_NO_MEMORY(req);
+
+   req-in.buffer  = talloc_size(req, NBT_HDR_SIZE + 
SMB2_MIN_SIZE);
+   NT_STATUS_HAVE_NO_MEMORY(req-in.buffer);
+   req-in.size= NBT_HDR_SIZE + SMB2_MIN_SIZE;
+   req-in.allocated   = req-in.size;
+
+   req-in.hdr = req-in.buffer+ NBT_HDR_SIZE;
+   req-in.body= req-in.hdr   + SMB2_HDR_BODY;
+   req-in.body_size   = req-in.size  - (SMB2_HDR_BODY+NBT_HDR_SIZE);
+   req-in.dynamic = NULL;
+
+   req-seqnum = UINT64_MAX;
+
+   SIVAL(req-in.hdr, 0,   SMB2_MAGIC);
+   SSVAL(req-in.hdr, SMB2_HDR_LENGTH, SMB2_HDR_BODY);
+   SSVAL(req-in.hdr, SMB2_HDR_PAD1,   0);
+   SIVAL(req-in.hdr, SMB2_HDR_STATUS, 0);
+   SSVAL(req-in.hdr, SMB2_HDR_OPCODE, SMB2_OP_BREAK);
+   SSVAL(req-in.hdr, SMB2_HDR_UNKNOWN1,   0);
+   SIVAL(req-in.hdr, SMB2_HDR_FLAGS,  0);
+   SIVAL(req-in.hdr, SMB2_HDR_CHAIN_OFFSET,   0);
+   SBVAL(req-in.hdr, SMB2_HDR_SEQNUM, 0);
+   SIVAL(req-in.hdr, SMB2_HDR_PID,0);
+   SIVAL(req-in.hdr, SMB2_HDR_TID,0);
+   SBVAL(req-in.hdr, SMB2_HDR_UID,0);
+   memset(req-in.hdr+SMB2_HDR_SIG, 0, 16);
+
+   SSVAL(req-in.body, 0, 2);
+
+   status = smb2srv_setup_reply(req, 0x18, False, 0);
+   NT_STATUS_NOT_OK_RETURN(status);
+
+   SSVAL(req-out.hdr, SMB2_HDR_UNKNOWN1,  0x);
+
+   SSVAL(req-out.body, 0x02, 0x0001);
+   SIVAL(req-out.body, 0x04, 0x);
+   smb2srv_push_handle(req-out.body, 0x08, h);
+
+   smb2srv_send_reply(req);
+
return NT_STATUS_OK;
 }
 



svn commit: samba r23046 - in branches: SAMBA_3_0/source/nsswitch SAMBA_3_0/source/passdb SAMBA_3_0_26/source/nsswitch SAMBA_3_0_26/source/passdb

2007-05-21 Thread jerry
Author: jerry
Date: 2007-05-21 19:12:14 + (Mon, 21 May 2007)
New Revision: 23046

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

Log:
Few missing merges from cleaning out the Centeris winbindd tree.
Nothing of major interest.  Will fix a few problems with one way trusts.


Modified:
   branches/SAMBA_3_0/source/nsswitch/winbindd.c
   branches/SAMBA_3_0/source/nsswitch/winbindd_rpc.c
   branches/SAMBA_3_0/source/nsswitch/winbindd_util.c
   branches/SAMBA_3_0/source/passdb/pdb_interface.c
   branches/SAMBA_3_0_26/source/nsswitch/winbindd.c
   branches/SAMBA_3_0_26/source/nsswitch/winbindd_rpc.c
   branches/SAMBA_3_0_26/source/nsswitch/winbindd_util.c
   branches/SAMBA_3_0_26/source/passdb/pdb_interface.c


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd.c   2007-05-21 17:39:05 UTC 
(rev 23045)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd.c   2007-05-21 19:12:14 UTC 
(rev 23046)
@@ -1164,6 +1164,10 @@
 
wcache_tdc_clear(); 

+   /* clear the cached list of trusted domains */
+
+   wcache_tdc_clear(); 
+   
if (!init_domain_list()) {
DEBUG(0,(unable to initalize domain list\n));
exit(1);

Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_rpc.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd_rpc.c   2007-05-21 17:39:05 UTC 
(rev 23045)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_rpc.c   2007-05-21 19:12:14 UTC 
(rev 23046)
@@ -458,6 +458,12 @@
return NT_STATUS_OK;
}

+   if ( !winbindd_can_contact_domain( domain ) ) {
+   DEBUG(10,(query_user: No incoming trust for domain %s\n,
+ domain-name));
+   return NT_STATUS_OK;
+   }
+   
/* no cache; hit the wire */

result = cm_connect_sam(domain, mem_ctx, cli, dom_pol);

Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_util.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd_util.c  2007-05-21 17:39:05 UTC 
(rev 23045)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_util.c  2007-05-21 19:12:14 UTC 
(rev 23046)
@@ -148,6 +148,16 @@
return domain;  
}   
 
+   /* See if we found a match.  Check if we need to update the
+  SID. */
+
+   if ( domain ) {
+   if ( sid_equal( domain-sid, global_sid_NULL ) )
+   sid_copy( domain-sid, sid );
+
+   return domain;  
+   }   
+
/* Create new domain entry */
 
if ((domain = SMB_MALLOC_P(struct winbindd_domain)) == NULL)

Modified: branches/SAMBA_3_0/source/passdb/pdb_interface.c
===
--- branches/SAMBA_3_0/source/passdb/pdb_interface.c2007-05-21 17:39:05 UTC 
(rev 23045)
+++ branches/SAMBA_3_0/source/passdb/pdb_interface.c2007-05-21 19:12:14 UTC 
(rev 23046)
@@ -1307,7 +1307,7 @@
goto done;  
}

-   /* check for Unix User */
+   /* check for Unix Group */
 
if ( sid_peek_check_rid(global_sid_Unix_Groups, sid, rid) ) {
id-gid = rid;

Modified: branches/SAMBA_3_0_26/source/nsswitch/winbindd.c
===
--- branches/SAMBA_3_0_26/source/nsswitch/winbindd.c2007-05-21 17:39:05 UTC 
(rev 23045)
+++ branches/SAMBA_3_0_26/source/nsswitch/winbindd.c2007-05-21 19:12:14 UTC 
(rev 23046)
@@ -,6 +,10 @@
 
wcache_tdc_clear(); 

+   /* clear the cached list of trusted domains */
+
+   wcache_tdc_clear(); 
+   
if (!init_domain_list()) {
DEBUG(0,(unable to initalize domain list\n));
exit(1);

Modified: branches/SAMBA_3_0_26/source/nsswitch/winbindd_rpc.c
===
--- branches/SAMBA_3_0_26/source/nsswitch/winbindd_rpc.c2007-05-21 
17:39:05 UTC (rev 23045)
+++ branches/SAMBA_3_0_26/source/nsswitch/winbindd_rpc.c2007-05-21 
19:12:14 UTC (rev 23046)
@@ -458,6 +458,12 @@
return NT_STATUS_OK;
}

+   if ( !winbindd_can_contact_domain( domain ) ) {
+   DEBUG(10,(query_user: No incoming trust for domain %s\n,
+ domain-name));
+   return NT_STATUS_OK;
+   }
+   
/* no cache; hit the wire */

result = cm_connect_sam(domain, mem_ctx, cli, dom_pol);

Modified: branches/SAMBA_3_0_26/source/nsswitch/winbindd_util.c
===
--- 

svn commit: samba r23047 - in branches/SAMBA_4_0/source/scripting/ejs: .

2007-05-21 Thread mimir
Author: mimir
Date: 2007-05-21 19:53:57 + (Mon, 21 May 2007)
New Revision: 23047

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

Log:
Allow local inclusion of js files as well as from predefined
path(s).


rafal


Modified:
   branches/SAMBA_4_0/source/scripting/ejs/smbcalls.c


Changeset:
Modified: branches/SAMBA_4_0/source/scripting/ejs/smbcalls.c
===
--- branches/SAMBA_4_0/source/scripting/ejs/smbcalls.c  2007-05-21 19:12:14 UTC 
(rev 23046)
+++ branches/SAMBA_4_0/source/scripting/ejs/smbcalls.c  2007-05-21 19:53:57 UTC 
(rev 23047)
@@ -120,17 +120,34 @@
 
for (i = 0; i  argc; i++) {
const char *script = argv[i];
+   struct MprVar result;
+   char *path, *emsg;
+   int ret;
 
+   /* First, try to include file from current working directory.
+  This allows local includes which is handy sometimes. */
+   path = talloc_asprintf(mprMemCtx(), %s, script);
+   if (path == NULL) {
+   return -1;
+   }
+   
+   if (file_exist(path)) {
+   ret = ejsEvalFile(eid, path, result, emsg);
+   talloc_free(path);
+   if (ret  0) {
+   ejsSetErrorMsg(eid, %s: %s, script, emsg);
+   return -1;
+   }
+   continue;
+   }
+
+   /* use specfied path to search for requested file */
for (j=0;js_include[j];j++) {
-   char *path;
path = talloc_asprintf(mprMemCtx(), %s/%s, 
js_include[j], script);
if (path == NULL) {
return -1;
}
if (file_exist(path)) {
-   int ret;
-   struct MprVar result;
-   char *emsg;
 
ret = ejsEvalFile(eid, path, result, emsg);
talloc_free(path);
@@ -142,6 +159,7 @@
}
talloc_free(path);
}
+
if (js_include[j] == NULL) {
ejsSetErrorMsg(eid, unable to include '%s', script);
return -1;



svn commit: samba r23048 - in branches: SAMBA_3_0/source/nsswitch SAMBA_3_0_26/source/nsswitch

2007-05-21 Thread jerry
Author: jerry
Date: 2007-05-21 20:36:22 + (Mon, 21 May 2007)
New Revision: 23048

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

Log:
Simo is correct in that winbind_lookup{sid,name}_async() needs
to be able to handle SIDs in the S-1-22-{1,2} domain in order
for winbindd_sid_to_uid(), et. al. to succeed.  For 3.0.25a,
we will short circuit in the sid_to_uid() family of functions
so that smbd is ok.

For 3.0.26, we need to allow winbindd to handle all types of SIDs.


Modified:
   branches/SAMBA_3_0/source/nsswitch/idmap.c
   branches/SAMBA_3_0/source/nsswitch/winbindd_passdb.c
   branches/SAMBA_3_0/source/nsswitch/winbindd_util.c
   branches/SAMBA_3_0_26/source/nsswitch/idmap.c
   branches/SAMBA_3_0_26/source/nsswitch/winbindd_passdb.c
   branches/SAMBA_3_0_26/source/nsswitch/winbindd_util.c


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/idmap.c
===
--- branches/SAMBA_3_0/source/nsswitch/idmap.c  2007-05-21 19:53:57 UTC (rev 
23047)
+++ branches/SAMBA_3_0/source/nsswitch/idmap.c  2007-05-21 20:36:22 UTC (rev 
23048)
@@ -821,7 +821,10 @@
/* Check we do not create mappings for our own local domain, or BUILTIN 
or special SIDs */
if ((sid_compare_domain(map-sid, get_global_sam_sid()) == 0) ||
sid_check_is_in_builtin(map-sid) ||
-   sid_check_is_in_wellknown_domain(map-sid)) {
+   sid_check_is_in_wellknown_domain(map-sid) ||
+   sid_check_is_in_unix_users(map-sid) ||
+   sid_check_is_in_unix_groups(map-sid) ) 
+   {
DEBUG(10, (We are not supposed to create mappings for our own 
domains (local, builtin, specials)\n));
return NT_STATUS_UNSUCCESSFUL;
}

Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_passdb.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd_passdb.c2007-05-21 
19:53:57 UTC (rev 23047)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_passdb.c2007-05-21 
20:36:22 UTC (rev 23048)
@@ -125,7 +125,12 @@
 
/* Paranoia check */
if (!sid_check_is_in_builtin(sid) 
-   !sid_check_is_in_our_domain(sid)) {
+   !sid_check_is_in_our_domain(sid) 
+   !sid_check_is_in_unix_users(sid) 
+   !sid_check_is_unix_users(sid) 
+   !sid_check_is_in_unix_groups(sid) 
+   !sid_check_is_unix_groups(sid) )
+   {
DEBUG(0, (Possible deadlock: Trying to lookup SID %s with 
  passdb backend\n, sid_string_static(sid)));
return NT_STATUS_NONE_MAPPED;

Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_util.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd_util.c  2007-05-21 19:53:57 UTC 
(rev 23047)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_util.c  2007-05-21 20:36:22 UTC 
(rev 23048)
@@ -914,6 +914,17 @@
return find_domain_from_sid(sid);
}
 
+   /* SIDs in the S-1-22-{1,2} domain should be handled by our passdb */
+
+   if ( sid_check_is_in_unix_groups(sid) || 
+sid_check_is_unix_groups(sid) ||
+sid_check_is_in_unix_users(sid) ||
+sid_check_is_unix_users(sid) )
+   {
+   return find_domain_from_sid(get_global_sam_sid());
+   }
+   
+
/* On a member server a query for SID or name can always go to our
 * primary DC. */
 
@@ -927,6 +938,14 @@
strequal(domain_name, get_global_sam_name()))
return find_domain_from_name_noinit(domain_name);
 
+   /* The Unix User and Unix Group domain our handled by passdb */
+
+   if ( strequal(domain_name, unix_users_domain_name() ) ||
+strequal(domain_name, unix_groups_domain_name() ) )
+   {
+   return find_domain_from_name_noinit( get_global_sam_name() );
+   }
+
return find_our_domain();
 }
 

Modified: branches/SAMBA_3_0_26/source/nsswitch/idmap.c
===
--- branches/SAMBA_3_0_26/source/nsswitch/idmap.c   2007-05-21 19:53:57 UTC 
(rev 23047)
+++ branches/SAMBA_3_0_26/source/nsswitch/idmap.c   2007-05-21 20:36:22 UTC 
(rev 23048)
@@ -821,7 +821,10 @@
/* Check we do not create mappings for our own local domain, or BUILTIN 
or special SIDs */
if ((sid_compare_domain(map-sid, get_global_sam_sid()) == 0) ||
sid_check_is_in_builtin(map-sid) ||
-   sid_check_is_in_wellknown_domain(map-sid)) {
+   sid_check_is_in_wellknown_domain(map-sid) ||
+   sid_check_is_in_unix_users(map-sid) ||
+   sid_check_is_in_unix_groups(map-sid) ) 
+   {
DEBUG(10, (We are not supposed to create mappings for our own 
domains (local, builtin, specials)\n));
return NT_STATUS_UNSUCCESSFUL;
 

svn commit: samba r23049 - in branches/SAMBA_3_0_25/source/passdb: .

2007-05-21 Thread idra
Author: idra
Date: 2007-05-21 20:41:50 + (Mon, 21 May 2007)
New Revision: 23049

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

Log:

Short circuit Unix Users and Unix Groups Domain SID checks.
Do not cache to avoid polluting the uid - Sid cache


Modified:
   branches/SAMBA_3_0_25/source/passdb/lookup_sid.c


Changeset:
Modified: branches/SAMBA_3_0_25/source/passdb/lookup_sid.c
===
--- branches/SAMBA_3_0_25/source/passdb/lookup_sid.c2007-05-21 20:36:22 UTC 
(rev 23048)
+++ branches/SAMBA_3_0_25/source/passdb/lookup_sid.c2007-05-21 20:41:50 UTC 
(rev 23049)
@@ -1380,6 +1380,7 @@
 
 BOOL sid_to_uid(const DOM_SID *psid, uid_t *puid)
 {
+   uint32 rid;
gid_t gid;
 
if (fetch_uid_from_cache(puid, psid))
@@ -1389,6 +1390,18 @@
return False;
}
 
+   /* Optimize for the Unix Users Domain
+* as the conversion is straightforward */
+   if (sid_peek_check_rid(global_sid_Unix_Users, psid, rid)) {
+   uid_t uid = rid;
+   *puid = uid;
+
+   /* return here, don't cache */
+   DEBUG(10,(sid %s - uid %u\n, sid_string_static(psid),
+   (unsigned int)*puid ));
+   return True;
+   }
+
if (!winbind_sid_to_uid(puid, psid)) {
if (!winbind_ping()) {
return legacy_sid_to_uid(psid, puid);
@@ -1416,6 +1429,7 @@
 
 BOOL sid_to_gid(const DOM_SID *psid, gid_t *pgid)
 {
+   uint32 rid;
uid_t uid;
 
if (fetch_gid_from_cache(pgid, psid))
@@ -1424,6 +1438,18 @@
if (fetch_uid_from_cache(uid, psid))
return False;
 
+   /* Optimize for the Unix Groups Domain
+* as the conversion is straightforward */
+   if (sid_peek_check_rid(global_sid_Unix_Groups, psid, rid)) {
+   gid_t gid = rid;
+   *pgid = gid;
+
+   /* return here, don't cache */
+   DEBUG(10,(sid %s - gid %u\n, sid_string_static(psid),
+   (unsigned int)*pgid ));
+   return True;
+   }
+
/* Ask winbindd if it can map this sid to a gid.
 * (Idmap will check it is a valid SID and of the right type) */
 



svn commit: samba r23050 - in branches/SAMBA_3_0_25/source/passdb: .

2007-05-21 Thread idra
Author: idra
Date: 2007-05-21 20:47:22 + (Mon, 21 May 2007)
New Revision: 23050

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

Log:

Do not double check for sid - uid, we already do it in sid_to_uid()
(same for gids)


Modified:
   branches/SAMBA_3_0_25/source/passdb/lookup_sid.c


Changeset:
Modified: branches/SAMBA_3_0_25/source/passdb/lookup_sid.c
===
--- branches/SAMBA_3_0_25/source/passdb/lookup_sid.c2007-05-21 20:41:50 UTC 
(rev 23049)
+++ branches/SAMBA_3_0_25/source/passdb/lookup_sid.c2007-05-21 20:47:22 UTC 
(rev 23050)
@@ -1209,12 +1209,6 @@
enum lsa_SidType type;
uint32 rid;
 
-   if (sid_peek_check_rid(global_sid_Unix_Users, psid, rid)) {
-   uid_t uid = rid;
-   *puid = uid;
-   goto done;
-   }
-
if (sid_peek_check_rid(get_global_sam_sid(), psid, rid)) {
union unid_t id;
BOOL ret;
@@ -1260,12 +1254,6 @@
union unid_t id;
enum lsa_SidType type;
 
-   if (sid_peek_check_rid(global_sid_Unix_Groups, psid, rid)) {
-   gid_t gid = rid;
-   *pgid = gid;
-   goto done;
-   }
-
if ((sid_check_is_in_builtin(psid) ||
 sid_check_is_in_wellknown_domain(psid))) {
BOOL ret;



svn commit: samba r23051 - in branches: SAMBA_3_0/source/passdb SAMBA_3_0_26/source/passdb

2007-05-21 Thread idra
Author: idra
Date: 2007-05-21 20:51:15 + (Mon, 21 May 2007)
New Revision: 23051

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

Log:

sid_to_[ug]id fixes for smbd


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


Changeset:
Modified: branches/SAMBA_3_0/source/passdb/lookup_sid.c
===
--- branches/SAMBA_3_0/source/passdb/lookup_sid.c   2007-05-21 20:47:22 UTC 
(rev 23050)
+++ branches/SAMBA_3_0/source/passdb/lookup_sid.c   2007-05-21 20:51:15 UTC 
(rev 23051)
@@ -1208,12 +1208,6 @@
enum lsa_SidType type;
uint32 rid;
 
-   if (sid_peek_check_rid(global_sid_Unix_Users, psid, rid)) {
-   uid_t uid = rid;
-   *puid = uid;
-   goto done;
-   }
-
if (sid_peek_check_rid(get_global_sam_sid(), psid, rid)) {
union unid_t id;
BOOL ret;
@@ -1259,12 +1253,6 @@
union unid_t id;
enum lsa_SidType type;
 
-   if (sid_peek_check_rid(global_sid_Unix_Groups, psid, rid)) {
-   gid_t gid = rid;
-   *pgid = gid;
-   goto done;
-   }
-
if ((sid_check_is_in_builtin(psid) ||
 sid_check_is_in_wellknown_domain(psid))) {
BOOL ret;
@@ -1379,6 +1367,7 @@
 
 BOOL sid_to_uid(const DOM_SID *psid, uid_t *puid)
 {
+   uint32 rid;
gid_t gid;
 
if (fetch_uid_from_cache(puid, psid))
@@ -1388,6 +1377,18 @@
return False;
}
 
+   /* Optimize for the Unix Users Domain
+* as the conversion is straightforward */
+   if (sid_peek_check_rid(global_sid_Unix_Users, psid, rid)) {
+   uid_t uid = rid;
+   *puid = uid;
+
+   /* return here, don't cache */
+   DEBUG(10,(sid %s - uid %u\n, sid_string_static(psid),
+   (unsigned int)*puid ));
+   return True;
+   }
+
if (!winbind_sid_to_uid(puid, psid)) {
if (!winbind_ping()) {
return legacy_sid_to_uid(psid, puid);
@@ -1415,6 +1416,7 @@
 
 BOOL sid_to_gid(const DOM_SID *psid, gid_t *pgid)
 {
+   uint32 rid;
uid_t uid;
 
if (fetch_gid_from_cache(pgid, psid))
@@ -1423,6 +1425,18 @@
if (fetch_uid_from_cache(uid, psid))
return False;
 
+   /* Optimize for the Unix Groups Domain
+* as the conversion is straightforward */
+   if (sid_peek_check_rid(global_sid_Unix_Groups, psid, rid)) {
+   gid_t gid = rid;
+   *pgid = gid;
+
+   /* return here, don't cache */
+   DEBUG(10,(sid %s - gid %u\n, sid_string_static(psid),
+   (unsigned int)*pgid ));
+   return True;
+   }
+
/* Ask winbindd if it can map this sid to a gid.
 * (Idmap will check it is a valid SID and of the right type) */
 

Modified: branches/SAMBA_3_0_26/source/passdb/lookup_sid.c
===
--- branches/SAMBA_3_0_26/source/passdb/lookup_sid.c2007-05-21 20:47:22 UTC 
(rev 23050)
+++ branches/SAMBA_3_0_26/source/passdb/lookup_sid.c2007-05-21 20:51:15 UTC 
(rev 23051)
@@ -1209,12 +1209,6 @@
enum lsa_SidType type;
uint32 rid;
 
-   if (sid_peek_check_rid(global_sid_Unix_Users, psid, rid)) {
-   uid_t uid = rid;
-   *puid = uid;
-   goto done;
-   }
-
if (sid_peek_check_rid(get_global_sam_sid(), psid, rid)) {
union unid_t id;
BOOL ret;
@@ -1260,12 +1254,6 @@
union unid_t id;
enum lsa_SidType type;
 
-   if (sid_peek_check_rid(global_sid_Unix_Groups, psid, rid)) {
-   gid_t gid = rid;
-   *pgid = gid;
-   goto done;
-   }
-
if ((sid_check_is_in_builtin(psid) ||
 sid_check_is_in_wellknown_domain(psid))) {
BOOL ret;
@@ -1380,6 +1368,7 @@
 
 BOOL sid_to_uid(const DOM_SID *psid, uid_t *puid)
 {
+   uint32 rid;
gid_t gid;
 
if (fetch_uid_from_cache(puid, psid))
@@ -1389,6 +1378,18 @@
return False;
}
 
+   /* Optimize for the Unix Users Domain
+* as the conversion is straightforward */
+   if (sid_peek_check_rid(global_sid_Unix_Users, psid, rid)) {
+   uid_t uid = rid;
+   *puid = uid;
+
+   /* return here, don't cache */
+   DEBUG(10,(sid %s - uid %u\n, sid_string_static(psid),
+   (unsigned int)*puid ));
+   return True;
+   }
+
if (!winbind_sid_to_uid(puid, psid)) {
if (!winbind_ping()) {
return legacy_sid_to_uid(psid, puid);
@@ -1416,6 +1417,7 @@
 
 BOOL sid_to_gid(const DOM_SID *psid, gid_t *pgid)
 {
+   

svn commit: samba r23052 - in branches/SAMBA_3_0_RELEASE: . examples/libsmbclient source source/auth source/client source/include source/lib source/lib/replace source/libsmb source/locking source/modu

2007-05-21 Thread jerry
Author: jerry
Date: 2007-05-21 21:17:21 + (Mon, 21 May 2007)
New Revision: 23052

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

Log:
sync with SAMBA_3_0_25 and start updating release notes
Added:
   branches/SAMBA_3_0_RELEASE/examples/libsmbclient/testacl2.c
Modified:
   branches/SAMBA_3_0_RELEASE/WHATSNEW.txt
   branches/SAMBA_3_0_RELEASE/examples/libsmbclient/Makefile
   branches/SAMBA_3_0_RELEASE/source/Makefile.in
   branches/SAMBA_3_0_RELEASE/source/VERSION
   branches/SAMBA_3_0_RELEASE/source/auth/auth_server.c
   branches/SAMBA_3_0_RELEASE/source/client/mount.cifs.c
   branches/SAMBA_3_0_RELEASE/source/configure.in
   branches/SAMBA_3_0_RELEASE/source/include/ads.h
   branches/SAMBA_3_0_RELEASE/source/include/ads_cldap.h
   branches/SAMBA_3_0_RELEASE/source/lib/replace/dlfcn.m4
   branches/SAMBA_3_0_RELEASE/source/lib/time.c
   branches/SAMBA_3_0_RELEASE/source/libsmb/libsmbclient.c
   branches/SAMBA_3_0_RELEASE/source/locking/brlock.c
   branches/SAMBA_3_0_RELEASE/source/locking/locking.c
   branches/SAMBA_3_0_RELEASE/source/modules/vfs_hpuxacl.c
   branches/SAMBA_3_0_RELEASE/source/modules/vfs_posixacl.c
   branches/SAMBA_3_0_RELEASE/source/modules/vfs_tru64acl.c
   branches/SAMBA_3_0_RELEASE/source/nsswitch/winbindd_group.c
   branches/SAMBA_3_0_RELEASE/source/nsswitch/winbindd_pam.c
   branches/SAMBA_3_0_RELEASE/source/nsswitch/winbindd_user.c
   branches/SAMBA_3_0_RELEASE/source/passdb/lookup_sid.c
   branches/SAMBA_3_0_RELEASE/source/passdb/passdb.c
   branches/SAMBA_3_0_RELEASE/source/python/setup.py
   branches/SAMBA_3_0_RELEASE/source/rpc_parse/parse_srv.c
   branches/SAMBA_3_0_RELEASE/source/rpc_server/srv_lsa_ds_nt.c
   branches/SAMBA_3_0_RELEASE/source/script/tests/gdb_backtrace
   branches/SAMBA_3_0_RELEASE/source/smbd/blocking.c
   branches/SAMBA_3_0_RELEASE/source/smbd/close.c
   branches/SAMBA_3_0_RELEASE/source/smbd/reply.c
   branches/SAMBA_3_0_RELEASE/source/smbd/trans2.c
   branches/SAMBA_3_0_RELEASE/source/smbd/uid.c
   branches/SAMBA_3_0_RELEASE/source/utils/net_rap.c
   branches/SAMBA_3_0_RELEASE/source/utils/net_rpc.c
   branches/SAMBA_3_0_RELEASE/source/utils/pdbedit.c


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


svn commit: samba r23054 - in branches: SAMBA_3_0/source/nsswitch SAMBA_3_0_26/source/nsswitch

2007-05-21 Thread jerry
Author: jerry
Date: 2007-05-21 21:33:51 + (Mon, 21 May 2007)
New Revision: 23054

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

Log:
Move the check for the lookup_domain of S-1-22-{1,2} before the 
check for IS_DC.  Otherwise we will for example fail to lookup a
sid of S-1-22-1-780 because it has no valid struct winbindd_domain*
in the list.   Thanks to Simo for the catch.



Modified:
   branches/SAMBA_3_0/source/nsswitch/winbindd_util.c
   branches/SAMBA_3_0_26/source/nsswitch/winbindd_util.c


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_util.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd_util.c  2007-05-21 21:18:23 UTC 
(rev 23053)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_util.c  2007-05-21 21:33:51 UTC 
(rev 23054)
@@ -902,6 +902,16 @@
 
 struct winbindd_domain *find_lookup_domain_from_sid(const DOM_SID *sid)
 {
+   /* SIDs in the S-1-22-{1,2} domain should be handled by our passdb */
+
+   if ( sid_check_is_in_unix_groups(sid) || 
+sid_check_is_unix_groups(sid) ||
+sid_check_is_in_unix_users(sid) ||
+sid_check_is_unix_users(sid) )
+   {
+   return find_domain_from_sid(get_global_sam_sid());
+   }
+
/* A DC can't ask the local smbd for remote SIDs, here winbindd is the
 * one to contact the external DC's. On member servers the internal
 * domains are different: These are part of the local SAM. */
@@ -912,19 +922,8 @@
if (IS_DC || is_internal_domain(sid) || is_in_internal_domain(sid)) {
DEBUG(10, (calling find_domain_from_sid\n));
return find_domain_from_sid(sid);
-   }
+   }   
 
-   /* SIDs in the S-1-22-{1,2} domain should be handled by our passdb */
-
-   if ( sid_check_is_in_unix_groups(sid) || 
-sid_check_is_unix_groups(sid) ||
-sid_check_is_in_unix_users(sid) ||
-sid_check_is_unix_users(sid) )
-   {
-   return find_domain_from_sid(get_global_sam_sid());
-   }
-   
-
/* On a member server a query for SID or name can always go to our
 * primary DC. */
 
@@ -934,18 +933,18 @@
 
 struct winbindd_domain *find_lookup_domain_from_name(const char *domain_name)
 {
-   if (IS_DC || strequal(domain_name, BUILTIN) ||
-   strequal(domain_name, get_global_sam_name()))
-   return find_domain_from_name_noinit(domain_name);
-
-   /* The Unix User and Unix Group domain our handled by passdb */
-
if ( strequal(domain_name, unix_users_domain_name() ) ||
 strequal(domain_name, unix_groups_domain_name() ) )
{
return find_domain_from_name_noinit( get_global_sam_name() );
}
 
+   if (IS_DC || strequal(domain_name, BUILTIN) ||
+   strequal(domain_name, get_global_sam_name()))
+   return find_domain_from_name_noinit(domain_name);
+
+   /* The Unix User and Unix Group domain our handled by passdb */
+
return find_our_domain();
 }
 

Modified: branches/SAMBA_3_0_26/source/nsswitch/winbindd_util.c
===
--- branches/SAMBA_3_0_26/source/nsswitch/winbindd_util.c   2007-05-21 
21:18:23 UTC (rev 23053)
+++ branches/SAMBA_3_0_26/source/nsswitch/winbindd_util.c   2007-05-21 
21:33:51 UTC (rev 23054)
@@ -911,6 +911,16 @@
 
 struct winbindd_domain *find_lookup_domain_from_sid(const DOM_SID *sid)
 {
+   /* SIDs in the S-1-22-{1,2} domain should be handled by our passdb */
+
+   if ( sid_check_is_in_unix_groups(sid) || 
+sid_check_is_unix_groups(sid) ||
+sid_check_is_in_unix_users(sid) ||
+sid_check_is_unix_users(sid) )
+   {
+   return find_domain_from_sid(get_global_sam_sid());
+   }
+
/* A DC can't ask the local smbd for remote SIDs, here winbindd is the
 * one to contact the external DC's. On member servers the internal
 * domains are different: These are part of the local SAM. */
@@ -921,19 +931,8 @@
if (IS_DC || is_internal_domain(sid) || is_in_internal_domain(sid)) {
DEBUG(10, (calling find_domain_from_sid\n));
return find_domain_from_sid(sid);
-   }
+   }   
 
-   /* SIDs in the S-1-22-{1,2} domain should be handled by our passdb */
-
-   if ( sid_check_is_in_unix_groups(sid) || 
-sid_check_is_unix_groups(sid) ||
-sid_check_is_in_unix_users(sid) ||
-sid_check_is_unix_users(sid) )
-   {
-   return find_domain_from_sid(get_global_sam_sid());
-   }
-   
-
/* On a member server a query for SID or name can always go to our
 * primary DC. */
 
@@ -943,18 +942,18 @@
 
 struct winbindd_domain *find_lookup_domain_from_name(const char *domain_name)
 {
-   if (IS_DC || 

svn commit: samba r23055 - in branches: SAMBA_3_0/source SAMBA_3_0/source/include SAMBA_3_0/source/lib SAMBA_3_0/source/librpc/gen_ndr SAMBA_3_0/source/librpc/idl SAMBA_3_0/source/nmbd SAMBA_3_0/sourc

2007-05-21 Thread vlendec
Author: vlendec
Date: 2007-05-21 22:17:13 + (Mon, 21 May 2007)
New Revision: 23055

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

Log:
Rewrite messages.c to use auto-generated marshalling in the tdb. I'm
doing this because for the clustering the marshalling is needed in more
than one place, so I wanted a decent routine to marshall a message_rec
struct which was not there before.

Tridge, this seems about the same speed as it used to be before, the
librpc/ndr overhead in my tests was under the noise.

Volker


Added:
   branches/SAMBA_3_0/source/librpc/gen_ndr/messaging.h
   branches/SAMBA_3_0/source/librpc/gen_ndr/ndr_messaging.c
   branches/SAMBA_3_0/source/librpc/gen_ndr/ndr_messaging.h
   branches/SAMBA_3_0/source/librpc/idl/messaging.idl
   branches/SAMBA_3_0_26/source/librpc/gen_ndr/messaging.h
   branches/SAMBA_3_0_26/source/librpc/gen_ndr/ndr_messaging.c
   branches/SAMBA_3_0_26/source/librpc/gen_ndr/ndr_messaging.h
   branches/SAMBA_3_0_26/source/librpc/idl/messaging.idl
Modified:
   branches/SAMBA_3_0/source/Makefile.in
   branches/SAMBA_3_0/source/include/includes.h
   branches/SAMBA_3_0/source/include/messages.h
   branches/SAMBA_3_0/source/include/smb.h
   branches/SAMBA_3_0/source/lib/messages.c
   branches/SAMBA_3_0/source/lib/util.c
   branches/SAMBA_3_0/source/nmbd/nmbd.c
   branches/SAMBA_3_0/source/nmbd/nmbd_processlogon.c
   branches/SAMBA_3_0/source/nsswitch/winbindd.c
   branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c
   branches/SAMBA_3_0/source/printing/notify.c
   branches/SAMBA_3_0/source/printing/printing.c
   branches/SAMBA_3_0/source/rpc_server/srv_netlog_nt.c
   branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
   branches/SAMBA_3_0/source/rpc_server/srv_srvsvc_nt.c
   branches/SAMBA_3_0/source/smbd/lanman.c
   branches/SAMBA_3_0/source/smbd/process.c
   branches/SAMBA_3_0/source/smbd/server.c
   branches/SAMBA_3_0/source/smbd/statcache.c
   branches/SAMBA_3_0/source/torture/msgtest.c
   branches/SAMBA_3_0/source/utils/smbcontrol.c
   branches/SAMBA_3_0_26/source/Makefile.in
   branches/SAMBA_3_0_26/source/include/includes.h
   branches/SAMBA_3_0_26/source/include/messages.h
   branches/SAMBA_3_0_26/source/include/smb.h
   branches/SAMBA_3_0_26/source/lib/messages.c
   branches/SAMBA_3_0_26/source/lib/util.c
   branches/SAMBA_3_0_26/source/nmbd/nmbd.c
   branches/SAMBA_3_0_26/source/nmbd/nmbd_processlogon.c
   branches/SAMBA_3_0_26/source/nsswitch/winbindd.c
   branches/SAMBA_3_0_26/source/nsswitch/winbindd_dual.c
   branches/SAMBA_3_0_26/source/printing/notify.c
   branches/SAMBA_3_0_26/source/printing/printing.c
   branches/SAMBA_3_0_26/source/rpc_server/srv_netlog_nt.c
   branches/SAMBA_3_0_26/source/rpc_server/srv_spoolss_nt.c
   branches/SAMBA_3_0_26/source/rpc_server/srv_srvsvc_nt.c
   branches/SAMBA_3_0_26/source/smbd/lanman.c
   branches/SAMBA_3_0_26/source/smbd/process.c
   branches/SAMBA_3_0_26/source/smbd/server.c
   branches/SAMBA_3_0_26/source/smbd/statcache.c
   branches/SAMBA_3_0_26/source/torture/msgtest.c
   branches/SAMBA_3_0_26/source/utils/smbcontrol.c


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


Re: svn commit: samba r23047 - in branches/SAMBA_4_0/source/scripting/ejs: .

2007-05-21 Thread tridge
Mimir,

  +/* First, try to include file from current working directory.
  +   This allows local includes which is handy sometimes. */

yes, it's very handy if you are a malicious hacker!

Imagine the admin has a ftp upload area, and cd's to that
directory. He wants to see if anyone is connected to that area with
smbstatus. The attacker uploads util.js and hey presto the attacker
has just got the admin to run his code inside smbstatus, as root.

Same applies to someones home directory.

There is a very good reason why . is not in $PATH on unix by
default :-)

Please revert this one. It's a major security hole.

Cheers, Tridge


svn commit: samba r23056 - in branches/SAMBA_4_0/source/torture/raw: .

2007-05-21 Thread tridge
Author: tridge
Date: 2007-05-21 23:33:26 + (Mon, 21 May 2007)
New Revision: 23056

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

Log:

added automatic reconnect to RAW-BENCH-OPEN, similar to RAW-BENCH-LOCK

Modified:
   branches/SAMBA_4_0/source/torture/raw/openbench.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/raw/openbench.c
===
--- branches/SAMBA_4_0/source/torture/raw/openbench.c   2007-05-21 22:17:13 UTC 
(rev 23055)
+++ branches/SAMBA_4_0/source/torture/raw/openbench.c   2007-05-21 23:33:26 UTC 
(rev 23056)
@@ -29,6 +29,8 @@
 #include torture/util.h
 #include lib/events/events.h
 #include lib/cmdline/popt_common.h
+#include libcli/composite/composite.h
+#include libcli/smb_composite/smb_composite.h
 
 #define BASEDIR \\benchopen
 
@@ -36,19 +38,108 @@
 static int open_failed;
 static int open_retries;
 static char **fnames;
+static int num_connected;
 
 struct benchopen_state {
+   TALLOC_CTX *mem_ctx;
+   struct event_context *ev;
struct smbcli_state *cli;
+   struct smbcli_tree *tree;
+   int client_num;
int fnum;
int file_num;
int count;
+   int lastcount;
BOOL waiting_open, waiting_close;
union smb_open open_parms;
union smb_close close_parms;
struct smbcli_request *req_open;
struct smbcli_request *req_close;
+   struct smb_composite_connect reconnect;
+
+   /* these are used for reconnections */
+   int dest_port;
+   const char *dest_host;
+   const char *called_name;
+   const char *service_type;
 };
 
+static void next_open(struct benchopen_state *state);
+static void reopen_connection(struct event_context *ev, struct timed_event 
*te, 
+ struct timeval t, void *private_data);
+
+
+/*
+  complete an async reconnect
+ */
+static void reopen_connection_complete(struct composite_context *ctx)
+{
+   struct benchopen_state *state = (struct benchopen_state 
*)ctx-async.private_data;
+   NTSTATUS status;
+   struct smb_composite_connect *io = state-reconnect;
+
+   status = smb_composite_connect_recv(ctx, state-mem_ctx);
+   if (!NT_STATUS_IS_OK(status)) {
+   event_add_timed(state-ev, state-mem_ctx, 
+   timeval_current_ofs(1,0), 
+   reopen_connection, state);
+   return;
+   }
+
+   state-tree = io-out.tree;
+
+   num_connected++;
+
+   DEBUG(0,(reconnect to %s finished (%u connected)\n, state-dest_host,
+num_connected));
+
+   next_open(state);
+}
+
+   
+
+/*
+  reopen a connection
+ */
+static void reopen_connection(struct event_context *ev, struct timed_event 
*te, 
+ struct timeval t, void *private_data)
+{
+   struct benchopen_state *state = (struct benchopen_state *)private_data;
+   struct composite_context *ctx;
+   struct smb_composite_connect *io = state-reconnect;
+   char *host, *share;
+
+   if (!torture_get_conn_index(state-client_num, state-mem_ctx, host, 
share)) {
+   DEBUG(0,(Can't find host/share for reconnect?!\n));
+   exit(1);
+   }
+
+   io-in.dest_host= state-dest_host;
+   io-in.port = state-dest_port;
+   io-in.called_name  = state-called_name;
+   io-in.service  = share;
+   io-in.service_type = state-service_type;
+   io-in.credentials  = cmdline_credentials;
+   io-in.fallback_to_anonymous = False;
+   io-in.workgroup= lp_workgroup();
+
+   /* kill off the remnants of the old connection */
+   talloc_free(state-tree);
+   state-tree = NULL;
+   state-fnum = -1;
+   state-waiting_open = False;
+   state-waiting_close = False;
+
+   ctx = smb_composite_connect_send(io, state-mem_ctx, state-ev);
+   if (ctx == NULL) {
+   DEBUG(0,(Failed to setup async reconnect\n));
+   exit(1);
+   }
+
+   ctx-async.fn = reopen_connection_complete;
+   ctx-async.private_data = state;
+}
+
 static void open_completed(struct smbcli_request *req);
 static void close_completed(struct smbcli_request *req);
 
@@ -71,7 +162,7 @@
state-open_parms.ntcreatex.in.security_flags = 0;
state-open_parms.ntcreatex.in.fname = fnames[state-file_num];
 
-   state-req_open = smb_raw_open_send(state-cli-tree, 
state-open_parms);
+   state-req_open = smb_raw_open_send(state-tree, state-open_parms);
state-req_open-async.fn = open_completed;
state-req_open-async.private = state;
state-waiting_open = True;
@@ -84,7 +175,7 @@
state-close_parms.close.in.file.fnum = state-fnum;
state-close_parms.close.in.write_time = 0;
 
-   state-req_close = smb_raw_close_send(state-cli-tree, 
state-close_parms);
+   state-req_close = smb_raw_close_send(state-tree, 

svn commit: samba r23057 - in branches/SAMBA_4_0/source/libcli/raw: .

2007-05-21 Thread tridge
Author: tridge
Date: 2007-05-21 23:35:14 + (Mon, 21 May 2007)
New Revision: 23057

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

Log:

only call the async recv function for the first pending receive, not
all pending receives, when the transport dies. This is because the
async callback most commonly shuts down the connection (it's the only
reasonable thing to do when it's dead), and that frees the whole
context. That means that if we loop more than once, we'll end up using
freed memory.

Modified:
   branches/SAMBA_4_0/source/libcli/raw/clitransport.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/raw/clitransport.c
===
--- branches/SAMBA_4_0/source/libcli/raw/clitransport.c 2007-05-21 23:33:26 UTC 
(rev 23056)
+++ branches/SAMBA_4_0/source/libcli/raw/clitransport.c 2007-05-21 23:35:14 UTC 
(rev 23057)
@@ -138,8 +138,11 @@
status = NT_STATUS_UNEXPECTED_NETWORK_ERROR;
}
 
-   /* kill all pending receives */
-   while (transport-pending_recv) {
+   /* kill only the first pending receive - this is so that if
+that async function frees the connection we don't die trying
+to use old memory. The caller has to cope with only one
+network error */
+   if (transport-pending_recv) {
struct smbcli_request *req = transport-pending_recv;
req-state = SMBCLI_REQUEST_ERROR;
req-status = status;



Build status as of Tue May 22 00:00:01 2007

2007-05-21 Thread build
URL: http://build.samba.org/

--- /home/build/master/cache/broken_results.txt.old 2007-05-21 
00:01:01.0 +
+++ /home/build/master/cache/broken_results.txt 2007-05-22 00:01:32.0 
+
@@ -1,10 +1,10 @@
-Build status as of Mon May 21 00:00:02 2007
+Build status as of Tue May 22 00:00:01 2007
 
 Build counts:
 Tree Total  Broken Panic 
 SOC  0  0  0 
 build_farm   0  0  0 
-ccache   36 6  0 
+ccache   37 6  0 
 ctdb 0  0  0 
 distcc   3  0  0 
 ldb  36 7  0 
@@ -13,13 +13,13 @@
 pidl 19 4  0 
 ppp  15 0  0 
 python   0  0  0 
-rsync37 22 0 
+rsync37 17 0 
 samba0  0  0 
 samba-docs   0  0  0 
 samba-gtk3  3  0 
-samba4   32 20 5 
-samba_3_037 16 0 
-smb-build33 32 0 
-talloc   36 2  0 
+samba4   34 29 23
+samba_3_037 20 0 
+smb-build33 33 0 
+talloc   37 2  0 
 tdb  36 3  0 
 


svn commit: samba r23058 - in branches/SAMBA_4_0/source/libcli/cldap: .

2007-05-21 Thread tridge
Author: tridge
Date: 2007-05-22 00:43:10 + (Tue, 22 May 2007)
New Revision: 23058

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

Log:

the cldap code was getting too intimate with the internals of struct
asn1_context. A hangover from when it wasn't a allocated structure

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


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/cldap/cldap.c
===
--- branches/SAMBA_4_0/source/libcli/cldap/cldap.c  2007-05-21 23:35:14 UTC 
(rev 23057)
+++ branches/SAMBA_4_0/source/libcli/cldap/cldap.c  2007-05-22 00:43:10 UTC 
(rev 23058)
@@ -100,7 +100,6 @@
talloc_free(tmp_ctx);
return;
}
-   talloc_steal(tmp_ctx, asn1-data);
 
ldap_msg = talloc(tmp_ctx, struct ldap_message);
if (ldap_msg == NULL) {
@@ -129,8 +128,7 @@
return;
}
 
-   req-asn1 = asn1;
-   talloc_steal(req, asn1-data);
+   req-asn1 = talloc_steal(req, asn1);
req-asn1-ofs = 0;
 
req-state = CLDAP_REQUEST_DONE;
@@ -312,6 +310,10 @@
req-timeout = io-in.timeout;
req-num_retries = io-in.retries;
req-is_reply= False;
+   req-asn1= asn1_init(req);
+   if (!req-asn1) {
+   goto failed;
+   }
 
req-dest = socket_address_from_strings(req, cldap-sock-backend_name,
io-in.dest_address, 
lp_cldap_port());
@@ -376,6 +378,10 @@
req-cldap   = cldap;
req-state   = CLDAP_REQUEST_SEND;
req-is_reply= True;
+   req-asn1= asn1_init(req);
+   if (!req-asn1) {
+   goto failed;
+   }
 
req-dest= io-dest;
if (talloc_reference(req, io-dest) == NULL) goto failed;



svn commit: samba r23059 - in branches/SAMBA_4_0/source/lib/messaging: .

2007-05-21 Thread tridge
Author: tridge
Date: 2007-05-22 01:02:00 + (Tue, 22 May 2007)
New Revision: 23059

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

Log:

reject_free needs to be initialised

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


Changeset:
Modified: branches/SAMBA_4_0/source/lib/messaging/messaging.c
===
--- branches/SAMBA_4_0/source/lib/messaging/messaging.c 2007-05-22 00:43:10 UTC 
(rev 23058)
+++ branches/SAMBA_4_0/source/lib/messaging/messaging.c 2007-05-22 01:02:00 UTC 
(rev 23059)
@@ -825,6 +825,7 @@
irpc-done = False;
irpc-async.fn = NULL;
irpc-mem_ctx  = ctx;
+   irpc-reject_free = False;
 
talloc_set_destructor(irpc, irpc_destructor);
 



Rev 329: global lock should imply the transaction lock in http://samba.org/~tridge/ctdb

2007-05-21 Thread tridge

revno: 329
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Andrew Tridgell [EMAIL PROTECTED]
branch nick: tridge
timestamp: Tue 2007-05-22 13:14:51 +1000
message:
  global lock should imply the transaction lock
modified:
  lib/tdb/common/lock.c  lock.c-20070220022425-m1wibgjq7n5hahs6-7
  lib/tdb/common/tdb_private.h   
tdb_private.h-20070220022425-m1wibgjq7n5hahs6-10
  lib/tdb/common/transaction.c   
transaction.c-20070220022425-m1wibgjq7n5hahs6-11
  lib/tdb/common/traverse.c  traverse.c-20070220022425-m1wibgjq7n5hahs6-12
=== modified file 'lib/tdb/common/lock.c'
--- a/lib/tdb/common/lock.c 2007-05-12 04:33:10 +
+++ b/lib/tdb/common/lock.c 2007-05-22 03:14:51 +
@@ -285,6 +285,41 @@
return ret;
 }
 
+/*
+  get the transaction lock
+ */
+int tdb_transaction_lock(struct tdb_context *tdb, int ltype)
+{
+   if (tdb-have_transaction_lock || tdb-global_lock.count) {
+   return 0;
+   }
+   if (tdb-methods-tdb_brlock(tdb, TRANSACTION_LOCK, ltype, 
+F_SETLKW, 0, 1) == -1) {
+   TDB_LOG((tdb, TDB_DEBUG_ERROR, tdb_transaction_lock: failed to 
get transaction lock\n));
+   tdb-ecode = TDB_ERR_LOCK;
+   return -1;
+   }
+   tdb-have_transaction_lock = 1;
+   return 0;
+}
+
+/*
+  release the transaction lock
+ */
+int tdb_transaction_unlock(struct tdb_context *tdb)
+{
+   int ret;
+   if (!tdb-have_transaction_lock) {
+   return 0;
+   }
+   ret = tdb-methods-tdb_brlock(tdb, TRANSACTION_LOCK, F_UNLCK, 
F_SETLKW, 0, 1);
+   if (ret == 0) {
+   tdb-have_transaction_lock = 0;
+   }
+   return ret;
+}
+
+
 
 
 /* lock/unlock entire database */

=== modified file 'lib/tdb/common/tdb_private.h'
--- a/lib/tdb/common/tdb_private.h  2007-04-21 08:09:37 +
+++ b/lib/tdb/common/tdb_private.h  2007-05-22 03:14:51 +
@@ -170,6 +170,7 @@
struct tdb_transaction *transaction;
int page_size;
int max_dead_records;
+   bool have_transaction_lock;
 };
 
 
@@ -181,6 +182,8 @@
 int tdb_lock(struct tdb_context *tdb, int list, int ltype);
 int tdb_unlock(struct tdb_context *tdb, int list, int ltype);
 int tdb_brlock(struct tdb_context *tdb, tdb_off_t offset, int rw_type, int 
lck_type, int probe, size_t len);
+int tdb_transaction_lock(struct tdb_context *tdb, int ltype);
+int tdb_transaction_unlock(struct tdb_context *tdb);
 int tdb_brlock_upgrade(struct tdb_context *tdb, tdb_off_t offset, size_t len);
 int tdb_write_lock_record(struct tdb_context *tdb, tdb_off_t off);
 int tdb_write_unlock_record(struct tdb_context *tdb, tdb_off_t off);

=== modified file 'lib/tdb/common/transaction.c'
--- a/lib/tdb/common/transaction.c  2007-04-16 12:52:58 +
+++ b/lib/tdb/common/transaction.c  2007-05-22 03:14:51 +
@@ -423,9 +423,7 @@
/* get the transaction write lock. This is a blocking lock. As
   discussed with Volker, there are a number of ways we could
   make this async, which we will probably do in the future */
-   if (tdb_brlock(tdb, TRANSACTION_LOCK, F_WRLCK, F_SETLKW, 0, 1) == -1) {
-   TDB_LOG((tdb, TDB_DEBUG_ERROR, tdb_transaction_start: failed 
to get transaction lock\n));
-   tdb-ecode = TDB_ERR_LOCK;
+   if (tdb_transaction_lock(tdb, F_WRLCK) == -1) {
SAFE_FREE(tdb-transaction);
return -1;
}
@@ -469,6 +467,7 @@
  TDB_HASHTABLE_SIZE(tdb)) != 0) {
TDB_LOG((tdb, TDB_DEBUG_FATAL, tdb_transaction_start: failed 
to prime hash table\n));
tdb-ecode = TDB_ERR_IO;
+   tdb-methods = tdb-transaction-io_methods;
goto fail;
}
 
@@ -476,7 +475,7 @@

 fail:
tdb_brlock(tdb, FREELIST_TOP, F_UNLCK, F_SETLKW, 0, 0);
-   tdb_brlock(tdb, TRANSACTION_LOCK, F_UNLCK, F_SETLKW, 0, 1);
+   tdb_transaction_unlock(tdb);
SAFE_FREE(tdb-transaction-hash_heads);
SAFE_FREE(tdb-transaction);
return -1;
@@ -531,7 +530,7 @@
tdb-methods = tdb-transaction-io_methods;
 
tdb_brlock(tdb, FREELIST_TOP, F_UNLCK, F_SETLKW, 0, 0);
-   tdb_brlock(tdb, TRANSACTION_LOCK, F_UNLCK, F_SETLKW, 0, 1);
+   tdb_transaction_unlock(tdb);
SAFE_FREE(tdb-transaction-hash_heads);
SAFE_FREE(tdb-transaction);


=== modified file 'lib/tdb/common/traverse.c'
--- a/lib/tdb/common/traverse.c 2007-02-20 02:24:45 +
+++ b/lib/tdb/common/traverse.c 2007-05-22 03:14:51 +
@@ -205,12 +205,10 @@
 {
struct tdb_traverse_lock tl = { NULL, 0, 0, F_RDLCK };
int ret;
-   
+
/* we need to get a read lock on the transaction lock here to
   cope with the lock ordering semantics of solaris10 */
-   if (tdb-methods-tdb_brlock(tdb, TRANSACTION_LOCK, F_RDLCK, F_SETLKW, 

svn commit: samba r23060 - in branches/SAMBA_4_0/source/heimdal/lib/roken: .

2007-05-21 Thread tridge
Author: tridge
Date: 2007-05-22 04:13:17 + (Tue, 22 May 2007)
New Revision: 23060

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

Log:

use #include roken.h consistently. Using roken.h in this directory
breaks Samba builds on some systems as they find the wrong roken.h

Modified:
   branches/SAMBA_4_0/source/heimdal/lib/roken/bswap.c
   branches/SAMBA_4_0/source/heimdal/lib/roken/copyhostent.c
   branches/SAMBA_4_0/source/heimdal/lib/roken/freeaddrinfo.c
   branches/SAMBA_4_0/source/heimdal/lib/roken/freehostent.c
   branches/SAMBA_4_0/source/heimdal/lib/roken/gai_strerror.c
   branches/SAMBA_4_0/source/heimdal/lib/roken/getaddrinfo.c
   branches/SAMBA_4_0/source/heimdal/lib/roken/getipnodebyaddr.c
   branches/SAMBA_4_0/source/heimdal/lib/roken/getipnodebyname.c
   branches/SAMBA_4_0/source/heimdal/lib/roken/getprogname.c
   branches/SAMBA_4_0/source/heimdal/lib/roken/hex.c
   branches/SAMBA_4_0/source/heimdal/lib/roken/hostent_find_fqdn.c
   branches/SAMBA_4_0/source/heimdal/lib/roken/inet_aton.c
   branches/SAMBA_4_0/source/heimdal/lib/roken/issuid.c
   branches/SAMBA_4_0/source/heimdal/lib/roken/resolve.c
   branches/SAMBA_4_0/source/heimdal/lib/roken/setprogname.c
   branches/SAMBA_4_0/source/heimdal/lib/roken/signal.c
   branches/SAMBA_4_0/source/heimdal/lib/roken/strsep.c
   branches/SAMBA_4_0/source/heimdal/lib/roken/strsep_copy.c


Changeset:
Modified: branches/SAMBA_4_0/source/heimdal/lib/roken/bswap.c
===
--- branches/SAMBA_4_0/source/heimdal/lib/roken/bswap.c 2007-05-22 01:02:00 UTC 
(rev 23059)
+++ branches/SAMBA_4_0/source/heimdal/lib/roken/bswap.c 2007-05-22 04:13:17 UTC 
(rev 23060)
@@ -34,7 +34,7 @@
 #ifdef HAVE_CONFIG_H
 #include config.h
 #endif
-#include roken.h
+#include roken.h
 
 RCSID($Id: bswap.c,v 1.4 2005/04/12 11:28:35 lha Exp $);
 

Modified: branches/SAMBA_4_0/source/heimdal/lib/roken/copyhostent.c
===
--- branches/SAMBA_4_0/source/heimdal/lib/roken/copyhostent.c   2007-05-22 
01:02:00 UTC (rev 23059)
+++ branches/SAMBA_4_0/source/heimdal/lib/roken/copyhostent.c   2007-05-22 
04:13:17 UTC (rev 23060)
@@ -36,7 +36,7 @@
 RCSID($Id: copyhostent.c,v 1.3 2005/04/12 11:28:36 lha Exp $);
 #endif
 
-#include roken.h
+#include roken.h
 
 /*
  * return a malloced copy of `h'

Modified: branches/SAMBA_4_0/source/heimdal/lib/roken/freeaddrinfo.c
===
--- branches/SAMBA_4_0/source/heimdal/lib/roken/freeaddrinfo.c  2007-05-22 
01:02:00 UTC (rev 23059)
+++ branches/SAMBA_4_0/source/heimdal/lib/roken/freeaddrinfo.c  2007-05-22 
04:13:17 UTC (rev 23060)
@@ -36,7 +36,7 @@
 RCSID($Id: freeaddrinfo.c,v 1.5 2005/04/12 11:28:41 lha Exp $);
 #endif
 
-#include roken.h
+#include roken.h
 
 /*
  * free the list of `struct addrinfo' starting at `ai'

Modified: branches/SAMBA_4_0/source/heimdal/lib/roken/freehostent.c
===
--- branches/SAMBA_4_0/source/heimdal/lib/roken/freehostent.c   2007-05-22 
01:02:00 UTC (rev 23059)
+++ branches/SAMBA_4_0/source/heimdal/lib/roken/freehostent.c   2007-05-22 
04:13:17 UTC (rev 23060)
@@ -36,7 +36,7 @@
 RCSID($Id: freehostent.c,v 1.3 2005/04/12 11:28:41 lha Exp $);
 #endif
 
-#include roken.h
+#include roken.h
 
 /*
  * free a malloced hostent

Modified: branches/SAMBA_4_0/source/heimdal/lib/roken/gai_strerror.c
===
--- branches/SAMBA_4_0/source/heimdal/lib/roken/gai_strerror.c  2007-05-22 
01:02:00 UTC (rev 23059)
+++ branches/SAMBA_4_0/source/heimdal/lib/roken/gai_strerror.c  2007-05-22 
04:13:17 UTC (rev 23060)
@@ -36,7 +36,7 @@
 RCSID($Id: gai_strerror.c,v 1.7 2005/08/05 09:31:35 lha Exp $);
 #endif
 
-#include roken.h
+#include roken.h
 
 static struct gai_error {
 int code;

Modified: branches/SAMBA_4_0/source/heimdal/lib/roken/getaddrinfo.c
===
--- branches/SAMBA_4_0/source/heimdal/lib/roken/getaddrinfo.c   2007-05-22 
01:02:00 UTC (rev 23059)
+++ branches/SAMBA_4_0/source/heimdal/lib/roken/getaddrinfo.c   2007-05-22 
04:13:17 UTC (rev 23060)
@@ -36,7 +36,7 @@
 RCSID($Id: getaddrinfo.c,v 1.14 2005/06/16 17:49:29 lha Exp $);
 #endif
 
-#include roken.h
+#include roken.h
 
 /*
  * uses hints-ai_socktype and hints-ai_protocol

Modified: branches/SAMBA_4_0/source/heimdal/lib/roken/getipnodebyaddr.c
===
--- branches/SAMBA_4_0/source/heimdal/lib/roken/getipnodebyaddr.c   
2007-05-22 01:02:00 UTC (rev 23059)
+++ branches/SAMBA_4_0/source/heimdal/lib/roken/getipnodebyaddr.c   
2007-05-22 04:13:17 UTC (rev 23060)
@@ -36,7 +36,7 @@
 RCSID($Id: getipnodebyaddr.c,v 1.3 2005/04/12 11:28:47 lha Exp $);
 #endif
 
-#include roken.h
+#include roken.h
 
 /*
  * lookup `src, len' (address 

svn commit: lorikeet r716 - in trunk/heimdal: . lib/roken

2007-05-21 Thread tridge
Author: tridge
Date: 2007-05-22 04:16:54 + (Tue, 22 May 2007)
New Revision: 716

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

Log:
merge roken.h updates from samba4
Modified:
   trunk/heimdal/heimdal-lorikeet.diff
   trunk/heimdal/lib/roken/bswap.c
   trunk/heimdal/lib/roken/copyhostent.c
   trunk/heimdal/lib/roken/freeaddrinfo.c
   trunk/heimdal/lib/roken/freehostent.c
   trunk/heimdal/lib/roken/gai_strerror.c
   trunk/heimdal/lib/roken/getaddrinfo.c
   trunk/heimdal/lib/roken/getipnodebyaddr.c
   trunk/heimdal/lib/roken/getipnodebyname.c
   trunk/heimdal/lib/roken/getprogname.c
   trunk/heimdal/lib/roken/hex.c
   trunk/heimdal/lib/roken/hostent_find_fqdn.c
   trunk/heimdal/lib/roken/inet_aton.c
   trunk/heimdal/lib/roken/issuid.c
   trunk/heimdal/lib/roken/setprogname.c
   trunk/heimdal/lib/roken/signal.c
   trunk/heimdal/lib/roken/strsep.c
   trunk/heimdal/lib/roken/strsep_copy.c


Changeset:
Modified: trunk/heimdal/heimdal-lorikeet.diff
===
--- trunk/heimdal/heimdal-lorikeet.diff 2007-04-05 05:45:07 UTC (rev 715)
+++ trunk/heimdal/heimdal-lorikeet.diff 2007-05-22 04:16:54 UTC (rev 716)
@@ -415,3 +415,224 @@
 + * SUCH DAMAGE. 
 + */
 +
+Index: lib/roken/getprogname.c
+===
+--- lib/roken/getprogname.c(revision 715)
 lib/roken/getprogname.c(working copy)
+@@ -36,7 +36,7 @@
+ RCSID($Id: getprogname.c,v 1.3 2005/04/12 11:28:48 lha Exp $);
+ #endif
+ 
+-#include roken.h
++#include roken.h
+ 
+ #ifndef HAVE___PROGNAME
+ const char *__progname;
+Index: lib/roken/setprogname.c
+===
+--- lib/roken/setprogname.c(revision 715)
 lib/roken/setprogname.c(working copy)
+@@ -36,7 +36,7 @@
+ RCSID($Id: setprogname.c,v 1.4 2005/08/23 10:19:20 lha Exp $);
+ #endif
+ 
+-#include roken.h
++#include roken.h
+ 
+ #ifndef HAVE___PROGNAME
+ extern const char *__progname;
+Index: lib/roken/getipnodebyaddr.c
+===
+--- lib/roken/getipnodebyaddr.c(revision 715)
 lib/roken/getipnodebyaddr.c(working copy)
+@@ -36,7 +36,7 @@
+ RCSID($Id: getipnodebyaddr.c,v 1.3 2005/04/12 11:28:47 lha Exp $);
+ #endif
+ 
+-#include roken.h
++#include roken.h
+ 
+ /*
+  * lookup `src, len' (address family `af') in DNS and return a pointer
+Index: lib/roken/strsep.c
+===
+--- lib/roken/strsep.c (revision 715)
 lib/roken/strsep.c (working copy)
+@@ -38,7 +38,7 @@
+ 
+ #include string.h
+ 
+-#include roken.h
++#include roken.h
+ 
+ #ifndef HAVE_STRSEP
+ 
+Index: lib/roken/freehostent.c
+===
+--- lib/roken/freehostent.c(revision 715)
 lib/roken/freehostent.c(working copy)
+@@ -36,7 +36,7 @@
+ RCSID($Id: freehostent.c,v 1.3 2005/04/12 11:28:41 lha Exp $);
+ #endif
+ 
+-#include roken.h
++#include roken.h
+ 
+ /*
+  * free a malloced hostent
+Index: lib/roken/hex.c
+===
+--- lib/roken/hex.c(revision 715)
 lib/roken/hex.c(working copy)
+@@ -35,7 +35,7 @@
+ #include config.h
+ RCSID($Id: hex.c,v 1.8 2006/01/09 17:09:29 lha Exp $);
+ #endif
+-#include roken.h
++#include roken.h
+ #include ctype.h
+ #include hex.h
+ 
+Index: lib/roken/hostent_find_fqdn.c
+===
+--- lib/roken/hostent_find_fqdn.c  (revision 715)
 lib/roken/hostent_find_fqdn.c  (working copy)
+@@ -36,7 +36,7 @@
+ RCSID($Id: hostent_find_fqdn.c,v 1.3 2005/04/12 11:28:51 lha Exp $);
+ #endif
+ 
+-#include roken.h
++#include roken.h
+ 
+ /*
+  * Try to find a fqdn (with `.') in he if possible, else return h_name
+Index: lib/roken/inet_aton.c
+===
+--- lib/roken/inet_aton.c  (revision 715)
 lib/roken/inet_aton.c  (working copy)
+@@ -36,7 +36,7 @@
+ RCSID($Id: inet_aton.c,v 1.14 2005/04/12 11:28:52 lha Exp $);
+ #endif
+ 
+-#include roken.h
++#include roken.h
+ 
+ /* Minimal implementation of inet_aton.
+  * Cannot distinguish between failure and a local broadcast address. */
+Index: lib/roken/gai_strerror.c
+===
+--- lib/roken/gai_strerror.c   (revision 715)
 lib/roken/gai_strerror.c   (working copy)
+@@ -36,7 +36,7 @@
+ RCSID($Id: gai_strerror.c,v 1.7 2005/08/05 09:31:35 lha Exp $);
+ #endif
+ 
+-#include roken.h
++#include roken.h
+ 
+ static struct gai_error {
+ int code;
+Index: lib/roken/bswap.c
+===
+--- lib/roken/bswap.c  (revision 715)
 lib/roken/bswap.c  (working copy)
+@@ -34,7 +34,7 @@
+ #ifdef HAVE_CONFIG_H
+ #include config.h
+ #endif
+-#include 

svn commit: samba r23061 - in branches/SAMBA_4_0/source/torture/raw: .

2007-05-21 Thread tridge
Author: tridge
Date: 2007-05-22 04:53:05 + (Tue, 22 May 2007)
New Revision: 23061

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

Log:

keep the RAW-BENCH-OPEN test balanced

Modified:
   branches/SAMBA_4_0/source/torture/raw/openbench.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/raw/openbench.c
===
--- branches/SAMBA_4_0/source/torture/raw/openbench.c   2007-05-22 04:13:17 UTC 
(rev 23060)
+++ branches/SAMBA_4_0/source/torture/raw/openbench.c   2007-05-22 04:53:05 UTC 
(rev 23061)
@@ -40,17 +40,20 @@
 static char **fnames;
 static int num_connected;
 
+enum open_stage {OPEN_INITIAL, OPEN_OPEN, OPEN_CLOSE};
+
 struct benchopen_state {
TALLOC_CTX *mem_ctx;
struct event_context *ev;
struct smbcli_state *cli;
struct smbcli_tree *tree;
+   enum open_stage stage;
int client_num;
+   int old_fnum;
int fnum;
int file_num;
int count;
int lastcount;
-   BOOL waiting_open, waiting_close;
union smb_open open_parms;
union smb_close close_parms;
struct smbcli_request *req_open;
@@ -65,6 +68,7 @@
 };
 
 static void next_open(struct benchopen_state *state);
+static void next_operation(struct benchopen_state *state);
 static void reopen_connection(struct event_context *ev, struct timed_event 
*te, 
  struct timeval t, void *private_data);
 
@@ -93,7 +97,9 @@
DEBUG(0,(reconnect to %s finished (%u connected)\n, state-dest_host,
 num_connected));
 
-   next_open(state);
+   state-stage = OPEN_INITIAL;
+   state-fnum = -1;
+   next_operation(state);
 }
 

@@ -127,8 +133,6 @@
talloc_free(state-tree);
state-tree = NULL;
state-fnum = -1;
-   state-waiting_open = False;
-   state-waiting_close = False;
 
ctx = smb_composite_connect_send(io, state-mem_ctx, state-ev);
if (ctx == NULL) {
@@ -165,20 +169,18 @@
state-req_open = smb_raw_open_send(state-tree, state-open_parms);
state-req_open-async.fn = open_completed;
state-req_open-async.private = state;
-   state-waiting_open = True;
+}
 
-   if (state-fnum == -1) {
-   return;
-   }
 
+static void next_close(struct benchopen_state *state)
+{
state-close_parms.close.level = RAW_CLOSE_CLOSE;
-   state-close_parms.close.in.file.fnum = state-fnum;
+   state-close_parms.close.in.file.fnum = state-old_fnum;
state-close_parms.close.in.write_time = 0;
 
state-req_close = smb_raw_close_send(state-tree, state-close_parms);
state-req_close-async.fn = close_completed;
state-req_close-async.private = state;
-   state-waiting_close = True;
 }
 
 /*
@@ -190,6 +192,8 @@
TALLOC_CTX *tmp_ctx = talloc_new(state-mem_ctx);
NTSTATUS status;
 
+   state-old_fnum = state-fnum;
+
status = smb_raw_open_recv(req, tmp_ctx, state-open_parms);
 
talloc_free(tmp_ctx);
@@ -225,11 +229,8 @@
}
 
state-fnum = state-open_parms.ntcreatex.out.file.fnum;
-   state-waiting_open = False;
 
-   if (!state-waiting_close) {
-   next_open(state);
-   }
+   next_operation(state);
 }  
 
 /*
@@ -262,14 +263,27 @@
return;
}
 
-   state-waiting_close = False;
+   next_operation(state);
+}  
 
-   if (!state-waiting_open) {
+static void next_operation(struct benchopen_state *state)
+{
+   switch (state-stage) {
+   case OPEN_INITIAL:
next_open(state);
+   state-stage = OPEN_OPEN;
+   break;
+   case OPEN_OPEN:
+   next_open(state);
+   state-stage = OPEN_CLOSE;
+   break;
+   case OPEN_CLOSE:
+   next_close(state);
+   state-stage = OPEN_OPEN;
+   break;
}
-}  
+}
 
-
 static void report_rate(struct event_context *ev, struct timed_event *te, 
struct timeval t, void *private_data)
 {
@@ -311,6 +325,7 @@
state[i].mem_ctx = talloc_new(state);
state[i].client_num = i;
state[i].ev = ev;
+   state[i].stage = OPEN_INITIAL;
if (!torture_open_connection_ev(state[i].cli, i, ev)) {
return False;
}
@@ -339,7 +354,7 @@
for (i=0;inprocs;i++) {
state[i].fnum = -1;
state[i].file_num = i;  
-   next_open(state[i]);
+   next_operation(state[i]);
}
 
tv = timeval_current(); 



svn commit: samba r23062 - in branches/SAMBA_4_0/source/torture/raw: .

2007-05-21 Thread tridge
Author: tridge
Date: 2007-05-22 05:16:16 + (Tue, 22 May 2007)
New Revision: 23062

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

Log:

make sure one node doesn't get ahead of the others at the start

Modified:
   branches/SAMBA_4_0/source/torture/raw/openbench.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/raw/openbench.c
===
--- branches/SAMBA_4_0/source/torture/raw/openbench.c   2007-05-22 04:53:05 UTC 
(rev 23061)
+++ branches/SAMBA_4_0/source/torture/raw/openbench.c   2007-05-22 05:16:16 UTC 
(rev 23062)
@@ -325,7 +325,6 @@
state[i].mem_ctx = talloc_new(state);
state[i].client_num = i;
state[i].ev = ev;
-   state[i].stage = OPEN_INITIAL;
if (!torture_open_connection_ev(state[i].cli, i, ev)) {
return False;
}
@@ -352,8 +351,11 @@
}
 
for (i=0;inprocs;i++) {
-   state[i].fnum = -1;
state[i].file_num = i;  
+   state[i].fnum = smbcli_open(state[i].tree, 
+   fnames[state-file_num], 
+   O_RDWR|O_CREAT, DENY_ALL);
+   state[i].stage = OPEN_OPEN;
next_operation(state[i]);
}
 



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

2007-05-21 Thread abartlet
Author: abartlet
Date: 2007-05-22 05:21:59 + (Tue, 22 May 2007)
New Revision: 23063

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

Log:
Make sure to invalidate the ccache when we set a
username/password/realm/etc from the command line.

Also make sure it can't 'come back' from a later call to
cli_credentials_guess(), buy setting a threshold.

This should fix the issues with the build farm...

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/auth/credentials/credentials.c
   branches/SAMBA_4_0/source/auth/credentials/credentials.h
   branches/SAMBA_4_0/source/auth/credentials/credentials_krb5.c


Changeset:
Modified: branches/SAMBA_4_0/source/auth/credentials/credentials.c
===
--- branches/SAMBA_4_0/source/auth/credentials/credentials.c2007-05-22 
05:16:16 UTC (rev 23062)
+++ branches/SAMBA_4_0/source/auth/credentials/credentials.c2007-05-22 
05:21:59 UTC (rev 23063)
@@ -53,6 +53,9 @@
cred-keytab_obtained = CRED_UNINITIALISED;
cred-principal_obtained = CRED_UNINITIALISED;
 
+   cred-ccache_threshold = CRED_UNINITIALISED;
+   cred-client_gss_creds_threshold = CRED_UNINITIALISED;
+
cred-old_password = NULL;
cred-smb_krb5_context = NULL;
cred-salt_principal = NULL;
@@ -125,6 +128,7 @@
cred-username = cred-username_cb(cred);
cred-callback_running = False;
cred-username_obtained = CRED_SPECIFIED;
+   cli_credentials_invalidate_ccache(cred, 
cred-username_obtained);
}
 
return cred-username;
@@ -136,6 +140,7 @@
if (obtained = cred-username_obtained) {
cred-username = talloc_strdup(cred, val);
cred-username_obtained = obtained;
+   cli_credentials_invalidate_ccache(cred, 
cred-username_obtained);
return True;
}
 
@@ -191,6 +196,7 @@
cred-principal = cred-principal_cb(cred);
cred-callback_running = False;
cred-principal_obtained = CRED_SPECIFIED;
+   cli_credentials_invalidate_ccache(cred, 
cred-principal_obtained);
}
 
if (cred-principal_obtained  cred-username_obtained) {
@@ -214,6 +220,7 @@
if (obtained = cred-principal_obtained) {
cred-principal = talloc_strdup(cred, val);
cred-principal_obtained = obtained;
+   cli_credentials_invalidate_ccache(cred, 
cred-principal_obtained);
return True;
}
 
@@ -280,6 +287,7 @@
cred-password = cred-password_cb(cred);
cred-callback_running = False;
cred-password_obtained = CRED_CALLBACK_RESULT;
+   cli_credentials_invalidate_ccache(cred, 
cred-password_obtained);
}
 
return cred-password;
@@ -295,6 +303,7 @@
if (obtained = cred-password_obtained) {
cred-password = talloc_strdup(cred, val);
cred-password_obtained = obtained;
+   cli_credentials_invalidate_ccache(cred, 
cred-password_obtained);
 
cred-nt_hash = NULL;
return True;
@@ -309,6 +318,7 @@
if (cred-password_obtained  CRED_CALLBACK) {
cred-password_cb = password_cb;
cred-password_obtained = CRED_CALLBACK;
+   cli_credentials_invalidate_ccache(cred, 
cred-password_obtained);
return True;
}
 
@@ -401,6 +411,7 @@
cred-domain = cred-domain_cb(cred);
cred-callback_running = False;
cred-domain_obtained = CRED_SPECIFIED;
+   cli_credentials_invalidate_ccache(cred, cred-domain_obtained);
}
 
return cred-domain;
@@ -417,6 +428,7 @@
 * calculations */
cred-domain = strupper_talloc(cred, val);
cred-domain_obtained = obtained;
+   cli_credentials_invalidate_ccache(cred, cred-domain_obtained);
return True;
}
 
@@ -453,6 +465,7 @@
cred-realm = cred-realm_cb(cred);
cred-callback_running = False;
cred-realm_obtained = CRED_SPECIFIED;
+   cli_credentials_invalidate_ccache(cred, cred-realm_obtained);
}
 
return cred-realm;
@@ -469,6 +482,7 @@
if (obtained = cred-realm_obtained) {
cred-realm = strupper_talloc(cred, val);
cred-realm_obtained = obtained;
+   cli_credentials_invalidate_ccache(cred, cred-realm_obtained);
return True;
}
 

Modified: branches/SAMBA_4_0/source/auth/credentials/credentials.h
===
--- branches/SAMBA_4_0/source/auth/credentials/credentials.h2007-05-22 
05:16:16 UTC (rev 23062)
+++ branches/SAMBA_4_0/source/auth/credentials/credentials.h

svn commit: samba r23064 - in branches/SAMBA_4_0/source: lib/cmdline ntvfs/cifs

2007-05-21 Thread abartlet
Author: abartlet
Date: 2007-05-22 05:22:18 + (Tue, 22 May 2007)
New Revision: 23064

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

Log:
Clarify comment and indent

Modified:
   branches/SAMBA_4_0/source/lib/cmdline/popt_credentials.c
   branches/SAMBA_4_0/source/ntvfs/cifs/vfs_cifs.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/cmdline/popt_credentials.c
===
--- branches/SAMBA_4_0/source/lib/cmdline/popt_credentials.c2007-05-22 
05:21:59 UTC (rev 23063)
+++ branches/SAMBA_4_0/source/lib/cmdline/popt_credentials.c2007-05-22 
05:22:18 UTC (rev 23064)
@@ -71,19 +71,19 @@
 
switch(opt-val) {
case 'U':
-   {
-   char *lp;
-
-   cli_credentials_parse_string(cmdline_credentials, arg, 
CRED_SPECIFIED);
-   /* This breaks the abstraction, including the const 
above */
-   if ((lp=strchr_m(arg,'%'))) {
-   lp[0]='\0';
-   lp++;
-   /* Try to prevent this showing up in ps */
-   memset(lp,0,strlen(lp));
-   }
+   {
+   char *lp;
+   
+   cli_credentials_parse_string(cmdline_credentials, arg, 
CRED_SPECIFIED);
+   /* This breaks the abstraction, including the const above */
+   if ((lp=strchr_m(arg,'%'))) {
+   lp[0]='\0';
+   lp++;
+   /* Try to prevent this showing up in ps */
+   memset(lp,0,strlen(lp));
}
-   break;
+   }
+   break;
 
case OPT_PASSWORD:
cli_credentials_set_password(cmdline_credentials, arg, 
CRED_SPECIFIED);

Modified: branches/SAMBA_4_0/source/ntvfs/cifs/vfs_cifs.c
===
--- branches/SAMBA_4_0/source/ntvfs/cifs/vfs_cifs.c 2007-05-22 05:21:59 UTC 
(rev 23063)
+++ branches/SAMBA_4_0/source/ntvfs/cifs/vfs_cifs.c 2007-05-22 05:22:18 UTC 
(rev 23064)
@@ -186,7 +186,7 @@
DEBUG(5, (CIFS backend: Using delegated credentials\n));
credentials = req-session_info-credentials;
} else {
-   DEBUG(1,(CIFS backend: You must supply server, user and 
password and or have delegated credentials\n));
+   DEBUG(1,(CIFS backend: NO delegated credentials found: You 
must supply server, user and password or the client must supply delegated 
credentials\n));
return NT_STATUS_INVALID_PARAMETER;
}