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

2006-12-14 Thread metze
Author: metze
Date: 2006-12-14 08:23:55 + (Thu, 14 Dec 2006)
New Revision: 20166

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

Log:
we have a dom_sid_add_rid() function that adds the rid after allocating
enough memory for the new sub_auth element.

the old version wrote behind the buffer.

also make the output sid a pointer.

metze
Modified:
   branches/SAMBA_4_0/source/libnet/libnet_lookup.c
   branches/SAMBA_4_0/source/libnet/libnet_lookup.h


Changeset:
Modified: branches/SAMBA_4_0/source/libnet/libnet_lookup.c
===
--- branches/SAMBA_4_0/source/libnet/libnet_lookup.c2006-12-14 01:00:16 UTC 
(rev 20165)
+++ branches/SAMBA_4_0/source/libnet/libnet_lookup.c2006-12-14 08:23:55 UTC 
(rev 20166)
@@ -406,13 +406,12 @@
 
if (NT_STATUS_IS_OK(status)) {
s = talloc_get_type(c-private_data, struct lookup_name_state);
-   
-   ZERO_STRUCT(io-out.domain_sid);
+
io-out.rid = 0;
+   io-out.sid = NULL;
io-out.sidstr = NULL;
 
if (*s-lookup.out.count  0) {
-   int num_auths;
struct lsa_RefDomainList *domains = 
s-lookup.out.domains;
struct lsa_TransSidArray *sids = s-lookup.out.sids;
 
@@ -421,15 +420,13 @@
if (sids-count  0) {
io-out.rid= sids-sids[0].rid;
io-out.sid_type   = sids-sids[0].sid_type;
+   if (domains-count  0) {
+   io-out.sid = dom_sid_add_rid(mem_ctx, 
domains-domains[0].sid, io-out.rid);
+   NT_STATUS_HAVE_NO_MEMORY(io-out.sid);
+   io-out.sidstr = 
dom_sid_string(mem_ctx, io-out.sid);
+   
NT_STATUS_HAVE_NO_MEMORY(io-out.sidstr);
+   }
}
-
-   if (domains-count  0) {
-   io-out.domain_sid = *domains-domains[0].sid;
-   num_auths = io-out.domain_sid.num_auths++;
-   io-out.domain_sid.sub_auths[num_auths] = 
io-out.rid;
-
-   io-out.sidstr = dom_sid_string(mem_ctx, 
io-out.domain_sid);
-   }
}
 
io-out.error_string = talloc_strdup(mem_ctx, Success);
@@ -438,6 +435,7 @@
io-out.error_string = talloc_asprintf(mem_ctx, Error: %s, 
nt_errstr(status));
}
 
+   talloc_free(c);
return status;
 }
 

Modified: branches/SAMBA_4_0/source/libnet/libnet_lookup.h
===
--- branches/SAMBA_4_0/source/libnet/libnet_lookup.h2006-12-14 01:00:16 UTC 
(rev 20165)
+++ branches/SAMBA_4_0/source/libnet/libnet_lookup.h2006-12-14 08:23:55 UTC 
(rev 20166)
@@ -49,7 +49,7 @@
const char *domain_name;
} in;
struct {
-   struct dom_sid domain_sid;
+   struct dom_sid *sid;
int rid;
enum lsa_SidType sid_type;
const char *sidstr;



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

2006-12-14 Thread metze
Author: metze
Date: 2006-12-14 08:25:24 + (Thu, 14 Dec 2006)
New Revision: 20167

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

Log:
reenable the ejsnet tests

metze
Modified:
   branches/SAMBA_4_0/source/script/tests/test_ejs.sh


Changeset:
Modified: branches/SAMBA_4_0/source/script/tests/test_ejs.sh
===
--- branches/SAMBA_4_0/source/script/tests/test_ejs.sh  2006-12-14 08:23:55 UTC 
(rev 20166)
+++ branches/SAMBA_4_0/source/script/tests/test_ejs.sh  2006-12-14 08:25:24 UTC 
(rev 20167)
@@ -27,7 +27,7 @@
 testit $f $SCRIPTDIR/$f $CONFIGURATION ncalrpc: -U$USERNAME%$PASSWORD || 
failed=`expr $failed + 1`
 done
 
-#testit ejsnet.js $SCRIPTDIR/ejsnet.js $CONFIGURATION -U$USERNAME%$PASSWORD 
$DOMAIN ejstestuser || failed=`expr $failed + 1`
+testit ejsnet.js $SCRIPTDIR/ejsnet.js $CONFIGURATION -U$USERNAME%$PASSWORD 
$DOMAIN ejstestuser || failed=`expr $failed + 1`
 
