Rev 102: merge store_unlock code from ronnie in http://samba.org/~tridge/ctdb

2007-04-12 Thread tridge

revno: 102
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Andrew Tridgell <[EMAIL PROTECTED]>
branch nick: tridge
timestamp: Fri 2007-04-13 15:49:33 +1000
message:
  merge store_unlock code from ronnie
modified:
  common/ctdb_call.c ctdb_call.c-20061128065342-to93h6eejj5kon81-1
  common/ctdb_client.c   ctdb_client.c-20070411010216-3kd8v37k61steeya-1
  common/ctdb_daemon.c   ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1
  include/ctdb_private.h 
ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13
  tests/ctdb_fetch1.cctdb_fetch1.c-20070412111848-xawz6wqk9r0v8jdk-1

merged: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Ronnie sahlberg <[EMAIL PROTECTED]>
branch nick: ctdb
timestamp: Fri 2007-04-13 09:44:56 +1000
message:
  add more elaborate test to fetch1 test
  
  for now:
  fetch a record
  store a known entry for this record
  fetch the record again  (and later verify we got the same record)
  store it back again
  
  this will not work right now since we dont yet store the record inside 
the daemon

merged: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Ronnie sahlberg <[EMAIL PROTECTED]>
branch nick: ctdb
timestamp: Fri 2007-04-13 09:41:15 +1000
message:
  add store_unlock pdu's for the domain socket.
  
  note that the store_unlock does not actually do anything yet apart from 
passing the pdu from client to daemon   and daemon responds.
  
  next is to make sure the daemon actually stores the data in a database

merged: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Ronnie sahlberg <[EMAIL PROTECTED]>
branch nick: ctdb
timestamp: Thu 2007-04-12 21:35:16 +1000
message:
  merge from tridge

Diff too large for email (303, the limit is 200).


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

2007-04-12 Thread abartlet
Author: abartlet
Date: 2007-04-13 05:37:08 + (Fri, 13 Apr 2007)
New Revision: 22208

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

Log:
Print the target principal name, to help with kdc unreachable errors.

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/auth/gensec/gensec_gssapi.c


Changeset:
Modified: branches/SAMBA_4_0/source/auth/gensec/gensec_gssapi.c
===
--- branches/SAMBA_4_0/source/auth/gensec/gensec_gssapi.c   2007-04-13 
01:46:47 UTC (rev 22207)
+++ branches/SAMBA_4_0/source/auth/gensec/gensec_gssapi.c   2007-04-13 
05:37:08 UTC (rev 22208)
@@ -320,21 +320,18 @@
 
principal = gensec_get_target_principal(gensec_security);
if (principal && lp_client_use_spnego_principal()) {
-   name_token.value  = discard_const_p(uint8_t, principal);
-   name_token.length = strlen(principal);
-
name_type = GSS_C_NULL_OID;
} else {
principal = talloc_asprintf(gensec_gssapi_state, "[EMAIL 
PROTECTED]", 

gensec_get_target_service(gensec_security), 
hostname);
 
-   name_token.value  = discard_const_p(uint8_t, principal);
-   name_token.length = strlen(principal);
-
name_type = GSS_C_NT_HOSTBASED_SERVICE;
}   
+   name_token.value  = discard_const_p(uint8_t, principal);
+   name_token.length = strlen(principal);
 
+
maj_stat = gss_import_name (&min_stat,
&name_token,
name_type,
@@ -351,7 +348,7 @@
case 0:
break;
case KRB5_KDC_UNREACH:
-   DEBUG(3, ("Cannot reach a KDC we require\n"));
+   DEBUG(3, ("Cannot reach a KDC we require to contact %s\n", 
principal));
return NT_STATUS_INVALID_PARAMETER; /* Make SPNEGO ignore us, 
we can't go any further here */
default:
DEBUG(1, ("Aquiring initiator credentails failed\n"));



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

2007-04-12 Thread Jeremy Allison
On Fri, Apr 13, 2007 at 02:36:51PM +1000, [EMAIL PROTECTED] wrote:
> 
> That wasn't my question. I don't doubt that it is possible to get a
> corrupt tdb file. What I am asking is if you have seen a corrupt tdb
> file that causes a 'wild pointer', and presumably a crash in the tdb
> code that is reading the file.
> 
> The patch you applied implied that you thought we might get a file
> like that, and that disabling MMAP would avoid the segv. I shouldn't
> matter if you have the contents of /dev/random in a tdb file, it
> should not segv, no matter if using mmap or not (there is an exception
> to this, where the file is truncated out from under a running program
> accessing tdb via mmap - that is arguably a kernel bug, and is not
> relevant to the situation you are trying to fix).
> 
> So if you do have a tdb file that when read using mmap causes a crash,
> please give me a copy. It implies that we have a real bug.

Ah, *now* I see - sorry. I didn't get it. No, I don't have a file
like that - I haven't seen a wild pointer crash in the tdb code
itself for a long long time :-). I'm thinking of the somewhat
less robust code that is processing the tdb output data :-).

Although some rather woolley thinking on my part did rather
confuse the two :-).

I will test this code with the contents of /dev/random
though (prepended with a valid tdb header of course :-).

Jeremy.


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

2007-04-12 Thread tridge
Jeremy,

 > The issue some (real) customers are seeing is with laptops
 > (mainly I believe) going down hard - no shutdown. In that
 > case without the equivalent of an msync it's easy to get
 > a corrupted tdb state.

That wasn't my question. I don't doubt that it is possible to get a
corrupt tdb file. What I am asking is if you have seen a corrupt tdb
file that causes a 'wild pointer', and presumably a crash in the tdb
code that is reading the file.

The patch you applied implied that you thought we might get a file
like that, and that disabling MMAP would avoid the segv. I shouldn't
matter if you have the contents of /dev/random in a tdb file, it
should not segv, no matter if using mmap or not (there is an exception
to this, where the file is truncated out from under a running program
accessing tdb via mmap - that is arguably a kernel bug, and is not
relevant to the situation you are trying to fix).

So if you do have a tdb file that when read using mmap causes a crash,
please give me a copy. It implies that we have a real bug.

Cheers, Tridge


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

2007-04-12 Thread Jeremy Allison
On Fri, Apr 13, 2007 at 01:41:39PM +1000, [EMAIL PROTECTED] wrote:
> 
> Did you really see problems like this with any tdb file? If so, can
> you please send me the tdb file?

No, no winbindd access will produce such a tdb file.

> tdb should be doing range checking on all offsets from the db. If it
> isn't, then we have a bug and should fix it. The range checking code
> is what triggers the tdb to grow automatically when needed, so it
> needs to be right even for non-corrupt databases.

I know - I did work on this code remember :-).

The issue some (real) customers are seeing is with laptops
(mainly I believe) going down hard - no shutdown. In that
case without the equivalent of an msync it's easy to get
a corrupted tdb state. Probably the real solution is to go
to a transactional tdb for this cache file, but I started
this code before transactional tdb existed and Volker
did ask me to finish it. I'd imagine the speed isn't
an issue but we should check.

Jeremy.


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

2007-04-12 Thread tridge
 > Volker is clever :-). Use TDB_NOMMAP to prevent any wild pointer
 > problems when validating the winbindd cache. Wish I'd have
 > thought of that.

Did you really see problems like this with any tdb file? If so, can
you please send me the tdb file?

tdb should be doing range checking on all offsets from the db. If it
isn't, then we have a bug and should fix it. The range checking code
is what triggers the tdb to grow automatically when needed, so it
needs to be right even for non-corrupt databases.

Cheers, Tridge


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

2007-04-12 Thread jra
Author: jra
Date: 2007-04-13 01:46:47 + (Fri, 13 Apr 2007)
New Revision: 22207

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

Log:
Fill in the validation functions. Now to test...
Jeremy.

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


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c 2007-04-13 01:00:44 UTC 
(rev 22206)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c 2007-04-13 01:46:47 UTC 
(rev 22207)
@@ -2757,7 +2757,11 @@
return 1;
}
 
-   /* FIXME - fill in details here... */
+   (void)centry_uint16(centry);
+   (void)centry_uint16(centry);
+   (void)centry_uint32(centry);
+   (void)centry_nttime(centry);
+   (void)centry_nttime(centry);
 
centry_free(centry);
 
@@ -2776,8 +2780,14 @@
return 1;
}
 
-   /* FIXME - fill in details here... */
+   (void)centry_time(centry);
+   (void)centry_hash16(centry, mem_ctx);
 
+   /* We only have 17 bytes more data in the salted cred case. */
+   if (centry->len - centry->ofs == 17) {
+   (void)centry_hash16(centry, mem_ctx);
+   }
+
centry_free(centry);
 
if (bad_cache_entry) {
@@ -2790,13 +2800,24 @@
 static int validate_ul(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf)
 {
struct cache_entry *centry = create_centry_validate(keystr, dbuf);
+   int32 num_entries, i;
 
if (!centry) {
return 1;
}
 
-   /* FIXME - fill in details here... */
+   num_entries = (int32)centry_uint32(centry);
 
+   for (i=0; i< num_entries; i++) {
+   DOM_SID sid;
+   (void)centry_string(centry, mem_ctx);
+   (void)centry_string(centry, mem_ctx);
+   (void)centry_string(centry, mem_ctx);
+   (void)centry_string(centry, mem_ctx);
+   (void)centry_sid(centry, mem_ctx, &sid);
+   (void)centry_sid(centry, mem_ctx, &sid);
+   }
+
centry_free(centry);
 
if (bad_cache_entry) {
@@ -2809,12 +2830,19 @@
 static int validate_gl(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf)
 {
struct cache_entry *centry = create_centry_validate(keystr, dbuf);
+   int32 num_entries, i;
 
if (!centry) {
return 1;
}
 
-   /* FIXME - fill in details here... */
+   num_entries = centry_uint32(centry);
+   
+   for (i=0; i< num_entries; i++) {
+   (void)centry_string(centry, mem_ctx);
+   (void)centry_string(centry, mem_ctx);
+   (void)centry_uint32(centry);
+   }
 
centry_free(centry);
 
@@ -2828,13 +2856,19 @@
 static int validate_ug(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf)
 {
struct cache_entry *centry = create_centry_validate(keystr, dbuf);
+   int32 num_groups, i;
 
if (!centry) {
return 1;
}
 
-   /* FIXME - fill in details here... */
+   num_groups = centry_uint32(centry);
 
+   for (i=0; i< num_groups; i++) {
+   DOM_SID sid;
+   centry_sid(centry, mem_ctx, &sid);
+   }
+
centry_free(centry);
 
if (bad_cache_entry) {
@@ -2847,13 +2881,18 @@
 static int validate_ua(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf)
 {
struct cache_entry *centry = create_centry_validate(keystr, dbuf);
+   int32 num_aliases, i;
 
if (!centry) {
return 1;
}
 
-   /* FIXME - fill in details here... */
+   num_aliases = centry_uint32(centry);
 
+   for (i=0; i < num_aliases; i++) {
+   (void)centry_uint32(centry);
+   }
+
centry_free(centry);
 
if (bad_cache_entry) {
@@ -2866,13 +2905,21 @@
 static int validate_gm(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf)
 {
struct cache_entry *centry = create_centry_validate(keystr, dbuf);
+   int32 num_names, i;
 
if (!centry) {
return 1;
}
 
-   /* FIXME - fill in details here... */
+   num_names = centry_uint32(centry);
 
+   for (i=0; i< num_names; i++) {
+   DOM_SID sid;
+   centry_sid(centry, mem_ctx, &sid);
+   (void)centry_string(centry, mem_ctx);
+   (void)centry_uint32(centry);
+   }
+
centry_free(centry);
 
if (bad_cache_entry) {
@@ -2884,38 +2931,28 @@
 
 static int validate_dr(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf)
 {
-   struct cache_entry *centry = create_centry_validate(keystr, dbuf);
-
-   if (!centry) {
+   /* Can't say anything about this other than must be nonzero. */
+   if (dbuf.dsize == 0) {
+   DEBUG(0,("validate_dr: Corrupt cache for key %s (len == 0) ?\n",
+ 

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

2007-04-12 Thread jra
Author: jra
Date: 2007-04-13 01:00:44 + (Fri, 13 Apr 2007)
New Revision: 22206

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

Log:
Added boilerplate to be filled in for other validation functions.
Jeremy.

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


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c 2007-04-13 00:39:06 UTC 
(rev 22205)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c 2007-04-13 01:00:44 UTC 
(rev 22206)
@@ -2730,61 +2730,224 @@
 
 static int validate_loc_pol(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA 
dbuf)
 {
+   struct cache_entry *centry = create_centry_validate(keystr, dbuf);
+
+   if (!centry) {
+   return 1;
+   }
+
+   (void)centry_nttime(centry);
+   (void)centry_nttime(centry);
+   (void)centry_uint16(centry);
+
+   centry_free(centry);
+
+   if (bad_cache_entry) {
+   return 1;
+   }
+   DEBUG(10,("validate_loc_pol: %s ok\n", keystr));
return 0;
 }
 
 static int validate_pwd_pol(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA 
dbuf)
 {
+   struct cache_entry *centry = create_centry_validate(keystr, dbuf);
+
+   if (!centry) {
+   return 1;
+   }
+
+   /* FIXME - fill in details here... */
+
+   centry_free(centry);
+
+   if (bad_cache_entry) {
+   return 1;
+   }
+   DEBUG(10,("validate_pwd_pol: %s ok\n", keystr));
return 0;
 }
 
 static int validate_cred(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA 
dbuf)
 {
+   struct cache_entry *centry = create_centry_validate(keystr, dbuf);
+
+   if (!centry) {
+   return 1;
+   }
+
+   /* FIXME - fill in details here... */
+
+   centry_free(centry);
+
+   if (bad_cache_entry) {
+   return 1;
+   }
+   DEBUG(10,("validate_cred: %s ok\n", keystr));
return 0;
 }
 
 static int validate_ul(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf)
 {
+   struct cache_entry *centry = create_centry_validate(keystr, dbuf);
+
+   if (!centry) {
+   return 1;
+   }
+
+   /* FIXME - fill in details here... */
+
+   centry_free(centry);
+
+   if (bad_cache_entry) {
+   return 1;
+   }
+   DEBUG(10,("validate_ul: %s ok\n", keystr));
return 0;
 }
 
 static int validate_gl(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf)
 {
+   struct cache_entry *centry = create_centry_validate(keystr, dbuf);
+
+   if (!centry) {
+   return 1;
+   }
+
+   /* FIXME - fill in details here... */
+
+   centry_free(centry);
+
+   if (bad_cache_entry) {
+   return 1;
+   }
+   DEBUG(10,("validate_gl: %s ok\n", keystr));
return 0;
 }
 
 static int validate_ug(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf)
 {
+   struct cache_entry *centry = create_centry_validate(keystr, dbuf);
+
+   if (!centry) {
+   return 1;
+   }
+
+   /* FIXME - fill in details here... */
+
+   centry_free(centry);
+
+   if (bad_cache_entry) {
+   return 1;
+   }
+   DEBUG(10,("validate_ug: %s ok\n", keystr));
return 0;
 }
 
 static int validate_ua(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf)
 {
+   struct cache_entry *centry = create_centry_validate(keystr, dbuf);
+
+   if (!centry) {
+   return 1;
+   }
+
+   /* FIXME - fill in details here... */
+
+   centry_free(centry);
+
+   if (bad_cache_entry) {
+   return 1;
+   }
+   DEBUG(10,("validate_ua: %s ok\n", keystr));
return 0;
 }
 
 static int validate_gm(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf)
 {
+   struct cache_entry *centry = create_centry_validate(keystr, dbuf);
+
+   if (!centry) {
+   return 1;
+   }
+
+   /* FIXME - fill in details here... */
+
+   centry_free(centry);
+
+   if (bad_cache_entry) {
+   return 1;
+   }
+   DEBUG(10,("validate_gm: %s ok\n", keystr));
return 0;
 }
 
 static int validate_dr(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf)
 {
+   struct cache_entry *centry = create_centry_validate(keystr, dbuf);
+
+   if (!centry) {
+   return 1;
+   }
+
+   /* FIXME - fill in details here... */
+
+   centry_free(centry);
+
+   if (bad_cache_entry) {
+   return 1;
+   }
+   DEBUG(10,("validate_dr: %s ok\n", keystr));
return 0;
 }
 
 static int validate_de(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf)
 {
+   struct cache_entry *centry = create_centry_validate(keystr, dbuf);
+
+   if (!centry) {
+   return 1;
+   }
+
+   /* FIXME - fill in details here

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

2007-04-12 Thread jra
Author: jra
Date: 2007-04-13 00:39:06 + (Fri, 13 Apr 2007)
New Revision: 22205

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

Log:
Add some flesh to the bones of the cache validation code.
Jeremy

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


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c 2007-04-12 21:10:06 UTC 
(rev 22204)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c 2007-04-13 00:39:06 UTC 
(rev 22205)
@@ -52,6 +52,8 @@
uint32 len, ofs;
 };
 
+void (*smb_panic_fn)(const char *const why) = smb_panic;
+
 #define WINBINDD_MAX_CACHE_SIZE (50*1024*1024)
 
 static struct winbind_cache *wcache;
@@ -160,16 +162,27 @@
free(centry);
 }
 
+static BOOL centry_check_bytes(struct cache_entry *centry, size_t nbytes)
+{
+   if (centry->len - centry->ofs < nbytes) {
+   DEBUG(0,("centry corruption? needed %u bytes, have %d\n", 
+(unsigned int)nbytes,
+centry->len - centry->ofs));
+   return False;
+   }
+   return True;
+}
+
 /*
   pull a uint32 from a cache entry 
 */
 static uint32 centry_uint32(struct cache_entry *centry)
 {
uint32 ret;
-   if (centry->len - centry->ofs < 4) {
-   DEBUG(0,("centry corruption? needed 4 bytes, have %d\n", 
-centry->len - centry->ofs));
-   smb_panic("centry_uint32");
+
+   if (centry_check_bytes(centry, 4)) {
+   smb_panic_fn("centry_uint32");
+   return (uint32)-1;
}
ret = IVAL(centry->data, centry->ofs);
centry->ofs += 4;
@@ -182,10 +195,9 @@
 static uint16 centry_uint16(struct cache_entry *centry)
 {
uint16 ret;
-   if (centry->len - centry->ofs < 2) {
-   DEBUG(0,("centry corruption? needed 2 bytes, have %d\n", 
-centry->len - centry->ofs));
-   smb_panic("centry_uint16");
+   if (centry_check_bytes(centry, 2)) {
+   smb_panic_fn("centry_uint16");
+   return (uint16)-1;
}
ret = CVAL(centry->data, centry->ofs);
centry->ofs += 2;
@@ -198,10 +210,9 @@
 static uint8 centry_uint8(struct cache_entry *centry)
 {
uint8 ret;
-   if (centry->len - centry->ofs < 1) {
-   DEBUG(0,("centry corruption? needed 1 bytes, have %d\n", 
-centry->len - centry->ofs));
-   smb_panic("centry_uint32");
+   if (centry_check_bytes(centry, 1)) {
+   smb_panic_fn("centry_uint8");
+   return (uint8)-1;
}
ret = CVAL(centry->data, centry->ofs);
centry->ofs += 1;
@@ -214,10 +225,9 @@
 static NTTIME centry_nttime(struct cache_entry *centry)
 {
NTTIME ret;
-   if (centry->len - centry->ofs < 8) {
-   DEBUG(0,("centry corruption? needed 8 bytes, have %d\n", 
-centry->len - centry->ofs));
-   smb_panic("centry_nttime");
+   if (centry_check_bytes(centry, 8)) {
+   smb_panic_fn("centry_nttime");
+   return (NTTIME)-1;
}
ret = IVAL(centry->data, centry->ofs);
centry->ofs += 4;
@@ -232,10 +242,9 @@
 static time_t centry_time(struct cache_entry *centry)
 {
time_t ret;
-   if (centry->len - centry->ofs < sizeof(time_t)) {
-   DEBUG(0,("centry corruption? needed %u bytes, have %u\n", 
-(unsigned int)sizeof(time_t), (unsigned 
int)(centry->len - centry->ofs)));
-   smb_panic("centry_time");
+   if (centry_check_bytes(centry, sizeof(time_t))) {
+   smb_panic_fn("centry_time");
+   return (time_t)-1;
}
ret = IVAL(centry->data, centry->ofs); /* FIXME: correct ? */
centry->ofs += sizeof(time_t);
@@ -257,15 +266,15 @@
return NULL;
}
 
-   if (centry->len - centry->ofs < len) {
-   DEBUG(0,("centry corruption? needed %d bytes, have %d\n", 
-len, centry->len - centry->ofs));
-   smb_panic("centry_string");
+   if (centry_check_bytes(centry, (size_t)len)) {
+   smb_panic_fn("centry_string");
+   return NULL;
}
 
ret = TALLOC_ARRAY(mem_ctx, char, len+1);
if (!ret) {
-   smb_panic("centry_string out of memory\n");
+   smb_panic_fn("centry_string out of memory\n");
+   return NULL;
}
memcpy(ret,centry->data + centry->ofs, len);
ret[len] = 0;
@@ -289,15 +298,14 @@
return NULL;
}
 
-   if (centry->len - centry->ofs < 16) {
-   DEBUG(0,("centry corruption? needed 16 bytes, have %d\n", 
-centry->len - centry->ofs));
+   i

Build status as of Fri Apr 13 00:00:02 2007

2007-04-12 Thread build
URL: http://build.samba.org/

--- /home/build/master/cache/broken_results.txt.old 2007-04-12 
00:01:57.0 +
+++ /home/build/master/cache/broken_results.txt 2007-04-13 00:00:24.0 
+
@@ -1,23 +1,23 @@
-Build status as of Thu Apr 12 00:00:02 2007
+Build status as of Fri Apr 13 00:00:02 2007
 
 Build counts:
 Tree Total  Broken Panic 
 SOC  0  0  0 
 build_farm   0  0  0 
-ccache   38 6  0 
+ccache   37 6  0 
 ctdb 0  0  0 
 distcc   3  0  0 
 ldb  35 4  0 
-libreplace   34 4  0 
+libreplace   33 6  0 
 lorikeet-heimdal 31 15 0 
 pidl 21 2  0 
 ppp  15 0  0 
-rsync38 13 0 
+rsync37 13 0 
 samba0  0  0 
 samba-docs   0  0  0 
 samba-gtk3  3  0 
-samba4   39 32 1 
-samba_3_041 21 1 
+samba4   39 34 2 
+samba_3_040 20 1 
 smb-build33 32 0 
 talloc   37 1  0 
 tdb  35 2  0 


svn commit: samba r22204 - in branches: SAMBA_3_0/source/nsswitch SAMBA_3_0_25/source/nsswitch

2007-04-12 Thread idra
Author: idra
Date: 2007-04-12 21:10:06 + (Thu, 12 Apr 2007)
New Revision: 22204

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

Log:

Workaround to quickly close bug #4508
This hack makes thing work, but we will need to try again to
make the getpw* calls fully async, that's the real fix.


Modified:
   branches/SAMBA_3_0/source/nsswitch/idmap.c
   branches/SAMBA_3_0/source/nsswitch/winbindd.c
   branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c
   branches/SAMBA_3_0_25/source/nsswitch/idmap.c
   branches/SAMBA_3_0_25/source/nsswitch/winbindd.c
   branches/SAMBA_3_0_25/source/nsswitch/winbindd_dual.c


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/idmap.c
===
--- branches/SAMBA_3_0/source/nsswitch/idmap.c  2007-04-12 19:54:15 UTC (rev 
22203)
+++ branches/SAMBA_3_0/source/nsswitch/idmap.c  2007-04-12 21:10:06 UTC (rev 
22204)
@@ -84,6 +84,24 @@
return NULL;
 }
 
+/* part of a quick hack to avoid loops, need to be sorted out correctly later 
on */
+static BOOL idmap_in_own_child;
+
+static BOOL idmap_is_in_own_child(void)
+{
+   return idmap_in_own_child;
+}
+
+void reset_idmap_in_own_child(void)
+{
+   idmap_in_own_child = False;
+}
+
+void set_idmap_in_own_child(void)
+{
+   idmap_in_own_child = True;
+}
+
 /**
  Allow a module to register itself as a method.
 **/
@@ -801,13 +819,18 @@
if ( ! NT_STATUS_IS_OK(ret)) {
return NT_STATUS_NONE_MAPPED;
}
-   
-   /* by default calls to winbindd are disabled
-  the following call will not recurse so this is safe */
-   winbind_on();
-   wbret = winbind_lookup_sid(ctx, map->sid, &domname, &name, &sid_type);
-   winbind_off();
 
+   /* quick hack to make things work, will need proper fix later on */ 
+   if (idmap_is_in_own_child()) {
+   /* by default calls to winbindd are disabled
+  the following call will not recurse so this is safe */
+   winbind_on();
+   wbret = winbind_lookup_sid(ctx, map->sid, &domname, &name, 
&sid_type);
+   winbind_off();
+   } else {
+   wbret = winbindd_lookup_name_by_sid(ctx, map->sid, &domname, 
&name, &sid_type);
+   }
+
/* check if this is a valid SID and then map it */
if (wbret) {
switch (sid_type) {
@@ -1395,3 +1418,4 @@
 
return ret;
 }
+

Modified: branches/SAMBA_3_0/source/nsswitch/winbindd.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd.c   2007-04-12 19:54:15 UTC 
(rev 22203)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd.c   2007-04-12 21:10:06 UTC 
(rev 22204)
@@ -1010,6 +1010,9 @@
 
namecache_enable();
 
+   /* quick hack to avoid a loop in idmap, proper fix later */
+   reset_idmap_in_own_child();
+
/* Winbind daemon initialisation */
 
if ( ! NT_STATUS_IS_OK(idmap_init_cache()) ) {

Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c  2007-04-12 19:54:15 UTC 
(rev 22203)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c  2007-04-12 21:10:06 UTC 
(rev 22204)
@@ -921,6 +921,9 @@
child);
}
 
+   /* quick hack to avoid a loop in idmap, proper fix later */
+   set_idmap_in_own_child();
+
while (1) {
 
int ret;

Modified: branches/SAMBA_3_0_25/source/nsswitch/idmap.c
===
--- branches/SAMBA_3_0_25/source/nsswitch/idmap.c   2007-04-12 19:54:15 UTC 
(rev 22203)
+++ branches/SAMBA_3_0_25/source/nsswitch/idmap.c   2007-04-12 21:10:06 UTC 
(rev 22204)
@@ -84,6 +84,24 @@
return NULL;
 }
 
+/* part of a quick hack to avoid loops, need to be sorted out correctly later 
on */
+static BOOL idmap_in_own_child;
+
+static BOOL idmap_is_in_own_child(void)
+{
+   return idmap_in_own_child;
+}
+
+void reset_idmap_in_own_child(void)
+{
+   idmap_in_own_child = False;
+}
+
+void set_idmap_in_own_child(void)
+{
+   idmap_in_own_child = True;
+}
+
 /**
  Allow a module to register itself as a method.
 **/
@@ -801,13 +819,18 @@
if ( ! NT_STATUS_IS_OK(ret)) {
return NT_STATUS_NONE_MAPPED;
}
-   
-   /* by default calls to winbindd are disabled
-  the following call will not recurse so this is safe */
-   winbind_on();
-   wbret = winbind_lookup_sid(ctx, map->sid, &domname, &name, &sid_type);
-   winb

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

2007-04-12 Thread jelmer
Author: jelmer
Date: 2007-04-12 19:54:15 + (Thu, 12 Apr 2007)
New Revision: 22203

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

Log:
Improve the replace testsuite a bit.

Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/lib/replace/test/testsuite.c


Changeset:

Property changes on: branches/SAMBA_4_0
___
Name: bzr:merge
...skipped...

Modified: branches/SAMBA_4_0/source/lib/replace/test/testsuite.c
===
--- branches/SAMBA_4_0/source/lib/replace/test/testsuite.c  2007-04-12 
19:16:29 UTC (rev 22202)
+++ branches/SAMBA_4_0/source/lib/replace/test/testsuite.c  2007-04-12 
19:54:15 UTC (rev 22203)
@@ -115,7 +115,27 @@
 
 static int test_strlcat(void)
 {
-   /* FIXME */
+   char tmp[10];
+   printf("test: strlcat\n");
+   strcpy(tmp, "");
+   if (strlcat(tmp, "bla", 3) != 3) {
+   printf("failure: strlcat [\ninvalid return code\n]\n");
+   return false;
+   }
+   if (strcmp(tmp, "bl") != 0) {
+   printf("failure: strlcat [\nexpected \"bl\", got \"%s\"\n]\n", 
+  tmp);
+   return false;
+   }
+
+   strcpy(tmp, "da");
+   if (strlcat(tmp, "me", 4) != 4) {
+   printf("failure: strlcat [\nexpected \"dam\", got \"%s\"\n]\n",
+  tmp);
+   return false;
+   }
+
+   printf("success: strlcat\n");
return true;
 }
 
@@ -139,7 +159,16 @@
 
 static int test_strdup(void)
 {
-   /* FIXME */
+   char *x;
+   printf("test: strdup\n");
+   x = strdup("bla");
+   if (strcmp("bla", x) != 0) {
+   printf("failure: strdup [\nfailed: expected \"bla\", got 
\"%s\"\n]\n",
+  x);
+   return false;
+   }
+   free(x);
+   printf("success: strdup\n");
return true;
 }  
 
@@ -225,13 +254,49 @@
 
 static int test_strndup(void)
 {
-   /* FIXME */
+   char *x;
+   printf("test: strndup\n");
+   x = strndup("bla", 0);
+   if (strcmp(x, "") != 0) {
+   printf("failure: strndup [\ninvalid\n]\n");
+   return false;
+   }
+   free(x);
+   x = strndup("bla", 2);
+   if (strcmp(x, "bl") != 0) {
+   printf("failure: strndup [\ninvalid\n]\n");
+   return false;
+   }
+   free(x);
+   x = strndup("bla", 10);
+   if (strcmp(x, "bla") != 0) {
+   printf("failure: strndup [\ninvalid\n]\n");
+   return false;
+   }
+   free(x);
+   printf("success: strndup\n");
return true;
 }
 
 static int test_strnlen(void)
 {
-   /* FIXME */
+   printf("test: strnlen\n");
+   if (strnlen("bla", 2) != 2) {
+   printf("failure: strnlen [\nunexpected length\n]\n");
+   return false;
+   }
+
+   if (strnlen("some text\n", 0) != 0) {
+   printf("failure: strnlen [\nunexpected length\n]\n");
+   return false;
+   }
+
+   if (strnlen("some text", 20) != 9) {
+   printf("failure: strnlen [\nunexpected length\n]\n");
+   return false;
+   }
+
+   printf("success: strnlen\n");
return true;
 }
 
@@ -255,13 +320,43 @@
 
 static int test_asprintf(void)
 {
-   /* FIXME */
+   char *x;
+   printf("test: asprintf\n");
+   if (asprintf(&x, "%d", 9) != 1) {
+   printf("failure: asprintf [\ngenerate asprintf\n]\n");
+   return false;
+   }
+   if (strcmp(x, "9") != 0) {
+   printf("failure: asprintf [\ngenerate asprintf\n]\n");
+   return false;
+   }
+   if (asprintf(&x, "dat%s", "a") != 4) {
+   printf("failure: asprintf [\ngenerate asprintf\n]\n");
+   return false;
+   }
+   if (strcmp(x, "data") != 0) {
+   printf("failure: asprintf [\ngenerate asprintf\n]\n");
+   return false;
+   }
+   printf("success: asprintf\n");
return true;
 }
 
 static int test_snprintf(void)
 {
-   /* FIXME */
+   char tmp[10];
+   printf("test: snprintf\n");
+   if (snprintf(tmp, 3, "foo%d", 9) != 4) {
+   printf("failure: snprintf [\nsnprintf return code failed\n]\n");
+   return false;
+   }
+
+   if (strcmp(tmp, "fo") != 0) {
+   printf("failure: snprintf [\nsnprintf failed\n]\n");
+   return false;
+   }
+
+   printf("success: snprintf\n");
return true;
 }
 
@@ -328,13 +423,22 @@
 
 static int test_strerror(void)
 {
+   printf("test: strerror\n");
/* FIXME */
+   printf("failure: sterror\n");
return true;
 }
 
 static int test_errno(void)
 {
-   /* FIXME */
+   printf("test: errno\n");
+   errno = 3;
+   if (errno != 3) {

Rev 11847: Improve the replace testsuite a bit. in file:///home/jelmer/bzr.samba/SAMBA_4_0/

2007-04-12 Thread Jelmer Vernooij
At file:///home/jelmer/bzr.samba/SAMBA_4_0/


revno: 11847
revision-id: [EMAIL PROTECTED]
parent: svn-v2:[EMAIL PROTECTED]
committer: Jelmer Vernooij <[EMAIL PROTECTED]>
branch nick: SAMBA_4_0
timestamp: Thu 2007-04-12 22:52:22 +0200
message:
  Improve the replace testsuite a bit.
modified:
  source/lib/replace/test/testsuite.c svn-v2:[EMAIL PROTECTED]
=== modified file 'source/lib/replace/test/testsuite.c'
--- a/source/lib/replace/test/testsuite.c   2007-04-10 16:00:13 +
+++ b/source/lib/replace/test/testsuite.c   2007-04-12 20:52:22 +
@@ -115,7 +115,27 @@
 
 static int test_strlcat(void)
 {
-   /* FIXME */
+   char tmp[10];
+   printf("test: strlcat\n");
+   strcpy(tmp, "");
+   if (strlcat(tmp, "bla", 3) != 3) {
+   printf("failure: strlcat [\ninvalid return code\n]\n");
+   return false;
+   }
+   if (strcmp(tmp, "bl") != 0) {
+   printf("failure: strlcat [\nexpected \"bl\", got \"%s\"\n]\n", 
+  tmp);
+   return false;
+   }
+
+   strcpy(tmp, "da");
+   if (strlcat(tmp, "me", 4) != 4) {
+   printf("failure: strlcat [\nexpected \"dam\", got \"%s\"\n]\n",
+  tmp);
+   return false;
+   }
+
+   printf("success: strlcat\n");
return true;
 }
 
@@ -139,7 +159,16 @@
 
 static int test_strdup(void)
 {
-   /* FIXME */
+   char *x;
+   printf("test: strdup\n");
+   x = strdup("bla");
+   if (strcmp("bla", x) != 0) {
+   printf("failure: strdup [\nfailed: expected \"bla\", got 
\"%s\"\n]\n",
+  x);
+   return false;
+   }
+   free(x);
+   printf("success: strdup\n");
return true;
 }  
 
@@ -225,13 +254,49 @@
 
 static int test_strndup(void)
 {
-   /* FIXME */
+   char *x;
+   printf("test: strndup\n");
+   x = strndup("bla", 0);
+   if (strcmp(x, "") != 0) {
+   printf("failure: strndup [\ninvalid\n]\n");
+   return false;
+   }
+   free(x);
+   x = strndup("bla", 2);
+   if (strcmp(x, "bl") != 0) {
+   printf("failure: strndup [\ninvalid\n]\n");
+   return false;
+   }
+   free(x);
+   x = strndup("bla", 10);
+   if (strcmp(x, "bla") != 0) {
+   printf("failure: strndup [\ninvalid\n]\n");
+   return false;
+   }
+   free(x);
+   printf("success: strndup\n");
return true;
 }
 
 static int test_strnlen(void)
 {
-   /* FIXME */
+   printf("test: strnlen\n");
+   if (strnlen("bla", 2) != 2) {
+   printf("failure: strnlen [\nunexpected length\n]\n");
+   return false;
+   }
+
+   if (strnlen("some text\n", 0) != 0) {
+   printf("failure: strnlen [\nunexpected length\n]\n");
+   return false;
+   }
+
+   if (strnlen("some text", 20) != 9) {
+   printf("failure: strnlen [\nunexpected length\n]\n");
+   return false;
+   }
+
+   printf("success: strnlen\n");
return true;
 }
 
@@ -255,13 +320,43 @@
 
 static int test_asprintf(void)
 {
-   /* FIXME */
+   char *x;
+   printf("test: asprintf\n");
+   if (asprintf(&x, "%d", 9) != 1) {
+   printf("failure: asprintf [\ngenerate asprintf\n]\n");
+   return false;
+   }
+   if (strcmp(x, "9") != 0) {
+   printf("failure: asprintf [\ngenerate asprintf\n]\n");
+   return false;
+   }
+   if (asprintf(&x, "dat%s", "a") != 4) {
+   printf("failure: asprintf [\ngenerate asprintf\n]\n");
+   return false;
+   }
+   if (strcmp(x, "data") != 0) {
+   printf("failure: asprintf [\ngenerate asprintf\n]\n");
+   return false;
+   }
+   printf("success: asprintf\n");
return true;
 }
 
 static int test_snprintf(void)
 {
-   /* FIXME */
+   char tmp[10];
+   printf("test: snprintf\n");
+   if (snprintf(tmp, 3, "foo%d", 9) != 4) {
+   printf("failure: snprintf [\nsnprintf return code failed\n]\n");
+   return false;
+   }
+
+   if (strcmp(tmp, "fo") != 0) {
+   printf("failure: snprintf [\nsnprintf failed\n]\n");
+   return false;
+   }
+
+   printf("success: snprintf\n");
return true;
 }
 
@@ -328,13 +423,22 @@
 
 static int test_strerror(void)
 {
+   printf("test: strerror\n");
/* FIXME */
+   printf("failure: sterror\n");
return true;
 }
 
 static int test_errno(void)
 {
-   /* FIXME */
+   printf("test: errno\n");
+   errno = 3;
+   if (errno != 3) {
+   printf("failure: errno [\nerrno failed\n]\n");
+   return false;
+   }
+
+   printf("success: errno\n");
return true;
 }
 
@@ -376

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

2007-04-12 Thread jra
Author: jra
Date: 2007-04-12 19:16:29 + (Thu, 12 Apr 2007)
New Revision: 22202

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

Log:
Volker is clever :-). Use TDB_NOMMAP to prevent any wild pointer
problems when validating the winbindd cache. Wish I'd have
thought of that.
Jeremy.

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


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c 2007-04-12 15:06:24 UTC 
(rev 22201)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c 2007-04-12 19:16:29 UTC 
(rev 22202)
@@ -2790,9 +2790,12 @@
goto out;
}
 
+   /* Doh ! Volker is very smart :-). Use TDB_NOMMAP to prevent
+* any wild pointer references when reading a corrupt tdb file. */
+
tdb = tdb_open_log(cache_path,
WINBINDD_CACHE_TDB_DEFAULT_HASH_SIZE,
-   lp_winbind_offline_logon() ? TDB_DEFAULT : (TDB_DEFAULT 
| TDB_CLEAR_IF_FIRST),
+   lp_winbind_offline_logon() ? TDB_NOMMAP : (TDB_NOMMAP | 
TDB_CLEAR_IF_FIRST),
O_RDWR|O_CREAT, 0600);
if (!tdb) {
goto out;



Rev 11830: Initial work on a 'member' test environment'. in file:///home/jelmer/bzr.samba/SAMBA_4_0/

2007-04-12 Thread Jelmer Vernooij
At file:///home/jelmer/bzr.samba/SAMBA_4_0/


revno: 11830
revision-id: [EMAIL PROTECTED]
parent: svn-v2:[EMAIL PROTECTED]
committer: Jelmer Vernooij <[EMAIL PROTECTED]>
branch nick: SAMBA_4_0
timestamp: Thu 2007-04-12 11:32:57 +0200
message:
  Initial work on a 'member' test environment'.
added:
  source/script/tests/mktestmember.sh 
mktestmember.sh-20070411003717-p8x9y5ayzsne0151-2
  source/script/tests/test_member.sh 
test_member.sh-20070411003717-p8x9y5ayzsne0151-1
modified:
  source/script/tests/README svn-v2:[EMAIL PROTECTED]
  source/script/tests/Samba4.pm  svn-v2:[EMAIL PROTECTED]
  source/script/tests/TODO   svn-v2:[EMAIL PROTECTED]
=== added file 'source/script/tests/mktestmember.sh'
--- a/source/script/tests/mktestmember.sh   1970-01-01 00:00:00 +
+++ b/source/script/tests/mktestmember.sh   2007-04-12 09:32:57 +
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+if [ $# -lt 4 ]
+then
+   echo "$0 PREFIX DOMAIN USERNAME PASSWORD"
+   exit 1
+fi
+
+PREFIX=$1
+DOMAIN=$2
+DC_USERNAME=$3
+DC_PASSWORD=$4
+shift 4
+USERNAME=administrator
+PASSWORD=humbolt
+
+SRCDIR=`pwd`
+oldpwd=`dirname $0`/../..
+mkdir -p $PREFIX 
+cd $PREFIX
+PREFIX_ABS=`pwd`
+ETCDIR=$PREFIX_ABS/etc
+NCALRPCDIR=$PREFIX_ABS/ncalrpc
+PIDDIR=$PREFIX_ABS/pid
+PRIVATEDIR=$PREFIX_ABS/private
+LOCKDIR=$PREFIX_ABS/lockdir
+WINBINDD_SOCKET_DIR=$PREFIX_ABS/winbind_socket
+CONFFILE=$ETCDIR/smb.conf
+TMPDIR=$PREFIX_ABS/tmp
+NETBIOSNAME=localmember
+SMBD_LOGLEVEL=1
+
+mkdir -p $PRIVATEDIR $ETCDIR $PIDDIR $NCALRPCDIR $LOCKDIR $TMPDIR
+
+cat >$CONFFILE<&2
+
+$srcdir/bin/net join member $DOMAIN -U$DC_USERNAME%$DC_PASSWORD >&2 || {
+   echo "Join failed"
+   exit $?
+}
+
+echo "PREFIX_ABS=$PREFIX_ABS"
+echo "PIDDIR=$PIDDIR"
+echo "SERVER=$SERVER"
+echo "NETBIOSNAME=$NETBIOSNAME"
+echo "DOMAIN=$DOMAIN"
+echo "USERNAME=$USERNAME"
+echo "REALM=$REALM"
+echo "PASSWORD=$PASSWORD"
+echo "SRCDIR=$SRCDIR"
+echo "PREFIX=$PREFIX"
+echo "CONFFILE=$CONFFILE"
+echo "WINBINDD_SOCKET_DIR=$WINBINDD_SOCKET_DIR"
+echo "NCALRPCDIR=$NCALRPCDIR"
+echo "CONFIGURATION=$CONFIGURATION"

=== added file 'source/script/tests/test_member.sh'
--- a/source/script/tests/test_member.sh1970-01-01 00:00:00 +
+++ b/source/script/tests/test_member.sh2007-04-12 09:32:57 +
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# add tests to this list as they start passing, so we test
+# that they stay passing
+ncacn_np_tests="RPC-ECHO"
+
+incdir=`dirname $0`
+. $incdir/test_functions.sh
+
+plantest "RPC-ECHO against member server" member $VALGRIND bin/smbtorture 
$TORTURE_OPTIONS ncacn_np:"\$SERVER" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t 
"$*"

=== modified file 'source/script/tests/README'
--- a/source/script/tests/README2004-09-13 02:37:39 +
+++ b/source/script/tests/README2007-04-12 09:32:57 +
@@ -1,4 +1,13 @@
 This directory contains test scripts that are useful for running a
-bunch of tests all at once. I expect it will eventually be hooked into
-a "make test" framework.
-
+bunch of tests all at once. 
+
+The following environments are currently available:
+
+ - none: No server set up
+ - dc: Domain controller set up. The following environment variables will 
+   be set:
+ * USERNAME
+* PASSWORD
+* DOMAIN
+* REALM
+* SERVER

=== modified file 'source/script/tests/Samba4.pm'
--- a/source/script/tests/Samba4.pm 2007-04-11 10:25:02 +
+++ b/source/script/tests/Samba4.pm 2007-04-12 09:32:57 +
@@ -11,7 +11,7 @@
 
 sub new() {
my ($classname, $bindir, $ldap, $setupdir) = @_;
-   my $self = { ldap => $ldap, bindir => $bindir, setupdir => $setupdir };
+   my $self = { vars => {}, ldap => $ldap, bindir => $bindir, setupdir => 
$setupdir };
bless $self;
return $self;
 }
@@ -135,7 +135,24 @@
system("bin/nmblookup $testenv_vars->{CONFIGURATION} -U 
$testenv_vars->{SERVER} $testenv_vars->{NETBIOSNAME}");
 }
 
-sub provision($$)
+sub provision_member($$$)
+{
+   my ($self, $prefix, $dcvars) = @_;
+   my %ret = ();
+   print "PROVISIONING...";
+   open(IN, "$RealBin/mktestmember.sh $prefix $dcvars->{DOMAIN} 
$dcvars->{USERNAME} $dcvars->{PASSWORD}|") or die("Unable to setup");
+   while () {
+   die ("Error parsing `$_'") unless (/^([A-Z0-9a-z_]+)=(.*)$/);
+   $ret{$1} = $2;
+   }
+   close(IN);
+
+   $ret{SMBD_TEST_FIFO} = "$prefix/smbd_test.fifo";
+   $ret{SMBD_TEST_LOG} = "$prefix/smbd_test.log";
+   return \%ret;
+}
+
+sub provision_dc($$)
 {
my ($self, $prefix) = @_;
my %ret = ();
@@ -186,22 +203,42 @@

if ($envname eq "dc") {
return $self->setup_dc("$path/dc");
+   } elsif ($envname eq "member") {
+   if (not defined($self->{vars}->{dc})) {
+   $self->setup_dc("$path/dc");
+   }
+   return $self->setup_member("$path/member

svn commit: samba r22201 - in branches/SAMBA_4_0/source/torture/rpc: .

2007-04-12 Thread metze
Author: metze
Date: 2007-04-12 15:06:24 + (Thu, 12 Apr 2007)
New Revision: 22201

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

Log:
crash fix...

metze
Modified:
   branches/SAMBA_4_0/source/torture/rpc/unixinfo.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/rpc/unixinfo.c
===
--- branches/SAMBA_4_0/source/torture/rpc/unixinfo.c2007-04-12 14:56:29 UTC 
(rev 22200)
+++ branches/SAMBA_4_0/source/torture/rpc/unixinfo.c2007-04-12 15:06:24 UTC 
(rev 22201)
@@ -33,9 +33,11 @@
NTSTATUS status;
struct unixinfo_SidToUid r;
struct dom_sid *sid;
+   uint64_t uid;

sid = dom_sid_parse_talloc(tctx, "S-1-5-32-1234-5432");
r.in.sid = *sid;
+   r.out.uid = &uid;
 
status = dcerpc_unixinfo_SidToUid(p, tctx, &r);
if (NT_STATUS_EQUAL(NT_STATUS_NONE_MAPPED, status)) {
@@ -94,9 +96,11 @@
NTSTATUS status;
struct unixinfo_SidToGid r;
struct dom_sid *sid;
+   uint64_t gid;
 
sid = dom_sid_parse_talloc(tctx, "S-1-5-32-1234-5432");
r.in.sid = *sid;
+   r.out.gid = &gid;
 
status = dcerpc_unixinfo_SidToGid(p, tctx, &r);
if (NT_STATUS_EQUAL(NT_STATUS_NONE_MAPPED, status)) {



svn commit: samba r22200 - in branches/SAMBA_4_0/source/ntvfs: .

2007-04-12 Thread metze
Author: metze
Date: 2007-04-12 14:56:29 + (Thu, 12 Apr 2007)
New Revision: 22200

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

Log:
make ntvfs a subsystem as linking ntvfs.so.1 uses
ca. 800 cmdline args to ld and that fails on some hosts
in the build-farm, lets see if they will be happier now

metze
Modified:
   branches/SAMBA_4_0/source/ntvfs/config.mk


Changeset:
Modified: branches/SAMBA_4_0/source/ntvfs/config.mk
===
--- branches/SAMBA_4_0/source/ntvfs/config.mk   2007-04-12 13:36:49 UTC (rev 
22199)
+++ branches/SAMBA_4_0/source/ntvfs/config.mk   2007-04-12 14:56:29 UTC (rev 
22200)
@@ -79,11 +79,11 @@
 
 
 # Start SUBSYSTEM NTVFS
-[LIBRARY::ntvfs]
+[SUBSYSTEM::ntvfs]
 PUBLIC_HEADERS = ntvfs.h
-VERSION = 0.0.1
-SO_VERSION = 0
-DESCRIPTION = Virtual File System with NTFS semantics
+#VERSION = 0.0.1
+#SO_VERSION = 0
+#DESCRIPTION = Virtual File System with NTFS semantics
 PRIVATE_PROTO_HEADER = ntvfs_proto.h
 OBJ_FILES = \
ntvfs_base.o \



Rev 5353: forgot to check in privileges.h in http://samba.sernet.de/ma/bzr/SAMBA_3_0-registry.bzr/

2007-04-12 Thread Michael Adam
At http://samba.sernet.de/ma/bzr/SAMBA_3_0-registry.bzr/


revno: 5353
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Michael Adam <[EMAIL PROTECTED]>
branch nick: SAMBA_3_0-registry.bzr
timestamp: Thu 2007-04-12 16:17:00 +0200
message:
  forgot to check in privileges.h
modified:
  source/include/privileges.hprivileges.h-20060530022627-81fe81098d4b2cee
=== modified file 'source/include/privileges.h'
--- a/source/include/privileges.h   2006-09-21 15:46:20 +
+++ b/source/include/privileges.h   2007-04-12 14:17:00 +
@@ -61,7 +61,9 @@
 #define SE_RESTORE { { 0x0400, 0x, 0x, 
0x } }
 #define SE_TAKE_OWNERSHIP  { { 0x0800, 0x, 0x, 
0x } }
 
-/* defined in lib/privilegs.c */
+/* defined in lib/privilegs_basic.c */
+
+extern const SE_PRIV se_priv_all;
 
 extern const SE_PRIV se_priv_none;
 extern const SE_PRIV se_machine_account;



Rev 5352: refactoring: split lib/profiles.c into two parts. lib/profiles_basic.c in http://samba.sernet.de/ma/bzr/SAMBA_3_0-registry.bzr/

2007-04-12 Thread Michael Adam
At http://samba.sernet.de/ma/bzr/SAMBA_3_0-registry.bzr/


revno: 5352
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Michael Adam <[EMAIL PROTECTED]>
branch nick: SAMBA_3_0-registry.bzr
timestamp: Thu 2007-04-12 16:14:00 +0200
message:
  refactoring: split lib/profiles.c into two parts. lib/profiles_basic.c
  takes all the low level mask manipulation and format conversion functions
  (se_priv, privset, luid). the privs array is completely hidden from
  profiles.c by adding some access-functions. some mask-functions are not 
  static anymore.
  
  generally, SID- and LUID-related stuff is kept in lib/profiles.c
  
  This is to minimize linker dependencies in preparation for the
  upcoming integration of global registry options into loadparm.
added:
  source/lib/privileges_basic.c  
privileges_basic.c-20070412140750-pro2zmd8rfupsdup-1
modified:
  source/Makefile.in Makefile.in-20060530022626-b16dac2328ebe703
  source/lib/privileges.cprivileges.c-20060530022627-dcf14febf91e0143

Diff too large for email (1116 lines, the limit is 1000).


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

2007-04-12 Thread metze
Author: metze
Date: 2007-04-12 13:36:49 + (Thu, 12 Apr 2007)
New Revision: 22199

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

Log:
fix typo

metze
Modified:
   branches/SAMBA_4_0/source/auth/gensec/gensec_gssapi.c


Changeset:
Modified: branches/SAMBA_4_0/source/auth/gensec/gensec_gssapi.c
===
--- branches/SAMBA_4_0/source/auth/gensec/gensec_gssapi.c   2007-04-12 
13:08:22 UTC (rev 22198)
+++ branches/SAMBA_4_0/source/auth/gensec/gensec_gssapi.c   2007-04-12 
13:36:49 UTC (rev 22199)
@@ -106,7 +106,7 @@
 }
 
 
-static int gensec_gssapi_destory(struct gensec_gssapi_state 
*gensec_gssapi_state)
+static int gensec_gssapi_destructor(struct gensec_gssapi_state 
*gensec_gssapi_state)
 {
OM_uint32 maj_stat, min_stat;

@@ -178,7 +178,7 @@
 
gensec_gssapi_state->delegated_cred_handle = GSS_C_NO_CREDENTIAL;
 
-   talloc_set_destructor(gensec_gssapi_state, gensec_gssapi_destory); 
+   talloc_set_destructor(gensec_gssapi_state, gensec_gssapi_destructor);
 
if (gensec_security->want_features & GENSEC_FEATURE_SIGN) {
gensec_gssapi_state->want_flags |= GSS_C_INTEG_FLAG;



svn commit: samba r22198 - in branches/SAMBA_4_0/source/torture: ndr unix

2007-04-12 Thread metze
Author: metze
Date: 2007-04-12 13:08:22 + (Thu, 12 Apr 2007)
New Revision: 22198

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

Log:
ignore generated files

metze
Modified:
   branches/SAMBA_4_0/source/torture/ndr/
   branches/SAMBA_4_0/source/torture/unix/


Changeset:

Property changes on: branches/SAMBA_4_0/source/torture/ndr
___
Name: svn:ignore
   + proto.h
*.d



Property changes on: branches/SAMBA_4_0/source/torture/unix
___
Name: svn:ignore
   + proto.h
*.d



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

2007-04-12 Thread metze
Author: metze
Date: 2007-04-12 12:45:41 + (Thu, 12 Apr 2007)
New Revision: 22197

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

Log:
fix formating

metze
Modified:
   branches/SAMBA_4_0/source/script/tests/Samba4.pm
   branches/SAMBA_4_0/source/script/tests/selftest.pl


Changeset:
Modified: branches/SAMBA_4_0/source/script/tests/Samba4.pm
===
--- branches/SAMBA_4_0/source/script/tests/Samba4.pm2007-04-12 12:38:32 UTC 
(rev 22196)
+++ branches/SAMBA_4_0/source/script/tests/Samba4.pm2007-04-12 12:45:41 UTC 
(rev 22197)
@@ -18,7 +18,7 @@
 
 sub slapd_start($$)
 {
-my $count = 0;
+   my $count = 0;
my ($self, $env_vars) = @_;
 
my $conf = $env_vars->{SLAPD_CONF};
@@ -172,7 +172,7 @@
 sub provision_ldap($$)
 {
my ($self, $envvars) = @_;
-system("$self->{bindir}/smbscript $self->{setupdir}/provision 
$envvars->{PROVISION_OPTIONS} \"$envvars->{PROVISION_ACI}\" 
--ldap-backend=$envvars->{LDAP_URI}") and
+   system("$self->{bindir}/smbscript $self->{setupdir}/provision 
$envvars->{PROVISION_OPTIONS} \"$envvars->{PROVISION_ACI}\" 
--ldap-backend=$envvars->{LDAP_URI}") and
die("LDAP PROVISIONING failed: $self->{bindir}/smbscript 
$self->{setupdir}/provision $envvars->{PROVISION_OPTIONS} 
\"$envvars->{PROVISION_ACI}\" --ldap-backend=$envvars->{LDAP_URI}");
 }
 

Modified: branches/SAMBA_4_0/source/script/tests/selftest.pl
===
--- branches/SAMBA_4_0/source/script/tests/selftest.pl  2007-04-12 12:38:32 UTC 
(rev 22196)
+++ branches/SAMBA_4_0/source/script/tests/selftest.pl  2007-04-12 12:45:41 UTC 
(rev 22197)
@@ -321,7 +321,7 @@
 }
 
 my $result = GetOptions (
-   'help|h|?' => \$opt_help,
+   'help|h|?' => \$opt_help,
'target=s' => \$opt_target,
'prefix=s' => \$prefix,
'socket-wrapper' => \$opt_socket_wrapper,
@@ -349,7 +349,7 @@
 # quick hack to disable rpc validation when using valgrind - its way too slow
 unless (defined($ENV{VALGRIND})) {
$ENV{VALIDATE} = "validate";
-$ENV{MALLOC_CHECK_} = 2;
+   $ENV{MALLOC_CHECK_} = 2;
 }
 
 my $old_pwd = "$RealBin/../..";
@@ -434,11 +434,11 @@
 }
 
 my $interfaces = join(',', ("127.0.0.6/8", 
-"127.0.0.7/8",
-"127.0.0.8/8",
-"127.0.0.9/8",
-"127.0.0.10/8",
-"127.0.0.11/8"));
+   "127.0.0.7/8",
+   "127.0.0.8/8",
+   "127.0.0.9/8",
+   "127.0.0.10/8",
+   "127.0.0.11/8"));
 
 my $conffile = "$prefix/client.conf";
 
@@ -463,9 +463,7 @@
} else {
print CF "\ticonv:native = false\n";
}
-   print CF 
-"  netbios name = client
-";
+   print CF "\tnetbios name = client\n";
if (defined($vars->{DOMAIN})) {
print CF "\tworkgroup = $vars->{DOMAIN}\n";
}



svn commit: samba r22196 - in branches/SAMBA_4_0/source/dsdb/common: .

2007-04-12 Thread metze
Author: metze
Date: 2007-04-12 12:38:32 + (Thu, 12 Apr 2007)
New Revision: 22196

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

Log:
give better error codes to make RPC-UNIXINFO pass

metze
Modified:
   branches/SAMBA_4_0/source/dsdb/common/sidmap.c


Changeset:
Modified: branches/SAMBA_4_0/source/dsdb/common/sidmap.c
===
--- branches/SAMBA_4_0/source/dsdb/common/sidmap.c  2007-04-12 11:59:38 UTC 
(rev 22195)
+++ branches/SAMBA_4_0/source/dsdb/common/sidmap.c  2007-04-12 12:38:32 UTC 
(rev 22196)
@@ -211,7 +211,7 @@
 dom_sid_string(tmp_ctx, sid)));
 
talloc_free(tmp_ctx);
-   return NT_STATUS_INVALID_SID;
+   return NT_STATUS_NONE_MAPPED;
 }
 
 
@@ -344,7 +344,7 @@
 dom_sid_string(tmp_ctx, sid)));
 
talloc_free(tmp_ctx);
-   return NT_STATUS_INVALID_SID;
+   return NT_STATUS_NONE_MAPPED;
 }
 
 
@@ -426,7 +426,7 @@
*/
 allocate_sid:
if (uid > SIDMAP_MAX_LOCAL_UID) {
-   return NT_STATUS_INVALID_SID;
+   return NT_STATUS_NONE_MAPPED;
}
 
status = sidmap_primary_domain_sid(sidmap, tmp_ctx, &domain_sid);
@@ -524,7 +524,7 @@
*/
 allocate_sid:
if (gid > SIDMAP_MAX_LOCAL_GID) {
-   return NT_STATUS_INVALID_SID;
+   return NT_STATUS_NONE_MAPPED;
}
 
status = sidmap_primary_domain_sid(sidmap, tmp_ctx, &domain_sid);
@@ -565,14 +565,14 @@
 
if (!dom_sid_in_domain(domain_sid, sid)) {
talloc_free(tmp_ctx);
-   return NT_STATUS_INVALID_SID;
+   return NT_STATUS_NONE_MAPPED;
}
 
talloc_free(tmp_ctx);
 
rid = sid->sub_auths[sid->num_auths-1];
if (rid < SIDMAP_LOCAL_USER_BASE) {
-   return NT_STATUS_INVALID_SID;
+   return NT_STATUS_NONE_MAPPED;
}
 
if (rid < SIDMAP_LOCAL_GROUP_BASE) {



Rev 5351: create a fake user token consisting of builtin administrators sid and in http://samba.sernet.de/ma/bzr/SAMBA_3_0-registry.bzr/

2007-04-12 Thread Michael Adam
At http://samba.sernet.de/ma/bzr/SAMBA_3_0-registry.bzr/


revno: 5351
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Michael Adam <[EMAIL PROTECTED]>
branch nick: SAMBA_3_0-registry.bzr
timestamp: Thu 2007-04-12 14:27:43 +0200
message:
  create a fake user token consisting of builtin administrators sid and
  se_disk_operators privilege by hand instead of using get_root_nt_token()
  to minimize linker deps for bin/net.
  
  * new function registry_create_admin_token() in lib/util_reg.c
  * move dup_nt_token from auth/token_util.c to new file lib/util_nttoken.c
  * adapt net_conf.c and Makefile.in accordingly
added:
  source/lib/util_nttoken.c  
util_nttoken.c-20070412121956-apjs5s3igy1ydc2e-1
modified:
  source/Makefile.in Makefile.in-20060530022626-b16dac2328ebe703
  source/auth/token_util.c   token_util.c-20070409110214-hxmlg8kreyeuci30-1
  source/lib/util_reg.c  util_reg.c-20060711181331-c2d45d0e1f4a8648
  source/utils/net_conf.cnet_conf.c-20070409110216-64p0zt0mes4j6yoe-1
=== added file 'source/lib/util_nttoken.c'
--- a/source/lib/util_nttoken.c 1970-01-01 00:00:00 +
+++ b/source/lib/util_nttoken.c 2007-04-12 12:27:43 +
@@ -0,0 +1,70 @@
+/* 
+ *  Unix SMB/CIFS implementation.
+ *  Authentication utility functions
+ *  Copyright (C) Andrew Tridgell 1992-1998
+ *  Copyright (C) Andrew Bartlett 2001
+ *  Copyright (C) Jeremy Allison 2000-2001
+ *  Copyright (C) Rafal Szczesniak 2002
+ *  Copyright (C) Volker Lendecke 2006
+ *  Copyright (C) Michael Adam 2007
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *  
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *  
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/* function(s) moved from auth/auth_util.c to minimize linker deps */
+
+#include "includes.h"
+
+/
+ Duplicate a SID token.
+/
+
+NT_USER_TOKEN *dup_nt_token(TALLOC_CTX *mem_ctx, const NT_USER_TOKEN *ptoken)
+{
+   NT_USER_TOKEN *token;
+
+   if (!ptoken)
+   return NULL;
+
+   token = TALLOC_P(mem_ctx, NT_USER_TOKEN);
+   if (token == NULL) {
+   DEBUG(0, ("talloc failed\n"));
+   return NULL;
+   }
+
+   ZERO_STRUCTP(token);
+
+   if (ptoken->user_sids && ptoken->num_sids) {
+   token->user_sids = (DOM_SID *)talloc_memdup(
+   token, ptoken->user_sids, sizeof(DOM_SID) * 
ptoken->num_sids );
+
+   if (token->user_sids == NULL) {
+   DEBUG(0, ("talloc_memdup failed\n"));
+   TALLOC_FREE(token);
+   return NULL;
+   }
+   token->num_sids = ptoken->num_sids;
+   }
+   
+   /* copy the privileges; don't consider failure to be critical here */
+   
+   if ( !se_priv_copy( &token->privileges, &ptoken->privileges ) ) {
+   DEBUG(0,("dup_nt_token: Failure to copy SE_PRIV!.  "
+"Continuing with 0 privileges assigned.\n"));
+   }
+
+   return token;
+}
+

=== modified file 'source/Makefile.in'
--- a/source/Makefile.in2007-04-10 10:34:43 +
+++ b/source/Makefile.in2007-04-12 12:27:43 +
@@ -464,6 +464,7 @@
 AUTH_SCRIPT_OBJ = auth/auth_script.o
 
 AUTH_OBJ = auth/auth.o @AUTH_STATIC@ auth/auth_util.o auth/token_util.o \
+  lib/util_nttoken.o \
   auth/auth_compat.o auth/auth_ntlmssp.o \
   $(PLAINTEXT_AUTH_OBJ) $(SLCACHE_OBJ) $(DCUTIL_OBJ)
 
@@ -654,7 +655,7 @@
  registry/reg_perfcount.o \
  registry/reg_dynamic.o \
  \
- auth/token_util.o
+ lib/util_nttoken.o
   
 NET_OBJ = $(NET_OBJ1) $(PARAM_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) \
  $(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ) \

=== modified file 'source/auth/token_util.c'
--- a/source/auth/token_util.c  2007-04-09 11:02:19 +
+++ b/source/auth/token_util.c  2007-04-12 12:27:43 +
@@ -28,47 +28,6 @@
 #include "includes.h"
 
 /
- Duplicate a SID token.
-/
-
-NT_USER_TOKEN *dup_nt_token(TALLOC_CTX *m

svn commit: samba r22195 - in branches/SAMBA_4_0/source/torture/rpc: .

2007-04-12 Thread metze
Author: metze
Date: 2007-04-12 11:59:38 + (Thu, 12 Apr 2007)
New Revision: 22195

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

Log:
fix compiler warnings and convert the whole torture/rpc/unixinfo.c code
to the new torture ui functions

metze
Modified:
   branches/SAMBA_4_0/source/torture/rpc/unixinfo.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/rpc/unixinfo.c
===
--- branches/SAMBA_4_0/source/torture/rpc/unixinfo.c2007-04-12 11:42:09 UTC 
(rev 22194)
+++ branches/SAMBA_4_0/source/torture/rpc/unixinfo.c2007-04-12 11:59:38 UTC 
(rev 22195)
@@ -28,21 +28,18 @@
 /**
   test the SidToUid interface
 */
-static BOOL test_sidtouid(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+static bool test_sidtouid(struct torture_context *tctx, struct dcerpc_pipe *p)
 {
NTSTATUS status;
struct unixinfo_SidToUid r;
struct dom_sid *sid;

-   sid = dom_sid_parse_talloc(mem_ctx, "S-1-5-32-1234-5432");
+   sid = dom_sid_parse_talloc(tctx, "S-1-5-32-1234-5432");
r.in.sid = *sid;
 
-   status = dcerpc_unixinfo_SidToUid(p, mem_ctx, &r);
+   status = dcerpc_unixinfo_SidToUid(p, tctx, &r);
if (NT_STATUS_EQUAL(NT_STATUS_NONE_MAPPED, status)) {
-   } else if (!NT_STATUS_IS_OK(status)) {
-   printf("SidToUid failed == %s\n", nt_errstr(status));
-   return False;
-   }
+   } else torture_assert_ntstatus_ok(tctx, status, "SidToUid failed");
 
return True;
 }
@@ -50,8 +47,7 @@
 /*
   test the UidToSid interface
 */
-static bool test_uidtosid(struct torture_context *tctx, 
- struct dcerpc_pipe *p)
+static bool test_uidtosid(struct torture_context *tctx, struct dcerpc_pipe *p)
 {
struct unixinfo_UidToSid r;
struct dom_sid sid;
@@ -60,13 +56,13 @@
r.out.sid = &sid;
 
torture_assert_ntstatus_ok(tctx, dcerpc_unixinfo_UidToSid(p, tctx, &r), 
-  "UidToSid failed");
+  "UidToSid failed");
 
return true;
 }
 
 static bool test_getpwuid(struct torture_context *tctx, 
- struct dcerpc_pipe *p)
+ struct dcerpc_pipe *p)
 {
uint64_t uids[512];
uint32_t num_uids = ARRAY_SIZE(uids);
@@ -93,40 +89,35 @@
 /*
   test the SidToGid interface
 */
-static BOOL test_sidtogid(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+static bool test_sidtogid(struct torture_context *tctx, struct dcerpc_pipe *p)
 {
NTSTATUS status;
struct unixinfo_SidToGid r;
struct dom_sid *sid;
-   
-   sid = dom_sid_parse_talloc(mem_ctx, "S-1-5-32-1234-5432");
+
+   sid = dom_sid_parse_talloc(tctx, "S-1-5-32-1234-5432");
r.in.sid = *sid;
 
-   status = dcerpc_unixinfo_SidToGid(p, mem_ctx, &r);
+   status = dcerpc_unixinfo_SidToGid(p, tctx, &r);
if (NT_STATUS_EQUAL(NT_STATUS_NONE_MAPPED, status)) {
-   } else if (!NT_STATUS_IS_OK(status)) {
-   printf("SidToGid failed == %s\n", nt_errstr(status));
-   return False;
-   }
+   } else torture_assert_ntstatus_ok(tctx, status, "SidToGid failed");
 
-   return True;
+   return true;
 }
 
 /*
   test the GidToSid interface
 */
-static BOOL test_gidtosid(struct torture_context *tctx, struct dcerpc_pipe *p)
+static bool test_gidtosid(struct torture_context *tctx, struct dcerpc_pipe *p)
 {
-   NTSTATUS status;
struct unixinfo_GidToSid r;
struct dom_sid sid;
 
r.in.gid = 1000;
r.out.sid = &sid;
 
-   status = dcerpc_unixinfo_GidToSid(p, tctx, &r);
-   if (NT_STATUS_EQUAL(NT_STATUS_NO_SUCH_GROUP, status)) {
-   } else torture_assert_ntstatus_ok(tctx, status, "GidToSid failed");
+   torture_assert_ntstatus_ok(tctx, dcerpc_unixinfo_GidToSid(p, tctx, &r), 
+  "GidToSid failed");
 
return true;
 }
@@ -138,10 +129,12 @@
 
suite = torture_suite_create(talloc_autofree_context(), "UNIXINFO");
tcase = torture_suite_add_rpc_iface_tcase(suite, "unixinfo", 
-   
  &dcerpc_table_unixinfo);
+ &dcerpc_table_unixinfo);
 
+   torture_rpc_tcase_add_test(tcase, "sidtouid", test_sidtouid);
torture_rpc_tcase_add_test(tcase, "uidtosid", test_uidtosid);
torture_rpc_tcase_add_test(tcase, "getpwuid", test_getpwuid);
+   torture_rpc_tcase_add_test(tcase, "sidtogid", test_sidtogid);
torture_rpc_tcase_add_test(tcase, "gidtosid", test_gidtosid);
 
return suite;



svn commit: samba r22194 - in branches/SAMBA_4_0/source/torture/rpc: .

2007-04-12 Thread metze
Author: metze
Date: 2007-04-12 11:42:09 + (Thu, 12 Apr 2007)
New Revision: 22194

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

Log:
fix compiler warning and 
compile in but disable NetShareAddSetDel test

metze
Modified:
   branches/SAMBA_4_0/source/torture/rpc/srvsvc.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/rpc/srvsvc.c
===
--- branches/SAMBA_4_0/source/torture/rpc/srvsvc.c  2007-04-12 11:35:00 UTC 
(rev 22193)
+++ branches/SAMBA_4_0/source/torture/rpc/srvsvc.c  2007-04-12 11:42:09 UTC 
(rev 22194)
@@ -525,6 +525,11 @@
int i;
BOOL ret = True;
 
+   if (!lp_parm_bool(-1, "torture", "dangerous", False)) {
+   d_printf("NetShareAddSetDel disabled - enable dangerous tests 
to use\n");
+   return True;
+   }
+
a.in.server_unc = r.in.server_unc = q.in.server_unc = d.in.server_unc =
talloc_asprintf(mem_ctx, "%s", dcerpc_server_name(p));
r.in.share_name = talloc_strdup(mem_ctx, "testshare");
@@ -1047,7 +1052,7 @@
}
}
 
-   talloc_free(r.in.name);
+   talloc_free(name);
 
d_printf("Maximum length for type %2d, flags %08x: %d\n", i, 
r.in.flags, max);
 
@@ -1056,7 +1061,7 @@
invalidc = talloc_strdup(mem_ctx, "");
 
for (n = 0x20; n < 0x7e; n++) {
-   r.in.name = talloc_asprintf(mem_ctx, "%c", (char)n);
+   r.in.name = name = talloc_asprintf(mem_ctx, "%c", 
(char)n);
 
status = dcerpc_srvsvc_NetNameValidate(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
@@ -1069,7 +1074,7 @@
invalidc = talloc_asprintf_append(invalidc, 
"%c", (char)n);
}
 
-   talloc_free(r.in.name);
+   talloc_free(name);
}
 
d_printf(" Invalid chars for type %2d, flags %08x: \"%s\"\n", 
i, r.in.flags, invalidc);
@@ -1115,7 +1120,7 @@
ret &= test_NetRemoteTOD(p, mem_ctx);
ret &= test_NetShareEnum(p, mem_ctx, True);
ret &= test_NetShareGetInfo(p, mem_ctx, "ADMIN$", True);
-/* ret &= test_NetShareAddSetDel(p, mem_ctx); */
+   ret &= test_NetShareAddSetDel(p, mem_ctx);
ret &= test_NetNameValidate(p, mem_ctx);

status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_srvsvc);



svn commit: samba r22193 - in branches/SAMBA_4_0/source/torture/rpc: .

2007-04-12 Thread metze
Author: metze
Date: 2007-04-12 11:35:00 + (Thu, 12 Apr 2007)
New Revision: 22193

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

Log:
fix compiler warning and formating

metze
Modified:
   branches/SAMBA_4_0/source/torture/rpc/wkssvc.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/rpc/wkssvc.c
===
--- branches/SAMBA_4_0/source/torture/rpc/wkssvc.c  2007-04-12 11:24:51 UTC 
(rev 22192)
+++ branches/SAMBA_4_0/source/torture/rpc/wkssvc.c  2007-04-12 11:35:00 UTC 
(rev 22193)
@@ -25,7 +25,7 @@
 #include "torture/rpc/rpc.h"
 
 static bool test_NetWkstaGetInfo(struct torture_context *tctx, 
-struct 
dcerpc_pipe *p)
+struct dcerpc_pipe *p)
 {
NTSTATUS status;
struct wkssvc_NetWkstaGetInfo r;
@@ -38,7 +38,7 @@
 
for (i=0;i

Rev 101: merge from ronnie in http://samba.org/~tridge/ctdb

2007-04-12 Thread tridge

revno: 101
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Andrew Tridgell <[EMAIL PROTECTED]>
branch nick: tridge
timestamp: Thu 2007-04-12 21:32:16 +1000
message:
  merge from ronnie
added:
  tests/ctdb_fetch1.cctdb_fetch1.c-20070412111848-xawz6wqk9r0v8jdk-1
  tests/fetch1.shfetch1.sh-20070412111854-6s84l3myac9ncl79-1
modified:
  Makefile.inmakefile.in-20061117234101-o3qt14umlg9en8z0-1
  common/ctdb_daemon.c   ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1

merged: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Ronnie sahlberg <[EMAIL PROTECTED]>
branch nick: ctdb
timestamp: Thu 2007-04-12 21:19:00 +1000
message:
  add the two missing file from the previous commit

merged: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Ronnie sahlberg <[EMAIL PROTECTED]>
branch nick: ctdb
timestamp: Thu 2007-04-12 21:17:10 +1000
message:
  add a beginning of a new test
  
  right now this test only does one fetch lock   but this will be enhanced 
as more code is added to ctdb to handle fetch_lock and store_unlock

merged: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Ronnie sahlberg <[EMAIL PROTECTED]>
branch nick: ctdb
timestamp: Thu 2007-04-12 21:14:41 +1000
message:
  when sending back a fetch lock reply to a client 
  we cant peek in state->c since this is uninitialized 
  and even if it were not it would be wrong
  
  create a new structure to pass BOTH client and also the reqid to respond 
back to
  the client with

merged: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Ronnie sahlberg <[EMAIL PROTECTED]>
branch nick: ctdb
timestamp: Thu 2007-04-12 17:13:48 +1000
message:
  merge from tridges tree

Diff too large for email (245, the limit is 200).


svn commit: samba r22192 - in branches/SAMBA_4_0/source/torture/rpc: .

2007-04-12 Thread metze
Author: metze
Date: 2007-04-12 11:24:51 + (Thu, 12 Apr 2007)
New Revision: 22192

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

Log:
fix compiler warnings

ClearEventLog test is compiled in but disabled now

metze
Modified:
   branches/SAMBA_4_0/source/torture/rpc/eventlog.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/rpc/eventlog.c
===
--- branches/SAMBA_4_0/source/torture/rpc/eventlog.c2007-04-12 11:23:58 UTC 
(rev 22191)
+++ branches/SAMBA_4_0/source/torture/rpc/eventlog.c2007-04-12 11:24:51 UTC 
(rev 22192)
@@ -77,7 +77,7 @@
dcerpc_eventlog_GetNumRecords(p, tctx, &r), 
"GetNumRecords failed");
 
-   torture_comment(tctx, talloc_asprintf(tctx, "%d records\n", 
*r.out.number));
+   torture_comment(tctx, "%d records\n", *r.out.number);
 
cr.in.handle = cr.out.handle = &handle;
 
@@ -186,12 +186,17 @@
return true;
 }
 
-static bool test_ClearEventLog(struct dcerpc_pipe *p, TALLOC_CTX *tctx)
+static bool test_ClearEventLog(struct torture_context *tctx, 
+  struct dcerpc_pipe *p)
 {
struct eventlog_ClearEventLogW r;
struct eventlog_CloseEventLog cr;
struct policy_handle handle;
 
+   if (!torture_setting_bool(tctx, "dangerous", false)) {
+   torture_skip(tctx, "ClearEventLog test disabled - enable 
dangerous tests to use");
+   }
+
if (!get_policy_handle(tctx, p, &handle))
return false;
 
@@ -236,15 +241,10 @@
 
suite = torture_suite_create(talloc_autofree_context(), "EVENTLOG");
tcase = torture_suite_add_rpc_iface_tcase(suite, "eventlog", 
-   
  &dcerpc_table_eventlog);
+ &dcerpc_table_eventlog);
 
torture_rpc_tcase_add_test(tcase, "OpenEventLog", test_OpenEventLog);
-
-#if 0
-   /* Destructive test */
torture_rpc_tcase_add_test(tcase, "ClearEventLog", test_ClearEventLog);
-#endif
-   
torture_rpc_tcase_add_test(tcase, "GetNumRecords", test_GetNumRecords);
torture_rpc_tcase_add_test(tcase, "ReadEventLog", test_ReadEventLog);
torture_rpc_tcase_add_test(tcase, "FlushEventLog", test_FlushEventLog);



svn commit: samba r22191 - in branches/SAMBA_4_0/source: heimdal heimdal/kuser heimdal/lib/krb5 heimdal_build

2007-04-12 Thread abartlet
Author: abartlet
Date: 2007-04-12 11:23:58 + (Thu, 12 Apr 2007)
New Revision: 22191

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

Log:
Add a samba4kinit binary to the build, so I can test using an existing
ccache, as well as PKINIT.

Andrew Bartlett

Added:
   branches/SAMBA_4_0/source/heimdal/kuser/
   branches/SAMBA_4_0/source/heimdal/kuser/kinit.c
   branches/SAMBA_4_0/source/heimdal/kuser/kuser_locl.h
   branches/SAMBA_4_0/source/heimdal/lib/krb5/convert_creds.c
   branches/SAMBA_4_0/source/heimdal/lib/krb5/prompter_posix.c
   branches/SAMBA_4_0/source/heimdal_build/kafs.h
Modified:
   branches/SAMBA_4_0/source/heimdal_build/config.mk


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


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

2007-04-12 Thread kseeger
Author: kseeger
Date: 2007-04-12 11:20:15 + (Thu, 12 Apr 2007)
New Revision: 1097

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

Log:
Fix typos in idmap_rid manpage.
Modified:
   trunk/manpages-3/idmap_rid.8.xml


Changeset:
Modified: trunk/manpages-3/idmap_rid.8.xml
===
--- trunk/manpages-3/idmap_rid.8.xml2007-04-11 21:50:59 UTC (rev 1096)
+++ trunk/manpages-3/idmap_rid.8.xml2007-04-12 11:20:15 UTC (rev 1097)
@@ -40,8 +40,8 @@
base_rid = INTEGER

Defines the base integer used to build SIDs out of an 
UID or a GID,
-   and to rebase the UID or GID to be obtained froma SID. 
User RIDs
-   by default starts at 1000 (512 hexadecimal), this means 
a good value
+   and to rebase the UID or GID to be obtained from a SID. 
User RIDs
+   by default start at 1000 (512 hexadecimal), this means 
a good value
for base_rid can be 1000 as the resulting ID is 
calculated this way:
ID = RID - BASE_RID + LOW RANGE ID.




svn commit: samba r22190 - in branches/SAMBA_4_0/source/torture/rpc: .

2007-04-12 Thread metze
Author: metze
Date: 2007-04-12 11:02:26 + (Thu, 12 Apr 2007)
New Revision: 22190

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

Log:
fix compiler warnings and remove unused talloc_reference()

metze
Modified:
   branches/SAMBA_4_0/source/torture/rpc/samsync.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/rpc/samsync.c
===
--- branches/SAMBA_4_0/source/torture/rpc/samsync.c 2007-04-12 10:48:30 UTC 
(rev 22189)
+++ branches/SAMBA_4_0/source/torture/rpc/samsync.c 2007-04-12 11:02:26 UTC 
(rev 22190)
@@ -112,7 +112,7 @@
 struct samsync_state {
 /* we remember the sequence numbers so we can easily do a DatabaseDelta */
uint64_t seq_num[3];
-   char *domain_name[2];
+   const char *domain_name[2];
struct samsync_secret *secrets;
struct samsync_trusted_domain *trusted_domains;
struct creds_CredentialState *creds;
@@ -130,14 +130,14 @@
 struct samsync_secret {
struct samsync_secret *prev, *next;
DATA_BLOB secret;
-   char *name;
+   const char *name;
NTTIME mtime;
 };
 
 struct samsync_trusted_domain {
struct samsync_trusted_domain *prev, *next;
 struct dom_sid *sid;
-   char *name;
+   const char *name;
 };
 
 static struct policy_handle *samsync_open_domain(TALLOC_CTX *mem_ctx, 
@@ -324,7 +324,6 @@
}
if (samsync_state->domain_handle[database_id]) {
samsync_state->sid[database_id] = 
talloc_reference(samsync_state, dom_sid);
-   talloc_reference(dom_sid, dom_sid->sub_auths);
}
 
printf("\tsequence_nums[%d/%s]=%llu\n",



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

2007-04-12 Thread metze
Author: metze
Date: 2007-04-12 10:48:30 + (Thu, 12 Apr 2007)
New Revision: 22189

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

Log:
fix compiler warning

metze
Modified:
   branches/SAMBA_4_0/source/torture/raw/search.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/raw/search.c
===
--- branches/SAMBA_4_0/source/torture/raw/search.c  2007-04-12 10:35:21 UTC 
(rev 22188)
+++ branches/SAMBA_4_0/source/torture/raw/search.c  2007-04-12 10:48:30 UTC 
(rev 22189)
@@ -527,7 +527,7 @@
 /*
   callback function for multiple_search
 */
-static BOOL multiple_search_callback(void *private, union smb_search_data 
*file)
+static BOOL multiple_search_callback(void *private, const union 
smb_search_data *file)
 {
struct multiple_result *data = private;
 



svn commit: samba r22188 - in branches/SAMBA_4_0/source/torture/unix: .

2007-04-12 Thread metze
Author: metze
Date: 2007-04-12 10:35:21 + (Thu, 12 Apr 2007)
New Revision: 22188

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

Log:
fix formating bug

metze
Modified:
   branches/SAMBA_4_0/source/torture/unix/unix_info2.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/unix/unix_info2.c
===
--- branches/SAMBA_4_0/source/torture/unix/unix_info2.c 2007-04-12 10:25:01 UTC 
(rev 22187)
+++ branches/SAMBA_4_0/source/torture/unix/unix_info2.c 2007-04-12 10:35:21 UTC 
(rev 22188)
@@ -84,7 +84,7 @@
 */
if ((info2->flags_mask & info2->file_flags) == 0) {
torture_result(torture, TORTURE_FAIL,
-   __location__"%s: UNIX_INFO2 flags field 0x%08x, "
+   __location__": UNIX_INFO2 flags field 0x%08x, "
"does not match mask 0x%08x\n",
info2->file_flags, info2->flags_mask);
}



svn commit: samba r22187 - in branches/SAMBA_4_0: source/auth/credentials source/script/tests testprogs/blackbox

2007-04-12 Thread abartlet
Author: abartlet
Date: 2007-04-12 10:25:01 + (Thu, 12 Apr 2007)
New Revision: 22187

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

Log:
Test kerberos logins in the smbclient blackbox tests, including with a
machine account.

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/auth/credentials/credentials_krb5.c
   branches/SAMBA_4_0/source/script/tests/mktestdc.sh
   branches/SAMBA_4_0/source/script/tests/test_blackbox.sh
   branches/SAMBA_4_0/testprogs/blackbox/test_smbclient.sh


Changeset:
Modified: branches/SAMBA_4_0/source/auth/credentials/credentials_krb5.c
===
--- branches/SAMBA_4_0/source/auth/credentials/credentials_krb5.c   
2007-04-12 10:19:02 UTC (rev 22186)
+++ branches/SAMBA_4_0/source/auth/credentials/credentials_krb5.c   
2007-04-12 10:25:01 UTC (rev 22187)
@@ -248,6 +248,10 @@
 {
krb5_error_code ret;

+   if (cred->machine_account_pending) {
+   cli_credentials_set_machine_account(cred);
+   }
+
if (cred->ccache_obtained >= (MAX(cred->principal_obtained, 
  cred->username_obtained))) {
*ccc = cred->ccache;

Modified: branches/SAMBA_4_0/source/script/tests/mktestdc.sh
===
--- branches/SAMBA_4_0/source/script/tests/mktestdc.sh  2007-04-12 10:19:02 UTC 
(rev 22186)
+++ branches/SAMBA_4_0/source/script/tests/mktestdc.sh  2007-04-12 10:25:01 UTC 
(rev 22187)
@@ -210,6 +210,11 @@
   admin_server = 127.0.0.1:88
   default_domain = $DNSNAME
  }
+ $DNSNAME = {
+  kdc = 127.0.0.1:88
+  admin_server = 127.0.0.1:88
+  default_domain = $DNSNAME
+ }
  $DOMAIN = {
   kdc = 127.0.0.1:88
   admin_server = 127.0.0.1:88

Modified: branches/SAMBA_4_0/source/script/tests/test_blackbox.sh
===
--- branches/SAMBA_4_0/source/script/tests/test_blackbox.sh 2007-04-12 
10:19:02 UTC (rev 22186)
+++ branches/SAMBA_4_0/source/script/tests/test_blackbox.sh 2007-04-12 
10:25:01 UTC (rev 22187)
@@ -16,5 +16,5 @@
 incdir=`dirname $0`
 . $incdir/test_functions.sh
 
-plantest "blackbox.smbclient" dc 
$incdir/../../../testprogs/blackbox/test_smbclient.sh "\$SERVER" "\$USERNAME" 
"\$PASSWORD" "\$DOMAIN" "$PREFIX" "$ADDARGS"
-plantest "blackbox.cifsdd" dc 
$incdir/../../../testprogs/blackbox/test_cifsdd.sh "\$SERVER" "\$USERNAME" 
"\$PASSWORD" "\$DOMAIN" "$ADDARGS"
+plantest "blackbox.smbclient" dc 
$incdir/../../../testprogs/blackbox/test_smbclient.sh "\$NETBIOSNAME" 
"\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" "$ADDARGS"
+plantest "blackbox.cifsdd" dc 
$incdir/../../../testprogs/blackbox/test_cifsdd.sh "\$NETBIOSNAME" "\$USERNAME" 
"\$PASSWORD" "\$DOMAIN" "$ADDARGS"

Modified: branches/SAMBA_4_0/testprogs/blackbox/test_smbclient.sh
===
--- branches/SAMBA_4_0/testprogs/blackbox/test_smbclient.sh 2007-04-12 
10:19:02 UTC (rev 22186)
+++ branches/SAMBA_4_0/testprogs/blackbox/test_smbclient.sh 2007-04-12 
10:25:01 UTC (rev 22187)
@@ -96,8 +96,10 @@
 echo ls | runcmd "List directory with LANMAN1" -m LANMAN1 || failed=`expr 
$failed + 1`
 echo ls | runcmd "List directory with LANMAN2" -m LANMAN2 || failed=`expr 
$failed + 1`
 
-echo ls | testit "Test login with --machine-pass" $VALGRIND bin/smbclient 
$CONFIGURATION //$SERVER/tmp --machine-pass  || failed=`expr $failed + 1`
+echo ls | testit "Test login with --machine-pass without kerberos" $VALGRIND 
bin/smbclient $CONFIGURATION //$SERVER/tmp --machine-pass -k no || failed=`expr 
$failed + 1`
 
+echo ls | testit "Test login with --machine-pass and kerberos" $VALGRIND 
bin/smbclient $CONFIGURATION //$SERVER/tmp --machine-pass -k yes || 
failed=`expr $failed + 1`
+
 (
 echo "password=$PASSWORD"
 echo "username=$USERNAME"



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

2007-04-12 Thread metze
Author: metze
Date: 2007-04-12 10:19:02 + (Thu, 12 Apr 2007)
New Revision: 22186

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

Log:
fix build with autodependencies

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


Changeset:
Modified: branches/SAMBA_4_0/source/build/smb_build/makefile.pm
===
--- branches/SAMBA_4_0/source/build/smb_build/makefile.pm   2007-04-12 
08:33:35 UTC (rev 22185)
+++ branches/SAMBA_4_0/source/build/smb_build/makefile.pm   2007-04-12 
10:19:02 UTC (rev 22186)
@@ -118,7 +118,7 @@
 # Dependencies command
 DEPENDS = \$(CC) -M -MG -MP -MT \$(<:.c=.o) -MT \$@ \\
 `\$(PERL) \$(srcdir)/script/cflags.pl [EMAIL PROTECTED] \\
-\$(CFLAGS) $first_prereq-o \$@
+\$(CFLAGS) $first_prereq -o \$@
 # Dependencies for host objects
 HDEPENDS = \$(CC) -M -MG -MP -MT \$(<:.c=.ho) -MT \$@ \\
 `\$(PERL) \$(srcdir)/script/cflags.pl [EMAIL PROTECTED] \\



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

2007-04-12 Thread jelmer
Author: jelmer
Date: 2007-04-12 08:33:35 + (Thu, 12 Apr 2007)
New Revision: 22185

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

Log:
Initial work on a 'member' test environment'.
Added:
   branches/SAMBA_4_0/source/script/tests/mktestmember.sh
   branches/SAMBA_4_0/source/script/tests/test_member.sh
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/script/tests/README
   branches/SAMBA_4_0/source/script/tests/Samba4.pm
   branches/SAMBA_4_0/source/script/tests/TODO


Changeset:

Property changes on: branches/SAMBA_4_0
___
Name: bzr:merge
...skipped...

Modified: branches/SAMBA_4_0/source/script/tests/README
===
--- branches/SAMBA_4_0/source/script/tests/README   2007-04-12 04:01:42 UTC 
(rev 22184)
+++ branches/SAMBA_4_0/source/script/tests/README   2007-04-12 08:33:35 UTC 
(rev 22185)
@@ -1,4 +1,13 @@
 This directory contains test scripts that are useful for running a
-bunch of tests all at once. I expect it will eventually be hooked into
-a "make test" framework.
+bunch of tests all at once. 
 
+The following environments are currently available:
+
+ - none: No server set up
+ - dc: Domain controller set up. The following environment variables will 
+   be set:
+ * USERNAME
+* PASSWORD
+* DOMAIN
+* REALM
+* SERVER

Modified: branches/SAMBA_4_0/source/script/tests/Samba4.pm
===
--- branches/SAMBA_4_0/source/script/tests/Samba4.pm2007-04-12 04:01:42 UTC 
(rev 22184)
+++ branches/SAMBA_4_0/source/script/tests/Samba4.pm2007-04-12 08:33:35 UTC 
(rev 22185)
@@ -11,7 +11,7 @@
 
 sub new() {
my ($classname, $bindir, $ldap, $setupdir) = @_;
-   my $self = { ldap => $ldap, bindir => $bindir, setupdir => $setupdir };
+   my $self = { vars => {}, ldap => $ldap, bindir => $bindir, setupdir => 
$setupdir };
bless $self;
return $self;
 }
@@ -135,8 +135,25 @@
system("bin/nmblookup $testenv_vars->{CONFIGURATION} -U 
$testenv_vars->{SERVER} $testenv_vars->{NETBIOSNAME}");
 }
 
-sub provision($$)
+sub provision_member($$$)
 {
+   my ($self, $prefix, $dcvars) = @_;
+   my %ret = ();
+   print "PROVISIONING...";
+   open(IN, "$RealBin/mktestmember.sh $prefix $dcvars->{DOMAIN} 
$dcvars->{USERNAME} $dcvars->{PASSWORD}|") or die("Unable to setup");
+   while () {
+   die ("Error parsing `$_'") unless (/^([A-Z0-9a-z_]+)=(.*)$/);
+   $ret{$1} = $2;
+   }
+   close(IN);
+
+   $ret{SMBD_TEST_FIFO} = "$prefix/smbd_test.fifo";
+   $ret{SMBD_TEST_LOG} = "$prefix/smbd_test.log";
+   return \%ret;
+}
+
+sub provision_dc($$)
+{
my ($self, $prefix) = @_;
my %ret = ();
print "PROVISIONING...";
@@ -186,22 +203,42 @@

if ($envname eq "dc") {
return $self->setup_dc("$path/dc");
+   } elsif ($envname eq "member") {
+   if (not defined($self->{vars}->{dc})) {
+   $self->setup_dc("$path/dc");
+   }
+   return $self->setup_member("$path/member", $self->{vars}->{dc});
} else {
-   die("Samba4 can't provide environment $envname");
+   die("Samba4 can't provide environment '$envname'");
}
 }
 
+sub setup_member()
+{
+   my ($self, $path, $dc_vars) = @_;
+
+   my $env = $self->provision_member($path, $dc_vars);
+
+   $self->check_or_start($env, ($ENV{SMBD_MAX_TIME} or 5400));
+
+   $self->wait_for_start($env);
+
+   return $env;
+}
+
 sub setup_dc($$)
 {
my ($self, $path) = @_;
 
-   my $env = $self->provision($path);
+   my $env = $self->provision_dc($path);
 
$self->check_or_start($env, 
($ENV{SMBD_MAX_TIME} or 5400));
 
$self->wait_for_start($env);
 
+   $self->{vars}->{dc} = $env;
+
return $env;
 }
 

Modified: branches/SAMBA_4_0/source/script/tests/TODO
===
--- branches/SAMBA_4_0/source/script/tests/TODO 2007-04-12 04:01:42 UTC (rev 
22184)
+++ branches/SAMBA_4_0/source/script/tests/TODO 2007-04-12 08:33:35 UTC (rev 
22185)
@@ -1,5 +1,3 @@
 - warn about unexpected successes
-- support for environments
 - better way to detect that smbd has finished initialization
-- allow tests to specify what parameters they need
- - UNC / DCERPC binding strings
+- move ldap-specific code into mktestdc.sh

Added: branches/SAMBA_4_0/source/script/tests/mktestmember.sh
===
--- branches/SAMBA_4_0/source/script/tests/mktestmember.sh  2007-04-12 
04:01:42 UTC (rev 22184)
+++ branches/SAMBA_4_0/source/script/tests/mktestmember.sh  2007-04-12 
08:33:35 UTC (rev 22185)
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+if