 testit ldb.js $SCRIPTDIR/ldb.js `pwd` $CONFIGURATION || failed=`expr $failed 
+ 1`
 



svn commit: samba r20168 - in branches/SAMBA_4_0/source/lib/ldb: common include ldb_tdb

2006-12-14 Thread metze
Author: metze
Date: 2006-12-14 10:03:21 + (Thu, 14 Dec 2006)
New Revision: 20168

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

Log:
start separating attributes and syntaxes

metze
Modified:
   branches/SAMBA_4_0/source/lib/ldb/common/attrib_handlers.c
   branches/SAMBA_4_0/source/lib/ldb/common/ldb_attributes.c
   branches/SAMBA_4_0/source/lib/ldb/include/ldb.h
   branches/SAMBA_4_0/source/lib/ldb/include/ldb_private.h
   branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_cache.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/common/attrib_handlers.c
===
--- branches/SAMBA_4_0/source/lib/ldb/common/attrib_handlers.c  2006-12-14 
08:25:24 UTC (rev 20167)
+++ branches/SAMBA_4_0/source/lib/ldb/common/attrib_handlers.c  2006-12-14 
10:03:21 UTC (rev 20168)
@@ -336,50 +336,44 @@
 /*
   table of standard attribute handlers
 */
-static const struct ldb_attrib_handler ldb_standard_attribs[] = {
+static const struct ldb_schema_syntax ldb_standard_syntaxes[] = {
{ 
-   .attr= LDB_SYNTAX_INTEGER,
-   .flags   = 0,
+   .name= LDB_SYNTAX_INTEGER,
.ldif_read_fn= ldb_handler_copy,
.ldif_write_fn   = ldb_handler_copy,
.canonicalise_fn = ldb_canonicalise_Integer,
.comparison_fn   = ldb_comparison_Integer
},
{ 
-   .attr= LDB_SYNTAX_OCTET_STRING,
-   .flags   = 0,
+   .name= LDB_SYNTAX_OCTET_STRING,
.ldif_read_fn= ldb_handler_copy,
.ldif_write_fn   = ldb_handler_copy,
.canonicalise_fn = ldb_handler_copy,
.comparison_fn   = ldb_comparison_binary
},
{ 
-   .attr= LDB_SYNTAX_DIRECTORY_STRING,
-   .flags   = 0,
+   .name= LDB_SYNTAX_DIRECTORY_STRING,
.ldif_read_fn= ldb_handler_copy,
.ldif_write_fn   = ldb_handler_copy,
.canonicalise_fn = ldb_handler_fold,
.comparison_fn   = ldb_comparison_fold
},
{ 
-   .attr= LDB_SYNTAX_DN,
-   .flags   = 0,
+   .name= LDB_SYNTAX_DN,
.ldif_read_fn= ldb_handler_copy,
.ldif_write_fn   = ldb_handler_copy,
.canonicalise_fn = ldb_canonicalise_dn,
.comparison_fn   = ldb_comparison_dn
},
{ 
-   .attr= LDB_SYNTAX_OBJECTCLASS,
-   .flags   = 0,
+   .name= LDB_SYNTAX_OBJECTCLASS,
.ldif_read_fn= ldb_handler_copy,
.ldif_write_fn   = ldb_handler_copy,
.canonicalise_fn = ldb_handler_fold,
.comparison_fn   = ldb_comparison_objectclass
},
{ 
-   .attr= LDB_SYNTAX_UTC_TIME,
-   .flags   = 0,
+   .name= LDB_SYNTAX_UTC_TIME,
.ldif_read_fn= ldb_handler_copy,
.ldif_write_fn   = ldb_handler_copy,
.canonicalise_fn = ldb_canonicalise_utctime,
@@ -391,17 +385,16 @@
 /*
   return the attribute handlers for a given syntax name
 */
-const struct ldb_attrib_handler *ldb_attrib_handler_syntax(struct ldb_context 
*ldb,
-  const char *syntax)
+const struct ldb_schema_syntax *ldb_standard_syntax_by_name(struct ldb_context 
*ldb,
+   const char *syntax)
 {
int i;
-   unsigned num_handlers = 
sizeof(ldb_standard_attribs)/sizeof(ldb_standard_attribs[0]);
+   unsigned num_handlers = 
sizeof(ldb_standard_syntaxes)/sizeof(ldb_standard_syntaxes[0]);
/* TODO: should be replaced with a binary search */
for (i=0;inum_handlers;i++) {
-   if (strcmp(ldb_standard_attribs[i].attr, syntax) == 0) {
-   return ldb_standard_attribs[i];
+   if (strcmp(ldb_standard_syntaxes[i].name, syntax) == 0) {
+   return ldb_standard_syntaxes[i];
}
}
return NULL;
 }
-

Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_attributes.c
===
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_attributes.c   2006-12-14 
08:25:24 UTC (rev 20167)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_attributes.c   2006-12-14 
10:03:21 UTC (rev 20168)
@@ -149,15 +149,20 @@
 int ldb_set_attrib_handler_syntax(struct ldb_context *ldb, 
  const char *attr, const char *syntax)
 {
-   const struct ldb_attrib_handler *h = ldb_attrib_handler_syntax(ldb, 
syntax);
-  

svn commit: lorikeet r690 - in trunk/heimdal/lib/gssapi/krb5: .

2006-12-14 Thread lha
Author: lha
Date: 2006-12-14 11:01:35 + (Thu, 14 Dec 2006)
New Revision: 690

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

Log:
(GSS_KRB5_SET_DEFAULT_REALM_X): don't fail on success.
Bug report from Stefan Metzmacher.

Modified:
   trunk/heimdal/lib/gssapi/krb5/set_sec_context_option.c


Changeset:
Modified: trunk/heimdal/lib/gssapi/krb5/set_sec_context_option.c
===
--- trunk/heimdal/lib/gssapi/krb5/set_sec_context_option.c  2006-12-12 
23:45:23 UTC (rev 689)
+++ trunk/heimdal/lib/gssapi/krb5/set_sec_context_option.c  2006-12-14 
11:01:35 UTC (rev 690)
@@ -129,7 +129,7 @@
return GSS_S_CALL_INACCESSIBLE_READ;
}
str = malloc(value-length + 1);
-   if (str) {
+   if (str == NULL) {
*minor_status = 0;
return GSS_S_UNAVAILABLE;
}



svn commit: lorikeet r692 - in trunk/heimdal/lib/krb5: .

2006-12-14 Thread lha
Author: lha
Date: 2006-12-14 11:03:45 + (Thu, 14 Dec 2006)
New Revision: 692

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

Log:
(free_paid): free the krb5_data structure too.
Bug report from Stefan Metzmacher.

Modified:
   trunk/heimdal/lib/krb5/init_creds_pw.c


Changeset:
Modified: trunk/heimdal/lib/krb5/init_creds_pw.c
===
--- trunk/heimdal/lib/krb5/init_creds_pw.c  2006-12-14 11:01:49 UTC (rev 
691)
+++ trunk/heimdal/lib/krb5/init_creds_pw.c  2006-12-14 11:03:45 UTC (rev 
692)
@@ -656,7 +656,7 @@
 {
 krb5_free_salt(context, ppaid-salt);
 if (ppaid-s2kparams)
-   krb5_data_free(ppaid-s2kparams);
+   krb5_free_data(context, ppaid-s2kparams);
 }
 
 



svn commit: samba r20169 - in branches/SAMBA_3_0/source: auth passdb

2006-12-14 Thread idra
Author: idra
Date: 2006-12-14 15:30:54 + (Thu, 14 Dec 2006)
New Revision: 20169

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

Log:

Support for fallback to legacy mapping code was not completely tested.
Add necessary fixes.


Modified:
   branches/SAMBA_3_0/source/auth/auth_util.c
   branches/SAMBA_3_0/source/passdb/lookup_sid.c


Changeset:
Modified: branches/SAMBA_3_0/source/auth/auth_util.c
===
--- branches/SAMBA_3_0/source/auth/auth_util.c  2006-12-14 10:03:21 UTC (rev 
20168)
+++ branches/SAMBA_3_0/source/auth/auth_util.c  2006-12-14 15:30:54 UTC (rev 
20169)
@@ -984,6 +984,7 @@
TALLOC_CTX *mem_ctx;
struct id_map *ids;
NTSTATUS status;
+   BOOL wb = True;
size_t i;

 
@@ -1037,20 +1038,33 @@
 
if (!winbind_sids_to_unixids(ids, server_info-ptok-num_sids-1)) {
DEBUG(2, (Query to map secondary SIDs failed!\n));
+   if (!winbind_ping()) {
+   DEBUG(2, (Winbindd is not running, will try to map 
SIDs one by one with legacy code\n));
+   wb = False;
+   }
}
 
for (i = 0; i  server_info-ptok-num_sids-1; i++) {
-   if ( ! ids[i].mapped) {
-   DEBUG(10, (Could not convert SID %s to gid, 
-  ignoring it\n, 
sid_string_static(ids[i].sid)));
-   continue;
+   gid_t agid;
+
+   if (wb) {
+   if ( ! ids[i].mapped) {
+   DEBUG(10, (Could not convert SID %s to gid, 
+  ignoring it\n, 
sid_string_static(ids[i].sid)));
+   continue;
+   }
+   if (ids[i].xid.type == ID_TYPE_UID) {
+   DEBUG(10, (SID %s is a User ID (%u) not a 
Group ID, 
+  ignoring it\n, 
sid_string_static(ids[i].sid), ids[i].xid.id));
+   continue;
+   }
+   agid = (gid_t)ids[i].xid.id;
+   } else {
+   if (! sid_to_gid(ids[i].sid, agid)) {
+   continue;
+   }
}
-   if ( ! ids[i].xid.type == ID_TYPE_UID) {
-   DEBUG(10, (SID %s is a User ID (%u) not a Group ID, 
-  ignoring it\n, 
sid_string_static(ids[i].sid), ids[i].xid.id));
-   continue;
-   }
-   if (!add_gid_to_array_unique(server_info, (gid_t)ids[i].xid.id, 
server_info-groups,
+   if (!add_gid_to_array_unique(server_info, agid, 
server_info-groups,
server_info-n_groups)) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;

Modified: branches/SAMBA_3_0/source/passdb/lookup_sid.c
===
--- branches/SAMBA_3_0/source/passdb/lookup_sid.c   2006-12-14 10:03:21 UTC 
(rev 20168)
+++ branches/SAMBA_3_0/source/passdb/lookup_sid.c   2006-12-14 15:30:54 UTC 
(rev 20169)
@@ -1141,6 +1141,7 @@
DEBUG(10,(LEGACY: uid %u - sid %s\n, (unsigned int)uid,
  sid_string_static(psid)));
 
+   store_uid_sid_cache(psid, uid);
return;
 }
 
@@ -1171,6 +1172,7 @@
DEBUG(10,(LEGACY: gid %u - sid %s\n, (unsigned int)gid,
  sid_string_static(psid)));
 
+   store_gid_sid_cache(psid, gid);
return;
 }
 
@@ -1209,16 +1211,16 @@
}
 
/* This was ours, but it was not mapped.  Fail */
-
-   return False;
}
 
+   DEBUG(10,(LEGACY: mapping failed for sid %s\n, 
sid_string_static(psid)));
return False;
 
- done:
+done:
DEBUG(10,(LEGACY: sid %s - uid %u\n, sid_string_static(psid),
(unsigned int)*puid ));
 
+   store_uid_sid_cache(psid, *puid);
return True;
 }
 
@@ -1252,6 +1254,7 @@
*pgid = map.gid;
goto done;
}
+   DEBUG(10,(LEGACY: mapping failed for sid %s\n, 
sid_string_static(psid)));
return False;
}
 
@@ -1265,7 +1268,7 @@
if (ret) {
if ((type != SID_NAME_DOM_GRP) 
(type != SID_NAME_ALIAS)) {
-   DEBUG(5, (sid %s is a %s, expected a group\n,
+   DEBUG(5, (LEGACY: sid %s is a %s, expected a 
group\n,
  sid_string_static(psid),
  sid_type_lookup(type)));
return False;
@@ -1273,16 +1276,19 @@
*pgid = 

svn commit: samba r20170 - in branches/SAMBA_3_0/source: libaddns utils

2006-12-14 Thread jerry
Author: jerry
Date: 2006-12-14 16:27:45 + (Thu, 14 Dec 2006)
New Revision: 20170

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

Log:
Fix secure DNS updates to work against 
Wnidows 2000 DNS which expects the TKEY payload to 
be in the answer section and not in the additional
set of records (like Windows 2003 and the RFC).


Modified:
   branches/SAMBA_3_0/source/libaddns/dns.h
   branches/SAMBA_3_0/source/libaddns/dnsgss.c
   branches/SAMBA_3_0/source/libaddns/dnsrecord.c
   branches/SAMBA_3_0/source/utils/net_dns.c


Changeset:
Modified: branches/SAMBA_3_0/source/libaddns/dns.h
===
--- branches/SAMBA_3_0/source/libaddns/dns.h2006-12-14 15:30:54 UTC (rev 
20169)
+++ branches/SAMBA_3_0/source/libaddns/dns.h2006-12-14 16:27:45 UTC (rev 
20170)
@@ -280,6 +280,8 @@
 #endif
 
 
+enum dns_ServerType { DNS_SRV_ANY, DNS_SRV_WIN2000, DNS_SRV_WIN2003 };
+
 struct dns_domain_label {
struct dns_domain_label *next;
char *label;
@@ -405,9 +407,6 @@
const char *name,
const in_addr_t *ip,
struct dns_rrec **prec);
-DNS_ERROR dns_create_name_not_in_use_record(TALLOC_CTX *mem_ctx,
-   const char *name, uint32 type,
-   struct dns_rrec **prec);
 DNS_ERROR dns_create_delete_record(TALLOC_CTX *mem_ctx, const char *name,
   uint16 type, uint16 r_class,
   struct dns_rrec **prec);
@@ -484,7 +483,8 @@
 DNS_ERROR dns_negotiate_sec_ctx( const char *target_realm,
 const char *servername,
 const char *keyname,
-gss_ctx_id_t *gss_ctx );
+gss_ctx_id_t *gss_ctx,
+enum dns_ServerType srv_type );
 DNS_ERROR dns_sign_update(struct dns_update_request *req,
  gss_ctx_id_t gss_ctx,
  const char *keyname,
@@ -493,7 +493,8 @@
 DNS_ERROR dns_create_update_request(TALLOC_CTX *mem_ctx,
const char *domainname,
const char *hostname,
-   in_addr_t ip_addr,
+   const in_addr_t *ip_addr,
+   size_t num_adds,
struct dns_update_request **preq);
 
 #endif /* HAVE_GSSAPI_SUPPORT */

Modified: branches/SAMBA_3_0/source/libaddns/dnsgss.c
===
--- branches/SAMBA_3_0/source/libaddns/dnsgss.c 2006-12-14 15:30:54 UTC (rev 
20169)
+++ branches/SAMBA_3_0/source/libaddns/dnsgss.c 2006-12-14 16:27:45 UTC (rev 
20170)
@@ -45,6 +45,7 @@
return ( 0 );
 }
 
+#if 0
 /*
 */
 
@@ -76,12 +77,14 @@
display_status_1( msg, maj_stat, GSS_C_GSS_CODE );
display_status_1( msg, min_stat, GSS_C_MECH_CODE );
 }
+#endif
 
 static DNS_ERROR dns_negotiate_gss_ctx_int( TALLOC_CTX *mem_ctx,
struct dns_connection *conn,
const char *keyname,
const gss_name_t target_name,
-   gss_ctx_id_t *ctx )
+   gss_ctx_id_t *ctx, 
+   enum dns_ServerType srv_type )
 {
struct gss_buffer_desc_struct input_desc, *input_ptr, output_desc;
OM_uint32 major, minor;
@@ -123,11 +126,21 @@
req, keyname, gss.microsoft.com, t,
t + 86400, DNS_TKEY_MODE_GSSAPI, 0,
output_desc.length, (uint8 *)output_desc.value,
-   rec);
+   rec );
if (!ERR_DNS_IS_OK(err)) goto error;
 
-   err = dns_add_rrec(req, rec, req-num_additionals,
-  req-additionals);
+   /* Windows 2000 DNS is broken and requires the
+  TKEY payload in the Answer section instead
+  of the Additional seciton like Windows 2003 */
+
+   if ( srv_type == DNS_SRV_WIN2000 ) {
+   err = dns_add_rrec(req, rec, req-num_answers,
+  req-answers);
+   } else {
+   err = dns_add_rrec(req, rec, 
req-num_additionals,
+  

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

2006-12-14 Thread gd
Author: gd
Date: 2006-12-14 16:34:24 + (Thu, 14 Dec 2006)
New Revision: 20171

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

Log:
Don't delete the krb5 credential if others still reference to it.

Guenther

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


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cred_cache.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd_cred_cache.c2006-12-14 
16:27:45 UTC (rev 20170)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_cred_cache.c2006-12-14 
16:34:24 UTC (rev 20171)
@@ -382,9 +382,17 @@
return NT_STATUS_NO_MEMORY;
 }
 
+/***
+ Remove a WINBINDD_CCACHE_ENTRY entry and the krb5 ccache if no longer 
referenced.
+***/
+
 NTSTATUS remove_ccache(const char *username)
 {
struct WINBINDD_CCACHE_ENTRY *entry = get_ccache_by_username(username);
+   NTSTATUS status;
+#ifdef HAVE_KRB5
+   krb5_error_code ret;
+#endif
 
if (!entry) {
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
@@ -397,17 +405,34 @@
}
 
entry-ref_count--;
-   if (entry-ref_count = 0) {
-   DLIST_REMOVE(ccache_list, entry);
-   TALLOC_FREE(entry-event); /* unregisters events */
-   TALLOC_FREE(entry);
-   DEBUG(10,(remove_ccache: removed ccache for user %s\n, 
username));
-   } else {
+
+   if (entry-ref_count  0) {
DEBUG(10,(remove_ccache: entry %s ref count now %d\n,
username, entry-ref_count ));
+   return NT_STATUS_OK;
}
 
-   return NT_STATUS_OK;
+   /* no references any more */
+
+   DLIST_REMOVE(ccache_list, entry);
+   TALLOC_FREE(entry-event); /* unregisters events */
+
+#ifdef HAVE_KRB5
+   ret = ads_kdestroy(entry-ccname);
+   if (ret) {
+   DEBUG(0,(remove_ccache: failed to destroy user krb5 ccache %s 
with: %s\n,
+   entry-ccname, error_message(ret)));
+   } else {
+   DEBUG(10,(remove_ccache: successfully destroyed krb5 ccache %s 
for user %s\n,
+   entry-ccname, username));
+   }
+   status = krb5_to_nt_status(ret);
+#endif
+
+   TALLOC_FREE(entry);
+   DEBUG(10,(remove_ccache: removed ccache for user %s\n, username));
+
+   return status;
 }
 
 /***

Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_pam.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd_pam.c   2006-12-14 16:27:45 UTC 
(rev 20170)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_pam.c   2006-12-14 16:34:24 UTC 
(rev 20171)
@@ -1976,9 +1976,6 @@
  struct winbindd_cli_state *state) 
 {
NTSTATUS result = NT_STATUS_NOT_SUPPORTED;
-#ifdef HAVE_KRB5
-   int ret;
-#endif
 
DEBUG(3, ([%5lu]: pam dual logoff %s\n, (unsigned long)state-pid,
state-request.data.logoff.user));
@@ -2010,19 +2007,13 @@
goto process_result;
}
 
-   ret = ads_kdestroy(state-request.data.logoff.krb5ccname);
-
-   if (ret) {
-   DEBUG(0,(winbindd_pam_logoff: failed to destroy user ccache %s 
with: %s\n, 
-   state-request.data.logoff.krb5ccname, 
error_message(ret)));
-   } else {
-   DEBUG(10,(winbindd_pam_logoff: successfully destroyed ccache 
%s for user %s\n, 
-   state-request.data.logoff.krb5ccname, 
state-request.data.logoff.user));
+   result = remove_ccache(state-request.data.logoff.user);
+   if (!NT_STATUS_IS_OK(result)) {
+   DEBUG(0,(winbindd_pam_logoff: failed to remove ccache: %s\n,
+   nt_errstr(result)));
+   goto process_result;
}
 
-   remove_ccache(state-request.data.logoff.user);
-
-   result = krb5_to_nt_status(ret);
 #else
result = NT_STATUS_NOT_SUPPORTED;
 #endif



svn commit: samba r20172 - in branches/SAMBA_3_0_24/source/nsswitch: .

2006-12-14 Thread gd
Author: gd
Date: 2006-12-14 16:35:07 + (Thu, 14 Dec 2006)
New Revision: 20172

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

Log:
Don't delete the krb5 credential if others still reference to it.

Guenther

Modified:
   branches/SAMBA_3_0_24/source/nsswitch/winbindd_cred_cache.c
   branches/SAMBA_3_0_24/source/nsswitch/winbindd_pam.c


Changeset:
Modified: branches/SAMBA_3_0_24/source/nsswitch/winbindd_cred_cache.c
===
--- branches/SAMBA_3_0_24/source/nsswitch/winbindd_cred_cache.c 2006-12-14 
16:34:24 UTC (rev 20171)
+++ branches/SAMBA_3_0_24/source/nsswitch/winbindd_cred_cache.c 2006-12-14 
16:35:07 UTC (rev 20172)
@@ -382,9 +382,17 @@
return NT_STATUS_NO_MEMORY;
 }
 
+/***
+ Remove a WINBINDD_CCACHE_ENTRY entry and the krb5 ccache if no longer 
referenced.
+***/
+
 NTSTATUS remove_ccache(const char *username)
 {
struct WINBINDD_CCACHE_ENTRY *entry = get_ccache_by_username(username);
+   NTSTATUS status;
+#ifdef HAVE_KRB5
+   krb5_error_code ret;
+#endif
 
if (!entry) {
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
@@ -397,17 +405,34 @@
}
 
entry-ref_count--;
-   if (entry-ref_count = 0) {
-   DLIST_REMOVE(ccache_list, entry);
-   TALLOC_FREE(entry-event); /* unregisters events */
-   TALLOC_FREE(entry);
-   DEBUG(10,(remove_ccache: removed ccache for user %s\n, 
username));
-   } else {
+
+   if (entry-ref_count  0) {
DEBUG(10,(remove_ccache: entry %s ref count now %d\n,
username, entry-ref_count ));
+   return NT_STATUS_OK;
}
 
-   return NT_STATUS_OK;
+   /* no references any more */
+
+   DLIST_REMOVE(ccache_list, entry);
+   TALLOC_FREE(entry-event); /* unregisters events */
+
+#ifdef HAVE_KRB5
+   ret = ads_kdestroy(entry-ccname);
+   if (ret) {
+   DEBUG(0,(remove_ccache: failed to destroy user krb5 ccache %s 
with: %s\n,
+   entry-ccname, error_message(ret)));
+   } else {
+   DEBUG(10,(remove_ccache: successfully destroyed krb5 ccache %s 
for user %s\n,
+   entry-ccname, username));
+   }
+   status = krb5_to_nt_status(ret);
+#endif
+
+   TALLOC_FREE(entry);
+   DEBUG(10,(remove_ccache: removed ccache for user %s\n, username));
+
+   return status;
 }
 
 /***

Modified: branches/SAMBA_3_0_24/source/nsswitch/winbindd_pam.c
===
--- branches/SAMBA_3_0_24/source/nsswitch/winbindd_pam.c2006-12-14 
16:34:24 UTC (rev 20171)
+++ branches/SAMBA_3_0_24/source/nsswitch/winbindd_pam.c2006-12-14 
16:35:07 UTC (rev 20172)
@@ -1976,9 +1976,6 @@
  struct winbindd_cli_state *state) 
 {
NTSTATUS result = NT_STATUS_NOT_SUPPORTED;
-#ifdef HAVE_KRB5
-   int ret;
-#endif
 
DEBUG(3, ([%5lu]: pam dual logoff %s\n, (unsigned long)state-pid,
state-request.data.logoff.user));
@@ -2010,19 +2007,13 @@
goto process_result;
}
 
-   ret = ads_kdestroy(state-request.data.logoff.krb5ccname);
-
-   if (ret) {
-   DEBUG(0,(winbindd_pam_logoff: failed to destroy user ccache %s 
with: %s\n, 
-   state-request.data.logoff.krb5ccname, 
error_message(ret)));
-   } else {
-   DEBUG(10,(winbindd_pam_logoff: successfully destroyed ccache 
%s for user %s\n, 
-   state-request.data.logoff.krb5ccname, 
state-request.data.logoff.user));
+   result = remove_ccache(state-request.data.logoff.user);
+   if (!NT_STATUS_IS_OK(result)) {
+   DEBUG(0,(winbindd_pam_logoff: failed to remove ccache: %s\n,
+   nt_errstr(result)));
+   goto process_result;
}
 
-   remove_ccache(state-request.data.logoff.user);
-
-   result = krb5_to_nt_status(ret);
 #else
result = NT_STATUS_NOT_SUPPORTED;
 #endif



svn commit: samba r20173 - in branches/SAMBA_3_0/source: libaddns libads utils

2006-12-14 Thread jerry
Author: jerry
Date: 2006-12-14 17:00:10 + (Thu, 14 Dec 2006)
New Revision: 20173

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

Log:
DNS update fixes: 

* Fix DNS updates for multi-homed hosts
* Child domains often don't have an NS record in
  DNS so we have to fall back to looking up the the NS
  records for the forest root.
* Fix compile warning caused by mismatched 'struct in_addr'
  and 'in_addr_t' parameters called to DoDNSUpdate()




Modified:
   branches/SAMBA_3_0/source/libaddns/dns.h
   branches/SAMBA_3_0/source/libaddns/dnsrecord.c
   branches/SAMBA_3_0/source/libads/ads_struct.c
   branches/SAMBA_3_0/source/utils/net_ads.c
   branches/SAMBA_3_0/source/utils/net_dns.c


Changeset:
Modified: branches/SAMBA_3_0/source/libaddns/dns.h
===
--- branches/SAMBA_3_0/source/libaddns/dns.h2006-12-14 16:35:07 UTC (rev 
20172)
+++ branches/SAMBA_3_0/source/libaddns/dns.h2006-12-14 17:00:10 UTC (rev 
20173)
@@ -493,7 +493,7 @@
 DNS_ERROR dns_create_update_request(TALLOC_CTX *mem_ctx,
const char *domainname,
const char *hostname,
-   const in_addr_t *ip_addr,
+   const struct in_addr *ip_addr,
size_t num_adds,
struct dns_update_request **preq);
 

Modified: branches/SAMBA_3_0/source/libaddns/dnsrecord.c
===
--- branches/SAMBA_3_0/source/libaddns/dnsrecord.c  2006-12-14 16:35:07 UTC 
(rev 20172)
+++ branches/SAMBA_3_0/source/libaddns/dnsrecord.c  2006-12-14 17:00:10 UTC 
(rev 20173)
@@ -356,7 +356,7 @@
 DNS_ERROR dns_create_update_request(TALLOC_CTX *mem_ctx,
const char *domainname,
const char *hostname,
-   const in_addr_t *ip_addr,
+   const struct in_addr *ip_addrs,
size_t num_addrs,
struct dns_update_request **preq)
 {
@@ -395,7 +395,7 @@
 */
 
for ( i=0; inum_addrs; i++ ) { 
-   err = dns_create_a_record(req, hostname, 3600, ip_addr[i], 
rec);
+   err = dns_create_a_record(req, hostname, 3600, 
ip_addrs[i].s_addr, rec);
if (!ERR_DNS_IS_OK(err)) 
goto error;
 

Modified: branches/SAMBA_3_0/source/libads/ads_struct.c
===
--- branches/SAMBA_3_0/source/libads/ads_struct.c   2006-12-14 16:35:07 UTC 
(rev 20172)
+++ branches/SAMBA_3_0/source/libads/ads_struct.c   2006-12-14 17:00:10 UTC 
(rev 20173)
@@ -75,7 +75,29 @@
return ads_build_path(realm, ., dc=, 0);
 }
 
+/* return a DNS name in the for aa.bb.cc from the DN  
+   dc=AA,dc=BB,dc=CC.  caller must free
+*/
+char *ads_build_domain(const char *dn)
+{
+   char *dnsdomain = NULL;
+   
+   /* result should always be shorter than the DN */
 
+   if ( (dnsdomain = SMB_STRDUP( dn )) == NULL ) {
+   DEBUG(0,(ads_build_domain: malloc() failed!\n));  
+   return NULL;
+   }   
+
+   strlower_m( dnsdomain );
+   all_string_sub( dnsdomain, dc=, , 0);
+   all_string_sub( dnsdomain, ,, ., 0 );
+
+   return dnsdomain;   
+}
+
+
+
 #ifndef LDAP_PORT
 #define LDAP_PORT 389
 #endif

Modified: branches/SAMBA_3_0/source/utils/net_ads.c
===
--- branches/SAMBA_3_0/source/utils/net_ads.c   2006-12-14 16:35:07 UTC (rev 
20172)
+++ branches/SAMBA_3_0/source/utils/net_ads.c   2006-12-14 17:00:10 UTC (rev 
20173)
@@ -1221,7 +1221,7 @@
 
 #if defined(WITH_DNS_UPDATES)
 #include dns.h
-DNS_ERROR DoDNSUpdate(ADS_STRUCT *ads, char *pszServerName,
+DNS_ERROR DoDNSUpdate(char *pszServerName,
  const char *pszDomainName,
  const char *pszHostName,
  const struct in_addr *iplist, int num_addrs );
@@ -1237,7 +1237,8 @@
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
DNS_ERROR dns_err;
fstring dns_server;
-   const char *dnsdomain;
+   const char *dnsdomain = NULL;   
+   char *root_domain = NULL;   
 
if ( (dnsdomain = strchr_m( machine_name, '.')) == NULL ) {
d_printf(No DNS domain configured for %s. 
@@ -1249,9 +1250,52 @@
 
status = ads_dns_lookup_ns( ctx, dnsdomain, nameservers, ns_count );
if ( !NT_STATUS_IS_OK(status) || (ns_count == 0)) {
-   DEBUG(3,(net_ads_join: Failed to find name server for the %s 
+   /* Child domains often do not have NS records.  Look
+  for the NS record for the forest root 

Re: svn commit: samba r20173 - in branches/SAMBA_3_0/source: libaddns libads utils

2006-12-14 Thread Gerald (Jerry) Carter
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

[EMAIL PROTECTED] wrote:
 Author: jerry
 Date: 2006-12-14 17:00:10 + (Thu, 14 Dec 2006)
 New Revision: 20173
 
 WebSVN: 
 http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=20173
 
 Log:
 DNS update fixes: 
 
 * Fix DNS updates for multi-homed hosts
 * Child domains often don't have an NS record in
   DNS so we have to fall back to looking up the the NS
   records for the forest root.
 * Fix compile warning caused by mismatched 'struct in_addr'
   and 'in_addr_t' parameters called to DoDNSUpdate()
 
 

This also has two other changes in the patch.

(a) Removed an unnecessary kinit() using the
machine creds from the dns update code.  We should have
already done that before calling into DoDNSUpdate().

(b) add get_dc_name() to net_ads_join() in order to initialize the
server affinity cache before joining the domain.



cheers, jerry
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.2 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFgYU9IR7qMdg1EfYRAsHTAJ9bLuz699aZwKaiq6sIKS1gv96xnACgqqi2
MP9xZomcDG5aYny1Z/N9kDE=
=nFfW
-END PGP SIGNATURE-


Rev 40: Raw impl. of ibwrapper test tool. in http://samba.org/~tridge/psomogyi/

2006-12-14 Thread psomogyi

revno: 40
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Peter Somogyi [EMAIL PROTECTED]
branch nick: ctdb
timestamp: Thu 2006-12-14 18:21:39 +0100
message:
  Raw impl. of ibwrapper test tool.
  (basic functional test, compilable, untested)
  Adjusted makefile and ibwrapper state checking.
added:
  tests/ibwrapper_test.c 
ibwrapper_test.c-20061214171730-h11a2z5ed6pt66hj-1
modified:
  Makefile.inmakefile.in-20061117234101-o3qt14umlg9en8z0-1
  ib/ibwrapper.c ibwrapper.c-20061204130028-0125b4f5a72f4b11
=== added file 'tests/ibwrapper_test.c'
--- a/tests/ibwrapper_test.c1970-01-01 00:00:00 +
+++ b/tests/ibwrapper_test.c2006-12-14 17:21:39 +
@@ -0,0 +1,427 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * Test the infiniband wrapper.
+ *
+ * Copyright (C) Sven Oehme [EMAIL PROTECTED] 2006
+ *
+ * Major code contributions by Peter Somogyi [EMAIL PROTECTED]
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include stdlib.h
+#include string.h
+#include stdio.h
+#include errno.h
+#include sys/types.h
+#include netinet/in.h
+#include sys/socket.h
+#include netdb.h
+#include arpa/inet.h
+#include malloc.h
+#include assert.h
+#include unistd.h
+#include signal.h
+
+#include includes.h
+#include lib/events/events.h
+#include ib/ibwrapper.h
+
+struct ibwtest_ctx {
+   int is_server;
+   char*id; /* my id */
+
+   struct ibw_initattr *attrs;
+   int nattrs;
+   char*opts; /* option string */
+
+   struct sockaddr_in *addrs; /* dynamic array of dest addrs */
+   int naddrs;
+
+   int max_msg_size;
+   unsigned intnsec; /* nanosleep between messages */
+
+   int cnt;
+
+   int kill_me;
+   struct ibw_ctx  *ibwctx;
+};
+
+struct ibwtest_conn {
+   char*id;
+};
+
+enum testopcode {
+   TESTOP_SEND_ID = 1,
+   TESTOP_SEND_DATA = 2
+};
+
+int ibwtest_connect_everybody(struct ibwtest_ctx *tcx)
+{
+   struct ibwtest_conn *pconn = talloc_zero(tcx, struct ibwtest_conn);
+   int i;
+
+   for(i=0; itcx-naddrs; i++) {
+   if (ibw_connect(tcx-ibwctx, tcx-addrs[i], pconn)) {
+   fprintf(stderr, ibw_connect error at %d\n, i);
+   return -1;
+   }
+   }
+   DEBUG(10, (sent %d connect request...\n, tcx-naddrs));
+
+   return 0;
+}
+
+int ibwtest_send_id(struct ibw_conn *conn)
+{
+   char *buf;
+   void *key;
+   struct ibwtest_ctx *tcx = talloc_get_type(conn-ctx-ctx_userdata, 
struct ibwtest_ctx);
+
+   DEBUG(10, (test IBWC_CONNECTED\n));
+   if (ibw_alloc_send_buf(conn, (void **)buf, key)) {
+   DEBUG(0, (send_id: ibw_alloc_send_buf failed\n));
+   return -1;
+   }
+   
+   buf[0] = (char)TESTOP_SEND_ID;
+   strcpy(buf+1, tcx-id);
+
+   if (ibw_send(conn, buf, key, strlen(buf+1))) {
+   DEBUG(0, (send_id: ibw_send error\n));
+   return -1;
+   }
+   return 0;
+}
+
+int ibwtest_send_test_msg(struct ibwtest_ctx *tcx, struct ibw_conn *conn, 
const char *msg)
+{
+   char *buf;
+   void *key;
+
+   if (ibw_alloc_send_buf(conn, (void **)buf, key)) {
+   fprintf(stderr, send_test_msg: ibw_alloc_send_buf failed\n);
+   return -1;
+   }
+
+   buf[0] = (char)TESTOP_SEND_DATA;
+   assert(strlen(msg)tcx-max_msg_size-1);
+   strcpy(buf+1, msg);
+   
+   if (ibw_send(conn, buf, key, strlen(buf+1))) {
+   DEBUG(0, (send_test_msg: ibw_send error\n));
+   return -1;
+   }
+   return 0;
+}
+
+int ibwtest_connstate_handler(struct ibw_ctx *ctx, struct ibw_conn *conn)
+{
+   struct ibwtest_ctx  *tcx = NULL; /* userdata */
+   struct ibwtest_conn *pconn = NULL; /* userdata */
+
+   if (ctx) {
+   tcx = talloc_get_type(ctx-ctx_userdata, struct ibwtest_ctx);
+
+   switch(ctx-state) {
+   case IBWS_INIT:
+   DEBUG(10, (test IBWS_INIT\n));
+   break;
+   case IBWS_READY:
+   DEBUG(10, (test IBWS_READY\n));
+   break;
+   case 

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

2006-12-14 Thread Rafal Szczesniak
On Thu, Dec 14, 2006 at 08:23:56AM +, [EMAIL PROTECTED] wrote:
 Author: metze
 Date: 2006-12-14 08:23:55 + (Thu, 14 Dec 2006)
 New Revision: 20166
 
 WebSVN: 
 http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=20166
 
 Log:
 we have a dom_sid_add_rid() function that adds the rid after allocating
 enough memory for the new sub_auth element.
 
 the old version wrote behind the buffer.
 
 also make the output sid a pointer.

Hey! I was supposed to fix that tonight :)

Thanks anyway :)


cheers,
-- 
Rafal Szczesniak
Samba Team member  http://www.samba.org



signature.asc
Description: Digital signature


svn commit: samba r20174 - in branches: SAMBA_3_0/source/lib SAMBA_3_0_24/source/lib

2006-12-14 Thread jra
Author: jra
Date: 2006-12-14 22:11:17 + (Thu, 14 Dec 2006)
New Revision: 20174

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

Log:
If we're only going to call one handler per message
then terminate the traversal once we've done that.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/lib/messages.c
   branches/SAMBA_3_0_24/source/lib/messages.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/messages.c
===
--- branches/SAMBA_3_0/source/lib/messages.c2006-12-14 17:00:10 UTC (rev 
20173)
+++ branches/SAMBA_3_0/source/lib/messages.c2006-12-14 22:11:17 UTC (rev 
20174)
@@ -483,23 +483,23 @@
return;
 
for (buf = msgs_buf; message_recv(msgs_buf, total_len, msg_type, src, 
buf, len); buf += len) {
-   struct dispatch_fns *dfn, *next;
+   struct dispatch_fns *dfn;
 
DEBUG(10,(message_dispatch: received msg_type=%d 
  src_pid=%u\n, msg_type,
  (unsigned int) procid_to_pid(src)));
 
n_handled = 0;
-   for (dfn = dispatch_fns; dfn; dfn = next) {
-   next = dfn-next;   
+   for (dfn = dispatch_fns; dfn; dfn = dfn-next) {
if (dfn-msg_type == msg_type) {
DEBUG(10,(message_dispatch: processing message 
of type %d.\n, msg_type));
dfn-fn(msg_type, src, len ? (void *)buf : 
NULL, len);
n_handled++;
+   break;
}
}
if (!n_handled) {
-   DEBUG(5,(message_dispatch: warning: no handlers 
registed for 
+   DEBUG(5,(message_dispatch: warning: no handler 
registed for 
 msg_type %d in pid %u\n,
 msg_type, (unsigned int)sys_getpid()));
}

Modified: branches/SAMBA_3_0_24/source/lib/messages.c
===
--- branches/SAMBA_3_0_24/source/lib/messages.c 2006-12-14 17:00:10 UTC (rev 
20173)
+++ branches/SAMBA_3_0_24/source/lib/messages.c 2006-12-14 22:11:17 UTC (rev 
20174)
@@ -483,23 +483,23 @@
return;
 
for (buf = msgs_buf; message_recv(msgs_buf, total_len, msg_type, src, 
buf, len); buf += len) {
-   struct dispatch_fns *dfn, *next;
+   struct dispatch_fns *dfn;
 
DEBUG(10,(message_dispatch: received msg_type=%d 
  src_pid=%u\n, msg_type,
  (unsigned int) procid_to_pid(src)));
 
n_handled = 0;
-   for (dfn = dispatch_fns; dfn; dfn = next) {
-   next = dfn-next;   
+   for (dfn = dispatch_fns; dfn; dfn = dfn-next) {
if (dfn-msg_type == msg_type) {
DEBUG(10,(message_dispatch: processing message 
of type %d.\n, msg_type));
dfn-fn(msg_type, src, len ? (void *)buf : 
NULL, len);
n_handled++;
+   break;
}
}
if (!n_handled) {
-   DEBUG(5,(message_dispatch: warning: no handlers 
registed for 
+   DEBUG(5,(message_dispatch: warning: no handler 
registed for 
 msg_type %d in pid %u\n,
 msg_type, (unsigned int)sys_getpid()));
}



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

2006-12-14 Thread mimir
Author: mimir
Date: 2006-12-14 22:12:53 + (Thu, 14 Dec 2006)
New Revision: 20175

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

Log:
use libnet context instead mem_ctx as the latter gets
freed just before the function returns.


rafal


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


Changeset:
Modified: branches/SAMBA_4_0/source/scripting/ejs/ejsnet.c
===
--- branches/SAMBA_4_0/source/scripting/ejs/ejsnet.c2006-12-14 22:11:17 UTC 
(rev 20174)
+++ branches/SAMBA_4_0/source/scripting/ejs/ejsnet.c2006-12-14 22:12:53 UTC 
(rev 20175)
@@ -375,7 +375,7 @@
 
/* create UserInfo object */
mprUserInfo = mprObject(UserInfo);
-   
+
mprAccountName = mprString(req.out.account_name);
mprFullName = mprString(req.out.full_name);
mprDescription = mprString(req.out.description);
@@ -384,8 +384,8 @@
mprComment = mprString(req.out.comment);
mprLogonScript = mprString(req.out.logon_script);
mprAcctExpiry = mprString(timestring(mem_ctx, 
req.out.acct_expiry-tv_sec));
-   mprAllowPassChange = mprString(timestring(mem_ctx, 
req.out.allow_password_change-tv_sec));
-   mprForcePassChange = mprString(timestring(mem_ctx, 
req.out.force_password_change-tv_sec));
+   mprAllowPassChange = mprString(timestring(ctx, 
req.out.allow_password_change-tv_sec));
+   mprForcePassChange = mprString(timestring(ctx, 
req.out.force_password_change-tv_sec));
 
status = mprSetVar(mprUserInfo, AccountName, mprAccountName);
if (!NT_STATUS_IS_OK(status)) goto done;
@@ -407,7 +407,6 @@
if (!NT_STATUS_IS_OK(status)) goto done;
status = mprSetVar(mprUserInfo, ForcePasswordChange, 
mprForcePassChange);
if (!NT_STATUS_IS_OK(status)) goto done;
-
 done:
talloc_free(mem_ctx);
mpr_Return(eid, mprUserInfo);



svn commit: samba r20176 - in branches/SAMBA_4_0/testprogs/ejs: .

2006-12-14 Thread mimir
Author: mimir
Date: 2006-12-14 22:14:07 + (Thu, 14 Dec 2006)
New Revision: 20176

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

Log:
Info method returns null object if the user is not found.


rafal


Modified:
   branches/SAMBA_4_0/testprogs/ejs/ejsnet.js


Changeset:
Modified: branches/SAMBA_4_0/testprogs/ejs/ejsnet.js
===
--- branches/SAMBA_4_0/testprogs/ejs/ejsnet.js  2006-12-14 22:12:53 UTC (rev 
20175)
+++ branches/SAMBA_4_0/testprogs/ejs/ejsnet.js  2006-12-14 22:14:07 UTC (rev 
20176)
@@ -30,12 +30,18 @@
return -1;
 }
 
+
 var info = usr_ctx.Info(options.ARGV[1]);
-println(UserInfo.AccountName =  + info.AccountName);
-println(UserInfo.Description =  + info.Description);
-println(UserInfo.FullName =  + info.FullName);
-println(UserInfo.AcctExpiry =  + info.AcctExpiry);
+if (info != null) {
+   println(UserInfo.AccountName =  + info.AccountName);
+   println(UserInfo.Description =  + info.Description);
+   println(UserInfo.FullName =  + info.FullName);
+   println(UserInfo.AcctExpiry =  + info.AcctExpiry);
+} else {
+   println(Null UserInfo returned - account unknown);
+}
 
+
 var status = usr_ctx.Delete(options.ARGV[1]);
 if (status.is_ok != true) {
println(Failed to delete user account  + options.ARGV[1] + :  + 
status.errstr);



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

2006-12-14 Thread mimir
Author: mimir
Date: 2006-12-14 22:45:12 + (Thu, 14 Dec 2006)
New Revision: 20177

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

Log:
return the actual function status code.


rafal


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


Changeset:
Modified: branches/SAMBA_4_0/source/libnet/libnet_lookup.c
===
--- branches/SAMBA_4_0/source/libnet/libnet_lookup.c2006-12-14 22:14:07 UTC 
(rev 20176)
+++ branches/SAMBA_4_0/source/libnet/libnet_lookup.c2006-12-14 22:45:12 UTC 
(rev 20177)
@@ -392,6 +392,8 @@
c-status = dcerpc_ndr_request_recv(req);
if (!composite_is_ok(c)) return;
 
+   c-status = s-lookup.out.result;
+
composite_done(c);
 }
 



Build status as of Fri Dec 15 00:00:02 2006

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

--- /home/build/master/cache/broken_results.txt.old 2006-12-14 
00:01:45.0 +
+++ /home/build/master/cache/broken_results.txt 2006-12-15 00:00:58.0 
+
@@ -1,4 +1,4 @@
-Build status as of Thu Dec 14 00:00:02 2006
+Build status as of Fri Dec 15 00:00:02 2006
 
 Build counts:
 Tree Total  Broken Panic 
@@ -7,15 +7,15 @@
 ccache   43 7  0 
 ctdb 0  0  0 
 distcc   2  0  0 
-ldb  41 4  0 
+ldb  42 4  0 
 libreplace   40 2  0 
-lorikeet-heimdal 35 17 0 
+lorikeet-heimdal 35 18 0 
 ppp  18 0  0 
 rsync43 3  0 
 samba0  0  0 
 samba-docs   0  0  0 
-samba4   41 34 16
-samba_3_043 33 0 
+samba4   41 28 0 
+samba_3_043 20 0 
 smb-build40 1  0 
 talloc   43 1  0 
 tdb  42 2  0 


svn commit: samba r20178 - in branches: SAMBA_3_0/source/smbd SAMBA_3_0_24/source/smbd

2006-12-14 Thread jra
Author: jra
Date: 2006-12-15 00:49:12 + (Fri, 15 Dec 2006)
New Revision: 20178

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

Log:
Ensure we allocate the intermediate trans structs
off conn-mem_ctx, not the null context so we can
safefy free everything on conn close. Should fix
possible memleak.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/smbd/conn.c
   branches/SAMBA_3_0/source/smbd/ipc.c
   branches/SAMBA_3_0/source/smbd/nttrans.c
   branches/SAMBA_3_0/source/smbd/trans2.c
   branches/SAMBA_3_0_24/source/smbd/conn.c
   branches/SAMBA_3_0_24/source/smbd/ipc.c
   branches/SAMBA_3_0_24/source/smbd/nttrans.c
   branches/SAMBA_3_0_24/source/smbd/trans2.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/conn.c
===
--- branches/SAMBA_3_0/source/smbd/conn.c   2006-12-14 22:45:12 UTC (rev 
20177)
+++ branches/SAMBA_3_0/source/smbd/conn.c   2006-12-15 00:49:12 UTC (rev 
20178)
@@ -257,6 +257,7 @@
 {
vfs_handle_struct *handle = NULL, *thandle = NULL;
TALLOC_CTX *mem_ctx = NULL;
+   struct trans_state *state = NULL;
 
/* Free vfs_connection_struct */
handle = conn-vfs_handles;
@@ -268,6 +269,13 @@
handle = thandle;
}
 
+   /* Free any pending transactions stored on this conn. */
+   for (state = conn-pending_trans; state; state = state-next) {
+   /* state-setup is a talloc child of state. */
+   SAFE_FREE(state-param);
+   SAFE_FREE(state-data);
+   }
+
free_namearray(conn-veto_list);
free_namearray(conn-hide_list);
free_namearray(conn-veto_oplock_list);

Modified: branches/SAMBA_3_0/source/smbd/ipc.c
===
--- branches/SAMBA_3_0/source/smbd/ipc.c2006-12-14 22:45:12 UTC (rev 
20177)
+++ branches/SAMBA_3_0/source/smbd/ipc.c2006-12-15 00:49:12 UTC (rev 
20178)
@@ -447,7 +447,7 @@
return ERROR_NT(result);
}
 
-   if ((state = TALLOC_P(NULL, struct trans_state)) == NULL) {
+   if ((state = TALLOC_P(conn-mem_ctx, struct trans_state)) == NULL) {
DEBUG(0, (talloc failed\n));
END_PROFILE(SMBtrans);
return ERROR_NT(NT_STATUS_NO_MEMORY);
@@ -458,6 +458,7 @@
state-mid = SVAL(inbuf, smb_mid);
state-vuid = SVAL(inbuf, smb_uid);
state-setup_count = CVAL(inbuf, smb_suwcnt);
+   state-setup = NULL;
state-total_param = SVAL(inbuf, smb_tpscnt);
state-param = NULL;
state-total_data = SVAL(inbuf, smb_tdscnt);

Modified: branches/SAMBA_3_0/source/smbd/nttrans.c
===
--- branches/SAMBA_3_0/source/smbd/nttrans.c2006-12-14 22:45:12 UTC (rev 
20177)
+++ branches/SAMBA_3_0/source/smbd/nttrans.c2006-12-15 00:49:12 UTC (rev 
20178)
@@ -2845,7 +2845,7 @@
return ERROR_NT(result);
}
 
-   if ((state = TALLOC_P(NULL, struct trans_state)) == NULL) {
+   if ((state = TALLOC_P(conn-mem_ctx, struct trans_state)) == NULL) {
END_PROFILE(SMBnttrans);
return ERROR_DOS(ERRSRV,ERRaccess);
}
@@ -2862,6 +2862,7 @@
 
/* setup count is in *words* */
state-setup_count = 2*CVAL(inbuf,smb_nt_SetupCount); 
+   state-setup = NULL;
state-call = function_code;
 
/* 

Modified: branches/SAMBA_3_0/source/smbd/trans2.c
===
--- branches/SAMBA_3_0/source/smbd/trans2.c 2006-12-14 22:45:12 UTC (rev 
20177)
+++ branches/SAMBA_3_0/source/smbd/trans2.c 2006-12-15 00:49:12 UTC (rev 
20178)
@@ -5265,7 +5265,7 @@
return ERROR_DOS(ERRSRV,ERRaccess);
}
 
-   if ((state = TALLOC_P(NULL, struct trans_state)) == NULL) {
+   if ((state = TALLOC_P(conn-mem_ctx, struct trans_state)) == NULL) {
DEBUG(0, (talloc failed\n));
END_PROFILE(SMBtrans2);
return ERROR_NT(NT_STATUS_NO_MEMORY);
@@ -5276,6 +5276,7 @@
state-mid = SVAL(inbuf, smb_mid);
state-vuid = SVAL(inbuf, smb_uid);
state-setup_count = SVAL(inbuf, smb_suwcnt);
+   state-setup = NULL;
state-total_param = SVAL(inbuf, smb_tpscnt);
state-param = NULL;
state-total_data =  SVAL(inbuf, smb_tdscnt);

Modified: branches/SAMBA_3_0_24/source/smbd/conn.c
===
--- branches/SAMBA_3_0_24/source/smbd/conn.c2006-12-14 22:45:12 UTC (rev 
20177)
+++ branches/SAMBA_3_0_24/source/smbd/conn.c2006-12-15 00:49:12 UTC (rev 
20178)
@@ -257,6 +257,7 @@
 {
vfs_handle_struct *handle = NULL, *thandle = NULL;
TALLOC_CTX *mem_ctx = NULL;
+   struct trans_state *state = NULL;
 
/* Free vfs_connection_struct */
handle = 

svn commit: samba r20179 - in branches: SAMBA_3_0/source/lib SAMBA_3_0_24/source/lib

2006-12-14 Thread jra
Author: jra
Date: 2006-12-15 01:50:04 + (Fri, 15 Dec 2006)
New Revision: 20179

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

Log:
Sync up with Samba4 - remove blank lines at the
end parsing a file.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/lib/util_file.c
   branches/SAMBA_3_0_24/source/lib/util_file.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/util_file.c
===
--- branches/SAMBA_3_0/source/lib/util_file.c   2006-12-15 00:49:12 UTC (rev 
20178)
+++ branches/SAMBA_3_0/source/lib/util_file.c   2006-12-15 01:50:04 UTC (rev 
20179)
@@ -285,9 +285,6 @@
return NULL;
}   
memset(ret, 0, sizeof(ret[0])*(i+2));
-   if (numlines) {
-   *numlines = i;
-   }
 
ret[0] = p;
for (s = p, i=0; s  p+size; s++) {
@@ -301,6 +298,15 @@
}
}
 
+   /* remove any blank lines at the end */
+   while (i  0  ret[i-1][0] == 0) {
+   i--;
+   }
+
+   if (numlines) {
+   *numlines = i;
+   }
+
return ret;
 }
 

Modified: branches/SAMBA_3_0_24/source/lib/util_file.c
===
--- branches/SAMBA_3_0_24/source/lib/util_file.c2006-12-15 00:49:12 UTC 
(rev 20178)
+++ branches/SAMBA_3_0_24/source/lib/util_file.c2006-12-15 01:50:04 UTC 
(rev 20179)
@@ -285,9 +285,6 @@
return NULL;
}   
memset(ret, 0, sizeof(ret[0])*(i+2));
-   if (numlines) {
-   *numlines = i;
-   }
 
ret[0] = p;
for (s = p, i=0; s  p+size; s++) {
@@ -301,6 +298,15 @@
}
}
 
+   /* remove any blank lines at the end */
+   while (i  0  ret[i-1][0] == 0) {
+   i--;
+   }
+
+   if (numlines) {
+   *numlines = i;
+   }
+
return ret;
 }
 



Rev 1: first version in http://samba.org/~tridge/ctdb/

2006-12-14 Thread tridge


svn commit: samba r20180 - in branches: SAMBA_3_0/source/nsswitch SAMBA_3_0_24/source/nsswitch

2006-12-14 Thread jra
Author: jra
Date: 2006-12-15 06:06:15 + (Fri, 15 Dec 2006)
New Revision: 20180

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

Log:
Ensure that pam returns the correct error messages
when offline and or doing password changes.
Jeremy.

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


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


svn commit: samba r20181 - in branches: SAMBA_3_0/source/lib SAMBA_3_0_24/source/lib

2006-12-14 Thread jra
Author: jra
Date: 2006-12-15 06:44:16 + (Fri, 15 Dec 2006)
New Revision: 20181

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

Log:
Improve NT status to pam error mapping.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/lib/pam_errors.c
   branches/SAMBA_3_0_24/source/lib/pam_errors.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/pam_errors.c
===
--- branches/SAMBA_3_0/source/lib/pam_errors.c  2006-12-15 06:06:15 UTC (rev 
20180)
+++ branches/SAMBA_3_0/source/lib/pam_errors.c  2006-12-15 06:44:16 UTC (rev 
20181)
@@ -72,6 +72,13 @@
{NT_STATUS_ACCOUNT_LOCKED_OUT, PAM_MAXTRIES},
{NT_STATUS_NO_MEMORY, PAM_BUF_ERR},
{NT_STATUS_PASSWORD_RESTRICTION, PAM_PERM_DENIED},
+   {NT_STATUS_BACKUP_CONTROLLER, PAM_AUTHINFO_UNAVAIL};
+   {NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND, PAM_AUTHINFO_UNAVAIL};
+   {NT_STATUS_NO_LOGON_SERVERS, PAM_AUTHINFO_UNAVAIL};
+   {NT_STATUS_INVALID_WORKSTATION, PAM_PERM_DENIED},
+   {NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT, PAM_AUTHINFO_UNAVAIL};
+   {NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT, PAM_AUTHINFO_UNAVAIL};
+   {NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT, PAM_AUTHINFO_UNAVAIL};
{NT_STATUS_OK, PAM_SUCCESS}
 };
 

Modified: branches/SAMBA_3_0_24/source/lib/pam_errors.c
===
--- branches/SAMBA_3_0_24/source/lib/pam_errors.c   2006-12-15 06:06:15 UTC 
(rev 20180)
+++ branches/SAMBA_3_0_24/source/lib/pam_errors.c   2006-12-15 06:44:16 UTC 
(rev 20181)
@@ -72,6 +72,13 @@
{NT_STATUS_ACCOUNT_LOCKED_OUT, PAM_MAXTRIES},
{NT_STATUS_NO_MEMORY, PAM_BUF_ERR},
{NT_STATUS_PASSWORD_RESTRICTION, PAM_PERM_DENIED},
+   {NT_STATUS_BACKUP_CONTROLLER, PAM_AUTHINFO_UNAVAIL};
+   {NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND, PAM_AUTHINFO_UNAVAIL};
+   {NT_STATUS_NO_LOGON_SERVERS, PAM_AUTHINFO_UNAVAIL};
+   {NT_STATUS_INVALID_WORKSTATION, PAM_PERM_DENIED},
+   {NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT, PAM_AUTHINFO_UNAVAIL};
+   {NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT, PAM_AUTHINFO_UNAVAIL};
+   {NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT, PAM_AUTHINFO_UNAVAIL};
{NT_STATUS_OK, PAM_SUCCESS}
 };