svn commit: samba r19055 - in branches/SAMBA_4_0: jsonrpc jsonrpc/qooxdoo source/scripting/ejs
Author: derrell Date: 2006-10-03 02:38:08 + (Tue, 03 Oct 2006) New Revision: 19055 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19055 Log: JSON-RPC is working! It passes the small qooxdoo JSON-RPC test suite perfectly. This check in covers the remaining fixes and enhancements to complete the server. In a subsequent check-in, I need to learn about the new qooxdoo packaging mechanism. Although it'd be nice to have the whole source tree, that's huge and needn't be in samba svn. It's now supposed to be very easy to package qooxdoo, so I'll figure out how that's done and then check in the relevant small number of files. Steps after that involve generating the stubs to allow various ejs functions to be called via JSON-RPC. Derrell Modified: branches/SAMBA_4_0/jsonrpc/json.esp branches/SAMBA_4_0/jsonrpc/jsondate.esp branches/SAMBA_4_0/jsonrpc/qooxdoo/test.esp branches/SAMBA_4_0/jsonrpc/request.esp branches/SAMBA_4_0/source/scripting/ejs/literal.c branches/SAMBA_4_0/source/scripting/ejs/smbcalls.c Changeset: Sorry, the patch is too large (690 lines) to include; please use WebSVN to see it! WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19055
Build status as of Tue Oct 3 00:00:01 2006
URL: http://build.samba.org/ --- /home/build/master/cache/broken_results.txt.old 2006-10-02 00:00:34.0 + +++ /home/build/master/cache/broken_results.txt 2006-10-03 00:00:12.0 + @@ -1,21 +1,21 @@ -Build status as of Mon Oct 2 00:00:02 2006 +Build status as of Tue Oct 3 00:00:01 2006 Build counts: Tree Total Broken Panic SOC 0 0 0 build_farm 0 0 0 -ccache 45 8 0 -distcc 45 7 0 +ccache 16 3 0 +distcc 16 3 0 ldb 41 5 0 -libreplace 41 1 0 +libreplace 40 1 0 lorikeet-heimdal 8 5 0 ppp 17 0 0 -rsync45 11 0 +rsync44 10 0 samba0 0 0 samba-docs 0 0 0 -samba4 41 9 1 -samba_3_040 12 1 -smb-build30 3 0 -talloc 45 4 0 -tdb 43 3 0 +samba4 43 11 1 +samba_3_042 15 1 +smb-build29 3 0 +talloc 44 4 0 +tdb 42 2 0
svn commit: samba r19054 - in branches: SAMBA_3_0/source/lib SAMBA_3_0_23/source/lib
Author: jra Date: 2006-10-02 23:34:03 + (Mon, 02 Oct 2006) New Revision: 19054 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19054 Log: Callers of gencache may not have the rights to open read/write. Allow them to fallback to read-only. Jeremy Modified: branches/SAMBA_3_0/source/lib/gencache.c branches/SAMBA_3_0_23/source/lib/gencache.c Changeset: Modified: branches/SAMBA_3_0/source/lib/gencache.c === --- branches/SAMBA_3_0/source/lib/gencache.c2006-10-02 22:18:36 UTC (rev 19053) +++ branches/SAMBA_3_0/source/lib/gencache.c2006-10-02 23:34:03 UTC (rev 19054) @@ -31,6 +31,7 @@ #define READ_CACHE_DATA_FMT_TEMPLATE "%%12u/%%%us" static TDB_CONTEXT *cache; +static BOOL cache_readonly; /** * @file gencache.c @@ -66,6 +67,14 @@ cache = tdb_open_log(cache_fname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0644); + if (!cache && (errno == EACCES)) { + cache = tdb_open_log(cache_fname, 0, TDB_DEFAULT, O_RDONLY, 0644); + if (cache) { + cache_readonly = True; + DEBUG(5, ("gencache_init: Opening cache file %s read-only.\n", cache_fname)); + } + } + SAFE_FREE(cache_fname); if (!cache) { DEBUG(5, ("Attempt to open gencache.tdb has failed.\n")); @@ -90,6 +99,7 @@ DEBUG(5, ("Closing cache file\n")); ret = tdb_close(cache); cache = NULL; + cache_readonly = False; return ret != -1; } @@ -117,6 +127,10 @@ if (!gencache_init()) return False; + if (cache_readonly) { + return False; + } + asprintf(&valstr, CACHE_DATA_FMT, (int)timeout, value); if (!valstr) return False; @@ -155,6 +169,10 @@ if (!gencache_init()) return False; + if (cache_readonly) { + return False; + } + keybuf.dptr = CONST_DISCARD(char *, keystr); keybuf.dsize = strlen(keystr)+1; DEBUG(10, ("Deleting cache entry (key = %s)\n", keystr)); Modified: branches/SAMBA_3_0_23/source/lib/gencache.c === --- branches/SAMBA_3_0_23/source/lib/gencache.c 2006-10-02 22:18:36 UTC (rev 19053) +++ branches/SAMBA_3_0_23/source/lib/gencache.c 2006-10-02 23:34:03 UTC (rev 19054) @@ -31,6 +31,7 @@ #define READ_CACHE_DATA_FMT_TEMPLATE "%%12u/%%%us" static TDB_CONTEXT *cache; +static BOOL cache_readonly; /** * @file gencache.c @@ -66,6 +67,14 @@ cache = tdb_open_log(cache_fname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0644); + if (!cache && (errno == EACCES)) { + cache = tdb_open_log(cache_fname, 0, TDB_DEFAULT, O_RDONLY, 0644); + if (cache) { + cache_readonly = True; + DEBUG(5, ("gencache_init: Opening cache file %s read-only.\n", cache_fname)); + } + } + SAFE_FREE(cache_fname); if (!cache) { DEBUG(5, ("Attempt to open gencache.tdb has failed.\n")); @@ -90,6 +99,7 @@ DEBUG(5, ("Closing cache file\n")); ret = tdb_close(cache); cache = NULL; + cache_readonly = False; return ret != -1; } @@ -117,6 +127,10 @@ if (!gencache_init()) return False; + if (cache_readonly) { + return False; + } + asprintf(&valstr, CACHE_DATA_FMT, (int)timeout, value); if (!valstr) return False; @@ -162,6 +176,10 @@ if (!gencache_init()) return False; + if (cache_readonly) { + return False; + } + /* * Check whether entry exists in the cache * Don't verify gencache_get exit code, since the entry may be expired @@ -213,6 +231,10 @@ if (!gencache_init()) return False; + if (cache_readonly) { + return False; + } + keybuf.dptr = SMB_STRDUP(keystr); keybuf.dsize = strlen(keystr)+1; DEBUG(10, ("Deleting cache entry (key = %s)\n", keystr)); @@ -431,5 +453,3 @@ tdb_unlock_bystring(cache, key); return; } - -
svn commit: samba r19053 - in branches/SAMBA_4_0/source/libnet: .
Author: mimir Date: 2006-10-02 22:18:36 + (Mon, 02 Oct 2006) New Revision: 19053 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19053 Log: match the flag values with the actual equivalents in samr.idl rafal Modified: branches/SAMBA_4_0/source/libnet/userman.h Changeset: Modified: branches/SAMBA_4_0/source/libnet/userman.h === --- branches/SAMBA_4_0/source/libnet/userman.h 2006-10-02 20:44:19 UTC (rev 19052) +++ branches/SAMBA_4_0/source/libnet/userman.h 2006-10-02 22:18:36 UTC (rev 19053) @@ -49,11 +49,11 @@ #define USERMOD_FIELD_FULL_NAME ( 0x0002 ) #define USERMOD_FIELD_DESCRIPTION ( 0x0010 ) #define USERMOD_FIELD_COMMENT ( 0x0020 ) +#define USERMOD_FIELD_HOME_DIRECTORY ( 0x0040 ) +#define USERMOD_FIELD_HOME_DRIVE ( 0x0080 ) #define USERMOD_FIELD_LOGON_SCRIPT( 0x0100 ) #define USERMOD_FIELD_PROFILE_PATH( 0x0200 ) #define USERMOD_FIELD_WORKSTATIONS( 0x0400 ) -#define USERMOD_FIELD_HOME_DIRECTORY ( 0x0800 ) -#define USERMOD_FIELD_HOME_DRIVE ( 0x1000 ) #define USERMOD_FIELD_LOGON_HOURS ( 0x2000 ) #define USERMOD_FIELD_ACCT_EXPIRY ( 0x4000 ) #define USERMOD_FIELD_ACCT_FLAGS ( 0x0010 )
svn commit: samba r19052 - in branches/SAMBA_4_0/jsonrpc: .
Author: derrell Date: 2006-10-02 20:44:19 + (Mon, 02 Oct 2006) New Revision: 19052 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19052 Log: clarify what actually does what Modified: branches/SAMBA_4_0/jsonrpc/request.esp Changeset: Modified: branches/SAMBA_4_0/jsonrpc/request.esp === --- branches/SAMBA_4_0/jsonrpc/request.esp 2006-10-02 20:39:31 UTC (rev 19051) +++ branches/SAMBA_4_0/jsonrpc/request.esp 2006-10-02 20:44:19 UTC (rev 19052) @@ -13,8 +13,10 @@ * This is a simple JSON-RPC server. */ +/* Bring in the json format/parse functions */ +jsonrpc_include("json.esp"); + /* Bring in the date class */ -jsonrpc_include("json.esp"); jsonrpc_include("jsondate.esp"); /* bring the string functions into the global frame */
svn commit: samba r19051 - in branches/SAMBA_4_0: jsonrpc source/scripting/ejs source/web_server
Author: derrell Date: 2006-10-02 20:39:31 + (Mon, 02 Oct 2006) New Revision: 19051 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19051 Log: JSON-RPC server work-in-progress. It's almost working. Modified: branches/SAMBA_4_0/jsonrpc/json.esp branches/SAMBA_4_0/jsonrpc/jsondate.esp branches/SAMBA_4_0/jsonrpc/request.esp branches/SAMBA_4_0/source/scripting/ejs/smbcalls.c branches/SAMBA_4_0/source/scripting/ejs/smbcalls_sys.c branches/SAMBA_4_0/source/web_server/http.c Changeset: Modified: branches/SAMBA_4_0/jsonrpc/json.esp === --- branches/SAMBA_4_0/jsonrpc/json.esp 2006-10-02 17:26:06 UTC (rev 19050) +++ branches/SAMBA_4_0/jsonrpc/json.esp 2006-10-02 20:39:31 UTC (rev 19051) @@ -37,6 +37,11 @@ } } +if (arr.length == 0) +{ +return ""; +} + return join("", arr); } @@ -72,11 +77,15 @@ } else if (type == "float" || type == "integer" || - type == "integer64" || - type == "pointer") + type == "integer64") { -return (o + 0); +return o + 0; } +else if (type == "pointer") +{ +var x = "" + o; +return '"' + substr(x, 16, strlen(x) - 16 - 1) + '"'; +} else if (type == "object") { var buf; @@ -128,6 +137,10 @@ { return '"' + this._internal.escape(o) + '"'; } +else +{ +return '{ "unknown_object":"' + type + '"}'; +} } /* Allocate the public Json access object */ @@ -193,6 +206,7 @@ /* Test it */ +/* libinclude("base.js"); function testFormat() { @@ -211,7 +225,11 @@ test.obj.array[1] = 223; printf("%s\n", Json.encode(test)); } +testFormat(); +*/ +/* +libinclude("base.js"); function testParse() { var s; @@ -236,8 +254,6 @@ obj = Json.decode(s); printf("Decode/encode of\n\t%s\nyielded\n\t%s\n\n", s, Json.encode(obj)); } - -//testFormat(); testParse(); - +*/ %> Modified: branches/SAMBA_4_0/jsonrpc/jsondate.esp === --- branches/SAMBA_4_0/jsonrpc/jsondate.esp 2006-10-02 17:26:06 UTC (rev 19050) +++ branches/SAMBA_4_0/jsonrpc/jsondate.esp 2006-10-02 20:39:31 UTC (rev 19051) @@ -78,7 +78,7 @@ if (typeof(secondsSinceEpoch) != "number") { -var currentTime = getTimeOfDay(); +var currentTime = gettimeofday(); secondsSinceEpoch = currentTime.sec; microseconds = currentTime.usec; } @@ -105,7 +105,7 @@ { return this.month; } -o.getUtcMonth = getUtcMonth; +o.getUtcMonth = _getUtcMonth; function _getUtcDay() { @@ -167,7 +167,7 @@ if (! secondsSinceEpoch) { -var now = getTimeOfDay(); +var now = gettimeofday(); o.setEpochTime(now.sec); } else Modified: branches/SAMBA_4_0/jsonrpc/request.esp === --- branches/SAMBA_4_0/jsonrpc/request.esp 2006-10-02 17:26:06 UTC (rev 19050) +++ branches/SAMBA_4_0/jsonrpc/request.esp 2006-10-02 20:39:31 UTC (rev 19051) @@ -14,6 +14,7 @@ */ /* Bring in the date class */ +jsonrpc_include("json.esp"); jsonrpc_include("jsondate.esp"); /* bring the string functions into the global frame */ @@ -28,12 +29,6 @@ } -/* KLUDGE... */ -form = new Array(); -server = new Array(); -request = new Array(); -/* ...KLUDGE */ - /* * All of our manipulation of JSON RPC methods will be through this object. * Each class of methods will assign to here, and all of the constants will @@ -147,7 +142,7 @@ if (scriptTransportId == jsonrpc.Constant.ScriptTransport.NotInUse) { /* ... then just output the reply. */ -printf(reply); +write(reply); } else { @@ -156,43 +151,11 @@ "qx.io.remote.ScriptTransport._requestFinished(" + scriptTransportId + ", " + reply + ");"; -printf(reply); +write(reply); } } -/* - * class Json - * - * This class provides the JSON encoder and decoder, and some utility - * functions. - */ -Json = new Object(); - -/* KLUDGE... */ -function _jsonDecode(s) -{ -var o = new Object(); -o.id = 23; -o.service = "qooxdoo.test"; -o.method = "echo"; -o.params = new Array(1); -o.params[0] = "hello world"; -return o; -} -/* ...KLUDGE */ - -Json.decode = _jsonDecode; - -/* KLUDGE... */ -function _jsonEncode(o) -{ -return "{ result: \"hello world\" }" -} -/* ...KLUDGE */ - -Json.encode = _jsonEncode; - function _jsonValidRequest(req) { if (req == undefined) @@ -300,14 +263,14 @@ scriptTransportId = jsonrpc.Constant.ScriptTransport.NotInUse; /* What type of request did we receive? */ -if (server["REQUEST_METHOD"] == "POST" && -server["CONENT_TYPE"] == "text/json")
svn commit: samba r19050 - in branches/SAMBA_3_0_23/source/libsmb: .
Author: jra Date: 2006-10-02 17:26:06 + (Mon, 02 Oct 2006) New Revision: 19050 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19050 Log: Merge Volker's Vista RC1 fix - nice to get more testing on the release side of things. Jeremy. Modified: branches/SAMBA_3_0_23/source/libsmb/cliconnect.c branches/SAMBA_3_0_23/source/libsmb/clispnego.c Changeset: Modified: branches/SAMBA_3_0_23/source/libsmb/cliconnect.c === --- branches/SAMBA_3_0_23/source/libsmb/cliconnect.c2006-10-02 16:19:05 UTC (rev 19049) +++ branches/SAMBA_3_0_23/source/libsmb/cliconnect.c2006-10-02 17:26:06 UTC (rev 19050) @@ -746,16 +746,27 @@ /* make sure the server understands kerberos */ for (i=0;OIDs[i];i++) { DEBUG(3,("got OID=%s\n", OIDs[i])); -#ifdef HAVE_KRB5 if (strcmp(OIDs[i], OID_KERBEROS5_OLD) == 0 || strcmp(OIDs[i], OID_KERBEROS5) == 0) { got_kerberos_mechanism = True; } -#endif free(OIDs[i]); } - DEBUG(3,("got principal=%s\n", principal)); + DEBUG(3,("got principal=%s\n", principal ? principal : "")); + + if (got_kerberos_mechanism && (principal == NULL)) { + /* +* It is WRONG to depend on the principal sent in the negprot +* reply, but right now we do it. So for safety (don't +* segfault later) disable Kerberos when no principal was +* sent. -- VL +*/ + DEBUG(1, ("Kerberos mech was offered, but no principal was " + "sent, disabling Kerberos\n")); + cli->use_kerberos = False; + } + fstrcpy(cli->user_name, user); #ifdef HAVE_KRB5 Modified: branches/SAMBA_3_0_23/source/libsmb/clispnego.c === --- branches/SAMBA_3_0_23/source/libsmb/clispnego.c 2006-10-02 16:19:05 UTC (rev 19049) +++ branches/SAMBA_3_0_23/source/libsmb/clispnego.c 2006-10-02 17:26:06 UTC (rev 19050) @@ -149,13 +149,16 @@ asn1_end_tag(&data); asn1_end_tag(&data); - asn1_start_tag(&data, ASN1_CONTEXT(3)); - asn1_start_tag(&data, ASN1_SEQUENCE(0)); - asn1_start_tag(&data, ASN1_CONTEXT(0)); - asn1_read_GeneralString(&data,principal); - asn1_end_tag(&data); - asn1_end_tag(&data); - asn1_end_tag(&data); + *principal = NULL; + if (asn1_tag_remaining(&data) > 0) { + asn1_start_tag(&data, ASN1_CONTEXT(3)); + asn1_start_tag(&data, ASN1_SEQUENCE(0)); + asn1_start_tag(&data, ASN1_CONTEXT(0)); + asn1_read_GeneralString(&data,principal); + asn1_end_tag(&data); + asn1_end_tag(&data); + asn1_end_tag(&data); + } asn1_end_tag(&data); asn1_end_tag(&data);
svn commit: samba r19049 - in branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3: .
Author: jerry Date: 2006-10-02 16:19:05 + (Mon, 02 Oct 2006) New Revision: 19049 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19049 Log: Samba 3 client fixes * Make sure to check for NULL pointers when dealing with [out,unique] before assigning valoues * Detect RPC faults and return immediately Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm Changeset: Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm === --- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm 2006-10-02 15:23:03 UTC (rev 19048) +++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm 2006-10-02 16:19:05 UTC (rev 19049) @@ -58,6 +58,14 @@ pidl ""; pidl "status = cli_do_rpc_ndr(cli, mem_ctx, PI_$uif, $ufn, &r, (ndr_pull_flags_fn_t)ndr_pull_$fn->{NAME}, (ndr_push_flags_fn_t)ndr_push_$fn->{NAME});"; pidl ""; + + pidl "if ( !NT_STATUS_IS_OK(status) ) {"; + indent; + pidl "return status;"; + deindent; + pidl "}"; + + pidl ""; pidl "if (DEBUGLEVEL >= 10)"; pidl "\tNDR_PRINT_OUT_DEBUG($fn->{NAME}, &r);"; pidl ""; @@ -71,7 +79,16 @@ fatal($e, "[out] argument is not a pointer or array") if ($e->{LEVELS}[0]->{TYPE} ne "POINTER" and $e->{LEVELS}[0]->{TYPE} ne "ARRAY"); - pidl "*$e->{NAME} = *r.out.$e->{NAME};"; + if ( ($e->{LEVELS}[0]->{TYPE} eq "POINTER") && ($e->{LEVELS}[0]->{POINTER_TYPE} eq "unique") ) { + pidl "if ( $e->{NAME} ) {"; + indent; + pidl "*$e->{NAME} = *r.out.$e->{NAME};"; + deindent; + pidl "}"; + } else { + pidl "*$e->{NAME} = *r.out.$e->{NAME};"; + } + } pidl"";
svn commit: samba r19048 - in branches/SAMBA_4_0/source/scripting/ejs: .
Author: derrell Date: 2006-10-02 15:23:03 + (Mon, 02 Oct 2006) New Revision: 19048 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19048 Log: ensure our memory gets cleaned up even upon exception Modified: branches/SAMBA_4_0/source/scripting/ejs/literal.c Changeset: Modified: branches/SAMBA_4_0/source/scripting/ejs/literal.c === --- branches/SAMBA_4_0/source/scripting/ejs/literal.c 2006-10-02 14:06:04 UTC (rev 19047) +++ branches/SAMBA_4_0/source/scripting/ejs/literal.c 2006-10-02 15:23:03 UTC (rev 19048) @@ -92,7 +92,7 @@ tok.source = argv[0]; tok.pos = 0; -tok.ctx = talloc_new(NULL); +tok.ctx = talloc_new(mprMemCtx()); if (tok.ctx == NULL) { mpr_Return(eid, mprCreateUndefinedVar()); return 0;
svn commit: samba r19047 - in branches/tmp/vl-messaging/source/lib: .
Author: ab Date: 2006-10-02 14:06:04 + (Mon, 02 Oct 2006) New Revision: 19047 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19047 Log: Reformat and simplify code a bit; add some pointer checks. Patch from Aleksey Fedoseev Modified: branches/tmp/vl-messaging/source/lib/dbwrap_msg.c Changeset: Modified: branches/tmp/vl-messaging/source/lib/dbwrap_msg.c === --- branches/tmp/vl-messaging/source/lib/dbwrap_msg.c 2006-10-02 13:50:30 UTC (rev 19046) +++ branches/tmp/vl-messaging/source/lib/dbwrap_msg.c 2006-10-02 14:06:04 UTC (rev 19047) @@ -458,6 +458,10 @@ TDB_DATA buf; static BOOL traverse_msg_reg = False; int count = 0; + + if(fn == NULL) { + return -1; + } null_data.dsize = 0; null_data.dptr = NULL; @@ -484,7 +488,7 @@ while(ctx->record != NULL) { count++; - if(fn && fn(ctx->record->key, ctx->record->value, private_data)) { + if(fn(ctx->record->key, ctx->record->value, private_data)) { /* break the traversal */ TALLOC_FREE(ctx->record); message_deregister(MSG_DB_TRAVERSE); @@ -1105,6 +1109,8 @@ struct db_entry *database, struct db_records_list *record) { + SMB_ASSERT(record && record->key.dptr); + { char *keystr = hex_encode(NULL, (unsigned char *)record->key.dptr, record->key.dsize); @@ -1124,6 +1130,11 @@ TALLOC_FREE(li); data = msg_pack_data(NULL, database->idx, record->value); + + if(data.dptr == NULL) { + DEBUG(0, ("Can't pack data\n")); + return ; + } DEBUG(10, ("Sending fetchlock response (len %d) to %s\n", data.dsize, procid_str_static(&source))); @@ -1142,6 +1153,8 @@ static void process_db_delete(struct db_entry *database, struct db_records_list *record) { + SMB_ASSERT(record && record->key.dptr); + { char *keystr = hex_encode(NULL, (unsigned char *)record->key.dptr, record->key.dsize); @@ -1196,7 +1209,7 @@ void process_db_request(struct process_id *lockd_pid, struct process_id *src_pid, int msg_type, - char* buffer, + char *buffer, size_t len) { uint8_t idx; @@ -1210,78 +1223,79 @@ if(msg_type == MSG_DB_INIT) { /* create new database or return opened one */ process_db_init(lockd_pid, src_pid, buffer); + return; + } + + if(msg_type == MSG_DB_STORE) { + if(!msg_unpack_double_data(buffer, len, NULL, + &idx, &data1, &data2)) { + DEBUG(0, ("Can't unpack data\n")); + return ; + } } else { - if(msg_type == MSG_DB_STORE) { - if(!msg_unpack_double_data(buffer, len, NULL, - &idx, &data1, &data2)) { - DEBUG(0, ("Can't unpack data\n")); - return ; - } - } else { - data2.dsize = 0; - data2.dptr = NULL; + data2.dsize = 0; + data2.dptr = NULL; + + if(!msg_unpack_data(buffer, len, NULL, + &idx, &data1)) { + DEBUG(0, ("Can't unpack data\n")); + return ; + } + } + + /* find the database */ + dbl = find_db_by_index(idx); + if(dbl == NULL) { + DEBUG(0, ("Bad database index %d\n", idx)); + TALLOC_FREE(data1.dptr); + TALLOC_FREE(data2.dptr); + return ; + } + + if(msg_type == MSG_DB_FREE) { + + process_db_free(dbl); + + } else if(msg_type == MSG_DB_REINIT) { + + process_db_reinit(dbl); + + } else if(msg_type == MSG_DB_FETCHLOCK) { + + process_db_fetch(lockd_pid, src_pid, dbl, data1); + + } else if(msg_type == MSG_DB_TRAVERSE) { - if(!msg_unpack_data(buffer, len, NULL, - &idx, &data1)) { - DEBUG(0, ("Can't unpack data\n")); -
svn commit: samba r19046 - in branches/SAMBA_3_0/source/script/tests: .
Author: vlendec Date: 2006-10-02 13:50:30 + (Mon, 02 Oct 2006) New Revision: 19046 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19046 Log: It does not do much yet, but activate RPC-SAMBA3-SPOOLSS Modified: branches/SAMBA_3_0/source/script/tests/test_posix_s3.sh Changeset: Modified: branches/SAMBA_3_0/source/script/tests/test_posix_s3.sh === --- branches/SAMBA_3_0/source/script/tests/test_posix_s3.sh 2006-10-02 13:35:07 UTC (rev 19045) +++ branches/SAMBA_3_0/source/script/tests/test_posix_s3.sh 2006-10-02 13:50:30 UTC (rev 19046) @@ -34,7 +34,7 @@ raw="$raw RAW-SAMBA3HIDE RAW-SAMBA3BADPATH" rpc="RPC-AUTHCONTEXT RPC-BINDSAMBA3 RPC-SAMBA3-SRVSVC RPC-SAMBA3-SHARESEC" -rpc="$rpc RPC-UNIXINFO" +rpc="$rpc RPC-UNIXINFO RPC-SAMBA3-SPOOLSS" if test x$RUN_FROM_BUILD_FARM = xyes; then rpc="$rpc RPC-NETLOGSAMBA3 RPC-SAMBA3SESSIONKEY RPC-SAMBA3-GETUSERNAME"
svn commit: samba r19045 - in branches/tmp/vl-messaging/source/libsmb: .
Author: ab Date: 2006-10-02 13:35:07 + (Mon, 02 Oct 2006) New Revision: 19045 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19045 Log: Merge segfault fixes from Volker. -r 19040:19044 Modified: branches/tmp/vl-messaging/source/libsmb/cliconnect.c branches/tmp/vl-messaging/source/libsmb/clispnego.c Changeset: Modified: branches/tmp/vl-messaging/source/libsmb/cliconnect.c === --- branches/tmp/vl-messaging/source/libsmb/cliconnect.c2006-10-02 13:30:37 UTC (rev 19044) +++ branches/tmp/vl-messaging/source/libsmb/cliconnect.c2006-10-02 13:35:07 UTC (rev 19045) @@ -723,9 +723,7 @@ char *principal; char *OIDs[ASN1_MAX_OIDS]; int i; -#ifdef HAVE_KRB5 BOOL got_kerberos_mechanism = False; -#endif DATA_BLOB blob; DEBUG(3,("Doing spnego session setup (blob length=%lu)\n", (unsigned long)cli->secblob.length)); @@ -754,16 +752,27 @@ /* make sure the server understands kerberos */ for (i=0;OIDs[i];i++) { DEBUG(3,("got OID=%s\n", OIDs[i])); -#ifdef HAVE_KRB5 if (strcmp(OIDs[i], OID_KERBEROS5_OLD) == 0 || strcmp(OIDs[i], OID_KERBEROS5) == 0) { got_kerberos_mechanism = True; } -#endif free(OIDs[i]); } - DEBUG(3,("got principal=%s\n", principal)); + DEBUG(3,("got principal=%s\n", principal ? principal : "")); + + if (got_kerberos_mechanism && (principal == NULL)) { + /* +* It is WRONG to depend on the principal sent in the negprot +* reply, but right now we do it. So for safety (don't +* segfault later) disable Kerberos when no principal was +* sent. -- VL +*/ + DEBUG(1, ("Kerberos mech was offered, but no principal was " + "sent, disabling Kerberos\n")); + cli->use_kerberos = False; + } + fstrcpy(cli->user_name, user); #ifdef HAVE_KRB5 Modified: branches/tmp/vl-messaging/source/libsmb/clispnego.c === --- branches/tmp/vl-messaging/source/libsmb/clispnego.c 2006-10-02 13:30:37 UTC (rev 19044) +++ branches/tmp/vl-messaging/source/libsmb/clispnego.c 2006-10-02 13:35:07 UTC (rev 19045) @@ -149,13 +149,16 @@ asn1_end_tag(&data); asn1_end_tag(&data); - asn1_start_tag(&data, ASN1_CONTEXT(3)); - asn1_start_tag(&data, ASN1_SEQUENCE(0)); - asn1_start_tag(&data, ASN1_CONTEXT(0)); - asn1_read_GeneralString(&data,principal); - asn1_end_tag(&data); - asn1_end_tag(&data); - asn1_end_tag(&data); + *principal = NULL; + if (asn1_tag_remaining(&data) > 0) { + asn1_start_tag(&data, ASN1_CONTEXT(3)); + asn1_start_tag(&data, ASN1_SEQUENCE(0)); + asn1_start_tag(&data, ASN1_CONTEXT(0)); + asn1_read_GeneralString(&data,principal); + asn1_end_tag(&data); + asn1_end_tag(&data); + asn1_end_tag(&data); + } asn1_end_tag(&data); asn1_end_tag(&data);
svn commit: samba r19044 - in branches/tmp/vl-messaging: . examples/LDAP examples/libsmbclient examples/misc packaging/Debian/debian-sarge packaging/Debian/debian-woody packaging/RHEL packaging/RHEL/s
Author: ab Date: 2006-10-02 13:30:37 + (Mon, 02 Oct 2006) New Revision: 19044 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19044 Log: Merge vl-messaging with SAMBA_3_0 -r 17384:19040. Handle talloc and dlinklist API changes for messaging code. Added: branches/tmp/vl-messaging/.bzrignore branches/tmp/vl-messaging/source/.valgrind_suppressions branches/tmp/vl-messaging/source/TODO branches/tmp/vl-messaging/source/groupdb/mapping.h branches/tmp/vl-messaging/source/groupdb/mapping_ldb.c branches/tmp/vl-messaging/source/groupdb/mapping_tdb.c branches/tmp/vl-messaging/source/include/ads_protos.h branches/tmp/vl-messaging/source/include/core.h branches/tmp/vl-messaging/source/include/core/ branches/tmp/vl-messaging/source/include/dcerpc.h branches/tmp/vl-messaging/source/include/ndr.h branches/tmp/vl-messaging/source/lib/ldb/ branches/tmp/vl-messaging/source/lib/replace/ branches/tmp/vl-messaging/source/lib/socket_wrapper/ branches/tmp/vl-messaging/source/lib/talloc/ branches/tmp/vl-messaging/source/lib/util_nscd.c branches/tmp/vl-messaging/source/libaddns/ branches/tmp/vl-messaging/source/libgpo/ branches/tmp/vl-messaging/source/libgpo/gpo_filesync.c branches/tmp/vl-messaging/source/librpc/ branches/tmp/vl-messaging/source/modules/README.nfs4acls.txt branches/tmp/vl-messaging/source/modules/nfs4_acls.c branches/tmp/vl-messaging/source/modules/nfs4_acls.h branches/tmp/vl-messaging/source/modules/vfs_aixacl2.c branches/tmp/vl-messaging/source/nsswitch/winbindd_ccache_access.c branches/tmp/vl-messaging/source/printing/print_test.c branches/tmp/vl-messaging/source/rpc_server/srv_initshutdown_nt.c branches/tmp/vl-messaging/source/rpc_server/srv_winreg_nt.c branches/tmp/vl-messaging/source/script/build_idl.sh branches/tmp/vl-messaging/source/script/tests/test_groupmap.sh branches/tmp/vl-messaging/source/script/tests/test_local_s3.sh branches/tmp/vl-messaging/source/tdb/Makefile.in branches/tmp/vl-messaging/source/tdb/aclocal.m4 branches/tmp/vl-messaging/source/tdb/autogen.sh branches/tmp/vl-messaging/source/tdb/bin/ branches/tmp/vl-messaging/source/tdb/common/ branches/tmp/vl-messaging/source/tdb/config.m4 branches/tmp/vl-messaging/source/tdb/config.mk branches/tmp/vl-messaging/source/tdb/configure.in branches/tmp/vl-messaging/source/tdb/docs/ branches/tmp/vl-messaging/source/tdb/include/ branches/tmp/vl-messaging/source/tdb/swig/ branches/tmp/vl-messaging/source/tdb/tdb.pc.in branches/tmp/vl-messaging/source/tdb/tools/ branches/tmp/vl-messaging/source/utils/net_dns.c Removed: branches/tmp/vl-messaging/source/include/rpc_dfs.h branches/tmp/vl-messaging/source/include/rpc_echo.h branches/tmp/vl-messaging/source/include/rpc_reg.h branches/tmp/vl-messaging/source/include/rpc_shutdown.h branches/tmp/vl-messaging/source/include/rpc_srvsvc.h branches/tmp/vl-messaging/source/include/rpc_unixinfo.h branches/tmp/vl-messaging/source/include/rpc_wkssvc.h branches/tmp/vl-messaging/source/include/socket_wrapper.h branches/tmp/vl-messaging/source/include/talloc.h branches/tmp/vl-messaging/source/lib/getsmbpass.c branches/tmp/vl-messaging/source/lib/replace.c branches/tmp/vl-messaging/source/lib/replace1.c branches/tmp/vl-messaging/source/lib/snprintf.c branches/tmp/vl-messaging/source/lib/socket_wrapper.c branches/tmp/vl-messaging/source/lib/talloc.c branches/tmp/vl-messaging/source/lib/talloctort.c branches/tmp/vl-messaging/source/lib/timegm.c branches/tmp/vl-messaging/source/libads/gpo.c branches/tmp/vl-messaging/source/libads/gpo_util.c branches/tmp/vl-messaging/source/libndr/ branches/tmp/vl-messaging/source/libsmb/gpo.c branches/tmp/vl-messaging/source/rpc_client/cli_dfs.c branches/tmp/vl-messaging/source/rpc_client/cli_echo.c branches/tmp/vl-messaging/source/rpc_client/cli_shutdown.c branches/tmp/vl-messaging/source/rpc_client/cli_srvsvc.c branches/tmp/vl-messaging/source/rpc_client/cli_unixinfo.c branches/tmp/vl-messaging/source/rpc_client/cli_wkssvc.c branches/tmp/vl-messaging/source/rpc_parse/parse_dfs.c branches/tmp/vl-messaging/source/rpc_parse/parse_echo.c branches/tmp/vl-messaging/source/rpc_parse/parse_reg.c branches/tmp/vl-messaging/source/rpc_parse/parse_shutdown.c branches/tmp/vl-messaging/source/rpc_parse/parse_srv.c branches/tmp/vl-messaging/source/rpc_parse/parse_unixinfo.c branches/tmp/vl-messaging/source/rpc_parse/parse_wks.c branches/tmp/vl-messaging/source/rpc_server/srv_dfs.c branches/tmp/vl-messaging/source/rpc_server/srv_echo.c branches/tmp/vl-messaging/source/rpc_server/srv_reg.c branches/tmp/vl-messaging/source/rpc_server/srv_reg_nt.c branches/tmp/vl-messaging/source/rpc_server/srv_srvsvc.c branches/tmp/vl-messaging/source/rpc_server/srv_unixinfo.c branches/tmp/vl-messaging/source/rpc_server/srv_wkssvc.c bran
svn commit: samba r19043 - in branches/SAMBA_3_0/source/libsmb: .
Author: vlendec Date: 2006-10-02 13:30:05 + (Mon, 02 Oct 2006) New Revision: 19043 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19043 Log: There's no point in #ifdef'ing the detection whether we were offered KRB5 in SPNEGO, as long as we don't make use of it without krb libs. Makes the code a bit simpler. Volker Modified: branches/SAMBA_3_0/source/libsmb/cliconnect.c Changeset: Modified: branches/SAMBA_3_0/source/libsmb/cliconnect.c === --- branches/SAMBA_3_0/source/libsmb/cliconnect.c 2006-10-02 13:09:42 UTC (rev 19042) +++ branches/SAMBA_3_0/source/libsmb/cliconnect.c 2006-10-02 13:30:05 UTC (rev 19043) @@ -723,9 +723,7 @@ char *principal; char *OIDs[ASN1_MAX_OIDS]; int i; -#ifdef HAVE_KRB5 BOOL got_kerberos_mechanism = False; -#endif DATA_BLOB blob; DEBUG(3,("Doing spnego session setup (blob length=%lu)\n", (unsigned long)cli->secblob.length)); @@ -754,18 +752,15 @@ /* make sure the server understands kerberos */ for (i=0;OIDs[i];i++) { DEBUG(3,("got OID=%s\n", OIDs[i])); -#ifdef HAVE_KRB5 if (strcmp(OIDs[i], OID_KERBEROS5_OLD) == 0 || strcmp(OIDs[i], OID_KERBEROS5) == 0) { got_kerberos_mechanism = True; } -#endif free(OIDs[i]); } DEBUG(3,("got principal=%s\n", principal ? principal : "")); -#ifdef HAVE_KRB5 if (got_kerberos_mechanism && (principal == NULL)) { /* * It is WRONG to depend on the principal sent in the negprot @@ -773,11 +768,10 @@ * segfault later) disable Kerberos when no principal was * sent. -- VL */ - DEBUG(1, ("Kerberos mech was offered, but no principal was sent\n")); - DEBUGADD(1, ("Disabling Kerberos\n")); + DEBUG(1, ("Kerberos mech was offered, but no principal was " + "sent, disabling Kerberos\n")); cli->use_kerberos = False; } -#endif fstrcpy(cli->user_name, user);
svn commit: samba r19042 - in branches/SAMBA_3_0/source/libsmb: .
Author: vlendec Date: 2006-10-02 13:09:42 + (Mon, 02 Oct 2006) New Revision: 19042 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19042 Log: Fix the non-krb5 build. This needs sooo severe cleanup ... :-) Volker Modified: branches/SAMBA_3_0/source/libsmb/cliconnect.c Changeset: Modified: branches/SAMBA_3_0/source/libsmb/cliconnect.c === --- branches/SAMBA_3_0/source/libsmb/cliconnect.c 2006-10-02 12:54:49 UTC (rev 19041) +++ branches/SAMBA_3_0/source/libsmb/cliconnect.c 2006-10-02 13:09:42 UTC (rev 19042) @@ -765,6 +765,7 @@ DEBUG(3,("got principal=%s\n", principal ? principal : "")); +#ifdef HAVE_KRB5 if (got_kerberos_mechanism && (principal == NULL)) { /* * It is WRONG to depend on the principal sent in the negprot @@ -776,6 +777,7 @@ DEBUGADD(1, ("Disabling Kerberos\n")); cli->use_kerberos = False; } +#endif fstrcpy(cli->user_name, user);
svn commit: samba r19041 - in branches/SAMBA_3_0/source/libsmb: .
Author: vlendec Date: 2006-10-02 12:54:49 + (Mon, 02 Oct 2006) New Revision: 19041 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19041 Log: Make us connect to Vista RC1. Apparently metze had done the same patch some weeks ago. We have some work before us, when in AD mode Vista sends "[EMAIL PROTECTED]" as the principal. Volker Modified: branches/SAMBA_3_0/source/libsmb/cliconnect.c branches/SAMBA_3_0/source/libsmb/clispnego.c Changeset: Modified: branches/SAMBA_3_0/source/libsmb/cliconnect.c === --- branches/SAMBA_3_0/source/libsmb/cliconnect.c 2006-10-02 12:24:51 UTC (rev 19040) +++ branches/SAMBA_3_0/source/libsmb/cliconnect.c 2006-10-02 12:54:49 UTC (rev 19041) @@ -762,8 +762,21 @@ #endif free(OIDs[i]); } - DEBUG(3,("got principal=%s\n", principal)); + DEBUG(3,("got principal=%s\n", principal ? principal : "")); + + if (got_kerberos_mechanism && (principal == NULL)) { + /* +* It is WRONG to depend on the principal sent in the negprot +* reply, but right now we do it. So for safety (don't +* segfault later) disable Kerberos when no principal was +* sent. -- VL +*/ + DEBUG(1, ("Kerberos mech was offered, but no principal was sent\n")); + DEBUGADD(1, ("Disabling Kerberos\n")); + cli->use_kerberos = False; + } + fstrcpy(cli->user_name, user); #ifdef HAVE_KRB5 Modified: branches/SAMBA_3_0/source/libsmb/clispnego.c === --- branches/SAMBA_3_0/source/libsmb/clispnego.c2006-10-02 12:24:51 UTC (rev 19040) +++ branches/SAMBA_3_0/source/libsmb/clispnego.c2006-10-02 12:54:49 UTC (rev 19041) @@ -149,13 +149,16 @@ asn1_end_tag(&data); asn1_end_tag(&data); - asn1_start_tag(&data, ASN1_CONTEXT(3)); - asn1_start_tag(&data, ASN1_SEQUENCE(0)); - asn1_start_tag(&data, ASN1_CONTEXT(0)); - asn1_read_GeneralString(&data,principal); - asn1_end_tag(&data); - asn1_end_tag(&data); - asn1_end_tag(&data); + *principal = NULL; + if (asn1_tag_remaining(&data) > 0) { + asn1_start_tag(&data, ASN1_CONTEXT(3)); + asn1_start_tag(&data, ASN1_SEQUENCE(0)); + asn1_start_tag(&data, ASN1_CONTEXT(0)); + asn1_read_GeneralString(&data,principal); + asn1_end_tag(&data); + asn1_end_tag(&data); + asn1_end_tag(&data); + } asn1_end_tag(&data); asn1_end_tag(&data);
svn commit: samba r19040 - in branches/SAMBA_3_0/source/script/tests: .
Author: metze Date: 2006-10-02 12:24:51 + (Mon, 02 Oct 2006) New Revision: 19040 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19040 Log: use more portable shellscripting, hopefully give better results on Tru64 metze Modified: branches/SAMBA_3_0/source/script/tests/gdb_backtrace Changeset: Modified: branches/SAMBA_3_0/source/script/tests/gdb_backtrace === --- branches/SAMBA_3_0/source/script/tests/gdb_backtrace2006-10-02 12:06:49 UTC (rev 19039) +++ branches/SAMBA_3_0/source/script/tests/gdb_backtrace2006-10-02 12:24:51 UTC (rev 19040) @@ -5,9 +5,9 @@ # we want everything on stderr, so the program is not disturbed exec 1>&2 -BASENAME=$( basename $0) +BASENAME=`basename $0` -test -z ${GDB_BIN} && GDB_BIN=$( type -p gdb) +test -z ${GDB_BIN} && GDB_BIN=`type -p gdb` if [ -z ${GDB_BIN} ]; then echo "ERROR: ${BASENAME} needs an installed gdb. " exit 1
svn commit: samba r19039 - in branches: SAMBA_3_0/source/libads SAMBA_3_0/source/utils SAMBA_3_0_23/source/libads SAMBA_3_0_23/source/utils
Author: gd Date: 2006-10-02 12:06:49 + (Mon, 02 Oct 2006) New Revision: 19039 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19039 Log: Do not segfault in "net ads printer info" when a requested printserver does not exist. Guenther Modified: branches/SAMBA_3_0/source/libads/ldap_printer.c branches/SAMBA_3_0/source/utils/net_ads.c branches/SAMBA_3_0_23/source/libads/ldap_printer.c branches/SAMBA_3_0_23/source/utils/net_ads.c Changeset: Modified: branches/SAMBA_3_0/source/libads/ldap_printer.c === --- branches/SAMBA_3_0/source/libads/ldap_printer.c 2006-10-02 11:35:41 UTC (rev 19038) +++ branches/SAMBA_3_0/source/libads/ldap_printer.c 2006-10-02 12:06:49 UTC (rev 19039) @@ -41,8 +41,18 @@ servername)); return status; } + if (ads_count_replies(ads, *res) != 1) { + return ADS_ERROR(LDAP_NO_SUCH_OBJECT); + } srv_dn = ldap_get_dn(ads->ld, *res); + if (srv_dn == NULL) { + return ADS_ERROR(LDAP_NO_MEMORY); + } srv_cn = ldap_explode_dn(srv_dn, 1); + if (srv_cn == NULL) { + ldap_memfree(srv_dn); + return ADS_ERROR(LDAP_INVALID_DN_SYNTAX); + } ads_msgfree(ads, *res); asprintf(&s, "(cn=%s-%s)", srv_cn[0], printer); Modified: branches/SAMBA_3_0/source/utils/net_ads.c === --- branches/SAMBA_3_0/source/utils/net_ads.c 2006-10-02 11:35:41 UTC (rev 19038) +++ branches/SAMBA_3_0/source/utils/net_ads.c 2006-10-02 12:06:49 UTC (rev 19039) @@ -1634,7 +1634,8 @@ rc = ads_find_printer_on_server(ads, &res, printername, servername); if (!ADS_ERR_OK(rc)) { - d_fprintf(stderr, "ads_find_printer_on_server: %s\n", ads_errstr(rc)); + d_fprintf(stderr, "Server '%s' not found: %s\n", + servername, ads_errstr(rc)); ads_msgfree(ads, res); ads_destroy(&ads); return -1; Modified: branches/SAMBA_3_0_23/source/libads/ldap_printer.c === --- branches/SAMBA_3_0_23/source/libads/ldap_printer.c 2006-10-02 11:35:41 UTC (rev 19038) +++ branches/SAMBA_3_0_23/source/libads/ldap_printer.c 2006-10-02 12:06:49 UTC (rev 19039) @@ -40,8 +40,18 @@ servername)); return status; } + if (ads_count_replies(ads, *res) != 1) { + return ADS_ERROR(LDAP_NO_SUCH_OBJECT); + } srv_dn = ldap_get_dn(ads->ld, *res); + if (srv_dn == NULL) { + return ADS_ERROR(LDAP_NO_MEMORY); + } srv_cn = ldap_explode_dn(srv_dn, 1); + if (srv_cn == NULL) { + ldap_memfree(srv_dn); + return ADS_ERROR(LDAP_INVALID_DN_SYNTAX); + } ads_msgfree(ads, *res); asprintf(&s, "(cn=%s-%s)", srv_cn[0], printer); Modified: branches/SAMBA_3_0_23/source/utils/net_ads.c === --- branches/SAMBA_3_0_23/source/utils/net_ads.c2006-10-02 11:35:41 UTC (rev 19038) +++ branches/SAMBA_3_0_23/source/utils/net_ads.c2006-10-02 12:06:49 UTC (rev 19039) @@ -1426,7 +1426,8 @@ rc = ads_find_printer_on_server(ads, &res, printername, servername); if (!ADS_ERR_OK(rc)) { - d_fprintf(stderr, "ads_find_printer_on_server: %s\n", ads_errstr(rc)); + d_fprintf(stderr, "Server '%s' not found: %s\n", + servername, ads_errstr(rc)); ads_msgfree(ads, res); ads_destroy(&ads); return -1;
svn commit: samba r19038 - in branches/SAMBA_3_0/source: . script/tests
Author: metze Date: 2006-10-02 11:35:41 + (Mon, 02 Oct 2006) New Revision: 19038 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19038 Log: build libreplace testsuite as replacetort and run it with make test metze Modified: branches/SAMBA_3_0/source/Makefile.in branches/SAMBA_3_0/source/script/tests/test_local_s3.sh Changeset: Modified: branches/SAMBA_3_0/source/Makefile.in === --- branches/SAMBA_3_0/source/Makefile.in 2006-10-02 11:03:53 UTC (rev 19037) +++ branches/SAMBA_3_0/source/Makefile.in 2006-10-02 11:35:41 UTC (rev 19038) @@ -160,11 +160,12 @@ TORTURE_PROGS = bin/[EMAIL PROTECTED]@ bin/[EMAIL PROTECTED]@ \ bin/[EMAIL PROTECTED]@ bin/[EMAIL PROTECTED]@ \ bin/[EMAIL PROTECTED]@ bin/[EMAIL PROTECTED]@ bin/[EMAIL PROTECTED]@ \ - bin/[EMAIL PROTECTED]@ bin/[EMAIL PROTECTED]@ + bin/[EMAIL PROTECTED]@ bin/[EMAIL PROTECTED]@ bin/[EMAIL PROTECTED]@ BIN_PROGS = $(BIN_PROGS1) $(BIN_PROGS2) $(BIN_PROGS3) $(BIN_PROGS4) @EXTRA_BIN_PROGS@ -EVERYTHING_PROGS = bin/[EMAIL PROTECTED]@ bin/[EMAIL PROTECTED]@ bin/[EMAIL PROTECTED]@ \ +EVERYTHING_PROGS = bin/[EMAIL PROTECTED]@ bin/[EMAIL PROTECTED]@ \ + bin/[EMAIL PROTECTED]@ bin/[EMAIL PROTECTED]@ \ bin/[EMAIL PROTECTED]@ SHLIBS = @SHLIB_PROGS@ @LIBSMBCLIENT@ @LIBSMBSHAREMODES@ @LIBMSRPC@ @LIBADDNS@ @@ -221,9 +222,13 @@ RPC_PARSE_OBJ0 = rpc_parse/parse_prs.o rpc_parse/parse_misc.o +LIBREPLACE_OBJ = @LIBREPLACE_OBJS@ + +SOCKET_WRAPPER_OBJ = @SOCKET_WRAPPER_OBJS@ + TALLOC_OBJ = lib/talloc/talloc.o -LIB_WITHOUT_PROTO_OBJ = @LIBREPLACE_OBJS@ @SOCKET_WRAPPER_OBJS@ $(TALLOC_OBJ) +LIB_WITHOUT_PROTO_OBJ = $(LIBREPLACE_OBJ) $(SOCKET_WRAPPER_OBJ) $(TALLOC_OBJ) LIB_WITH_PROTO_OBJ = $(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \ lib/interface.o lib/md4.o \ @@ -694,6 +699,9 @@ TALLOCTORT_OBJ = lib/talloc/testsuite.o $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) \ $(RPC_PARSE_OBJ1) $(DOSERR_OBJ) $(LIBSAMBA_OBJ) $(SECRETS_OBJ) +REPLACETORT_OBJ = lib/replace/test/testsuite.o lib/replace/test/os2_delete.o \ + $(LIBREPLACE_OBJ) + RPCTORTURE_OBJ = torture/rpctorture.o \ rpcclient/display.o \ rpcclient/cmd_lsarpc.o \ @@ -874,6 +882,8 @@ talloctort : SHOWFLAGS bin/[EMAIL PROTECTED]@ +replacetort : SHOWFLAGS bin/[EMAIL PROTECTED]@ + timelimit : SHOWFLAGS bin/[EMAIL PROTECTED]@ nsswitch : SHOWFLAGS bin/[EMAIL PROTECTED]@ bin/[EMAIL PROTECTED]@ @WINBIND_NSS@ \ @@ -899,7 +909,7 @@ # -everything: all libsmbclient debug2html smbfilter talloctort modules torture \ +everything: all libsmbclient debug2html smbfilter talloctort replacetort modules torture \ $(EVERYTHING_PROGS) .SUFFIXES: @@ -1113,6 +1123,11 @@ @$(CC) $(FLAGS) @PIE_LDFLAGS@ -o $@ $(TALLOCTORT_OBJ) $(LDFLAGS) \ $(DYNEXP) $(LIBS) $(LDAP_LIBS) +bin/[EMAIL PROTECTED]@: $(REPLACETORT_OBJ) bin/.dummy + @echo Linking $@ + @$(CC) $(FLAGS) @PIE_LDFLAGS@ -o $@ $(REPLACETORT_OBJ) $(LDFLAGS) \ + $(DYNEXP) $(LIBS) + bin/[EMAIL PROTECTED]@: $(MASKTEST_OBJ) bin/.dummy @echo Linking $@ @$(CC) $(FLAGS) @PIE_LDFLAGS@ -o $@ $(MASKTEST_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) Modified: branches/SAMBA_3_0/source/script/tests/test_local_s3.sh === --- branches/SAMBA_3_0/source/script/tests/test_local_s3.sh 2006-10-02 11:03:53 UTC (rev 19037) +++ branches/SAMBA_3_0/source/script/tests/test_local_s3.sh 2006-10-02 11:35:41 UTC (rev 19038) @@ -17,4 +17,7 @@ testit "talloctort" $VALGRIND $BINDIR/talloctort || \ failed=`expr $failed + 1` +testit "replacetort" $VALGRIND $BINDIR/replacetort || \ +failed=`expr $failed + 1` + testok $0 $failed
svn commit: samba r19037 - in branches: SAMBA_3_0/source/libsmb SAMBA_3_0_23/source/libsmb
Author: vlendec Date: 2006-10-02 11:03:53 + (Mon, 02 Oct 2006) New Revision: 19037 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19037 Log: Fix a segfault Modified: branches/SAMBA_3_0/source/libsmb/clispnego.c branches/SAMBA_3_0_23/source/libsmb/clispnego.c Changeset: Modified: branches/SAMBA_3_0/source/libsmb/clispnego.c === --- branches/SAMBA_3_0/source/libsmb/clispnego.c2006-10-02 10:45:00 UTC (rev 19036) +++ branches/SAMBA_3_0/source/libsmb/clispnego.c2006-10-02 11:03:53 UTC (rev 19037) @@ -165,7 +165,7 @@ ret = !data.has_error; if (data.has_error) { int j; - SAFE_FREE(principal); + SAFE_FREE(*principal); for(j = 0; j < i && j < ASN1_MAX_OIDS-1; j++) { SAFE_FREE(OIDs[j]); } Modified: branches/SAMBA_3_0_23/source/libsmb/clispnego.c === --- branches/SAMBA_3_0_23/source/libsmb/clispnego.c 2006-10-02 10:45:00 UTC (rev 19036) +++ branches/SAMBA_3_0_23/source/libsmb/clispnego.c 2006-10-02 11:03:53 UTC (rev 19037) @@ -165,7 +165,7 @@ ret = !data.has_error; if (data.has_error) { int j; - SAFE_FREE(principal); + SAFE_FREE(*principal); for(j = 0; j < i && j < ASN1_MAX_OIDS-1; j++) { SAFE_FREE(OIDs[j]); }
svn commit: samba r19036 - in branches/SAMBA_4_0/source/script/tests: .
Author: metze Date: 2006-10-02 10:45:00 + (Mon, 02 Oct 2006) New Revision: 19036 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19036 Log: add LOCAL-REPLACE and reorder the testlist metze Modified: branches/SAMBA_4_0/source/script/tests/test_local.sh Changeset: Modified: branches/SAMBA_4_0/source/script/tests/test_local.sh === --- branches/SAMBA_4_0/source/script/tests/test_local.sh2006-10-02 10:38:24 UTC (rev 19035) +++ branches/SAMBA_4_0/source/script/tests/test_local.sh2006-10-02 10:45:00 UTC (rev 19036) @@ -1,9 +1,11 @@ #!/bin/sh -local_tests="LOCAL-NTLMSSP LOCAL-TALLOC LOCAL-MESSAGING LOCAL-IRPC" -local_tests="$local_tests LOCAL-BINDING LOCAL-IDTREE LOCAL-SOCKET" -local_tests="$local_tests LOCAL-PAC LOCAL-STRLIST LOCAL-SDDL LOCAL-NDR" -local_tests="$local_tests LOCAL-EVENT LOCAL-CRYPTO-MD4" +local_tests="LOCAL-REPLACE LOCAL-TALLOC LOCAL-STRLIST" +local_tests="$local_tests LOCAL-IDTREE LOCAL-EVENT" +local_tests="$local_tests LOCAL-SOCKET LOCAL-MESSAGING LOCAL-IRPC" +local_tests="$local_tests LOCAL-NDR LOCAL-BINDING" +local_tests="$local_tests LOCAL-SDDL LOCAL-PAC" +local_tests="$local_tests LOCAL-NTLMSSP LOCAL-CRYPTO-MD4" local_tests="$local_tests LOCAL-CRYPTO-MD5 LOCAL-CRYPTO-HMACMD5" local_tests="$local_tests LOCAL-CRYPTO-SHA1 LOCAL-CRYPTO-HMACSHA1"
svn commit: samba r19035 - in branches/SAMBA_4_0/source/torture/local: .
Author: metze Date: 2006-10-02 10:38:24 + (Mon, 02 Oct 2006) New Revision: 19035 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19035 Log: add LOCAL-REPLACE test metze Modified: branches/SAMBA_4_0/source/torture/local/config.mk branches/SAMBA_4_0/source/torture/local/local.c Changeset: Modified: branches/SAMBA_4_0/source/torture/local/config.mk === --- branches/SAMBA_4_0/source/torture/local/config.mk 2006-10-02 10:37:17 UTC (rev 19034) +++ branches/SAMBA_4_0/source/torture/local/config.mk 2006-10-02 10:38:24 UTC (rev 19035) @@ -7,6 +7,8 @@ proto.h OBJ_FILES = \ iconv.o \ + ../../lib/replace/test/testsuite.o \ + ../../lib/replace/test/os2_delete.o \ ../../lib/talloc/testsuite.o \ ../../lib/crypto/md4test.o \ ../../lib/crypto/md5test.o \ Modified: branches/SAMBA_4_0/source/torture/local/local.c === --- branches/SAMBA_4_0/source/torture/local/local.c 2006-10-02 10:37:17 UTC (rev 19034) +++ branches/SAMBA_4_0/source/torture/local/local.c 2006-10-02 10:38:24 UTC (rev 19035) @@ -50,6 +50,7 @@ int i; TALLOC_CTX *mem_ctx = talloc_autofree_context(); + register_torture_op("LOCAL-REPLACE", torture_local_replace); register_torture_op("LOCAL-TALLOC", torture_local_talloc); register_torture_op("LOCAL-CRYPTO-MD4", torture_local_crypto_md4); register_torture_op("LOCAL-CRYPTO-MD5", torture_local_crypto_md5);
svn commit: samba r19034 - in branches/SAMBA_3_0/source/lib/replace/test: .
Author: metze Date: 2006-10-02 10:37:17 + (Mon, 02 Oct 2006) New Revision: 19034 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19034 Log: merge from samba4: prepare libreplace testsuite for usage in smbtorture metze Modified: branches/SAMBA_3_0/source/lib/replace/test/testsuite.c Changeset: Modified: branches/SAMBA_3_0/source/lib/replace/test/testsuite.c === --- branches/SAMBA_3_0/source/lib/replace/test/testsuite.c 2006-10-02 10:35:40 UTC (rev 19033) +++ branches/SAMBA_3_0/source/lib/replace/test/testsuite.c 2006-10-02 10:37:17 UTC (rev 19034) @@ -89,7 +89,7 @@ char buf[4]; const struct { const char *src; - int result; + size_t result; } tests[] = { { "abc", 3 }, { "abcdef", 6 }, @@ -373,9 +373,11 @@ return true; } -int torture_local_replace(void *ctx) +struct torture_context; + +bool torture_local_replace(struct torture_context *torture) { - int ret = true; + bool ret = true; ret &= test_ftruncate(); ret &= test_strlcpy(); ret &= test_strlcat(); @@ -423,7 +425,7 @@ return ret; } -#if !defined(_SAMBA_BUILD_) || ((SAMBA_VERSION_MAJOR==3)&&(SAMBA_VERSION_MINOR<9)) +#if _SAMBA_BUILD_<4 int main(void) { if (!torture_local_replace(NULL)) {
svn commit: samba r19033 - in branches/SAMBA_4_0/source/lib/replace/test: .
Author: metze Date: 2006-10-02 10:35:40 + (Mon, 02 Oct 2006) New Revision: 19033 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19033 Log: prepare to use the libreplace testsuite as LOCAL-REPLACE in smbtorture metze Modified: branches/SAMBA_4_0/source/lib/replace/test/testsuite.c Changeset: Modified: branches/SAMBA_4_0/source/lib/replace/test/testsuite.c === --- branches/SAMBA_4_0/source/lib/replace/test/testsuite.c 2006-10-02 09:26:05 UTC (rev 19032) +++ branches/SAMBA_4_0/source/lib/replace/test/testsuite.c 2006-10-02 10:35:40 UTC (rev 19033) @@ -89,7 +89,7 @@ char buf[4]; const struct { const char *src; - int result; + size_t result; } tests[] = { { "abc", 3 }, { "abcdef", 6 }, @@ -373,9 +373,11 @@ return true; } -int torture_local_replace(void *ctx) +struct torture_context; + +bool torture_local_replace(struct torture_context *torture) { - int ret = true; + bool ret = true; ret &= test_ftruncate(); ret &= test_strlcpy(); ret &= test_strlcat(); @@ -423,7 +425,7 @@ return ret; } -#if !defined(_SAMBA_BUILD_) || ((SAMBA_VERSION_MAJOR==3)&&(SAMBA_VERSION_MINOR<9)) +#if _SAMBA_BUILD_<4 int main(void) { if (!torture_local_replace(NULL)) {
svn commit: samba r19032 - in branches/SAMBA_4_0/source/lib/replace: .
Author: metze Date: 2006-10-02 09:26:05 + (Mon, 02 Oct 2006) New Revision: 19032 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19032 Log: let the getdents replacement fail and see what the build-farm says. metze Modified: branches/SAMBA_4_0/source/lib/replace/repdir.m4 Changeset: Modified: branches/SAMBA_4_0/source/lib/replace/repdir.m4 === --- branches/SAMBA_4_0/source/lib/replace/repdir.m4 2006-10-02 09:21:20 UTC (rev 19031) +++ branches/SAMBA_4_0/source/lib/replace/repdir.m4 2006-10-02 09:26:05 UTC (rev 19032) @@ -54,6 +54,7 @@ AC_CACHE_CHECK([for replacing readdir using getdents()],libreplace_cv_READDIR_GETDENTS,[ AC_TRY_RUN([ #define _LIBREPLACE_REPLACE_H +#error _donot_use_getdents_replacement_anymore #include "$libreplacedir/repdir_getdents.c" #define test_readdir_os2_delete main #include "$libreplacedir/test/os2_delete.c"],
svn commit: samba r19031 - in branches/SAMBA_3_0/source/lib/replace/test: .
Author: metze Date: 2006-10-02 09:21:20 + (Mon, 02 Oct 2006) New Revision: 19031 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19031 Log: merge from samba4: add test that opendir() on files sets errno = ENOTDIR metze Modified: branches/SAMBA_3_0/source/lib/replace/test/os2_delete.c Changeset: Modified: branches/SAMBA_3_0/source/lib/replace/test/os2_delete.c === --- branches/SAMBA_3_0/source/lib/replace/test/os2_delete.c 2006-10-02 09:20:18 UTC (rev 19030) +++ branches/SAMBA_3_0/source/lib/replace/test/os2_delete.c 2006-10-02 09:21:20 UTC (rev 19031) @@ -21,7 +21,7 @@ static int test_readdir_os2_delete_ret; -#define FAILED(d) (fprintf(stderr, "Failed for %s - %s\n", d, strerror(errno)), test_readdir_os2_delete_ret = 1, 1) +#define FAILED(d) (fprintf(stderr, "Failed for %s - %d = %s\n", d, errno, strerror(errno)), test_readdir_os2_delete_ret = 1, 1) #ifndef MIN #define MIN(a,b) ((a)<(b)?(a):(b)) @@ -87,7 +87,11 @@ cleanup(); create_files(); - + + d = opendir(TESTDIR "/test0.txt"); + if (d != NULL) FAILED("opendir() on file succeed"); + if (errno != ENOTDIR) FAILED("opendir() on file didn't give ENOTDIR"); + d = opendir(TESTDIR); /* skip past . and .. */
svn commit: samba r19030 - in branches/SAMBA_3_0/source/lib/replace: .
Author: metze Date: 2006-10-02 09:20:18 + (Mon, 02 Oct 2006) New Revision: 19030 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19030 Log: merge missing stuff from samba4: - strnlen() and strndup() are broken on AIX - we need some extra CFLAGS on HPUX 11.11 metze Modified: branches/SAMBA_3_0/source/lib/replace/libreplace_cc.m4 branches/SAMBA_3_0/source/lib/replace/replace.h Changeset: Modified: branches/SAMBA_3_0/source/lib/replace/libreplace_cc.m4 === --- branches/SAMBA_3_0/source/lib/replace/libreplace_cc.m4 2006-10-02 08:56:35 UTC (rev 19029) +++ branches/SAMBA_3_0/source/lib/replace/libreplace_cc.m4 2006-10-02 09:20:18 UTC (rev 19030) @@ -60,8 +60,14 @@ *hpux*) # mmap on HPUX is completely broken... AC_DEFINE(MMAP_BLACKLIST, 1, [Whether MMAP is broken]) + if test "`uname -r`" = "B.11.11"; then + AC_MSG_WARN([Enabling HPUX 11.11 header bug workaround]) + CFLAGS="$CFLAGS -D_LARGEFILE64_SUPPORT -D__LP64__ -DO_LARGEFILE=04000" + fi ;; *aix*) + AC_DEFINE(BROKEN_STRNDUP, 1, [Whether strndup is broken]) + AC_DEFINE(BROKEN_STRNLEN, 1, [Whether strnlen is broken]) if test "${GCC}" != "yes"; then ## for funky AIX compiler using strncpy() CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000" Modified: branches/SAMBA_3_0/source/lib/replace/replace.h === --- branches/SAMBA_3_0/source/lib/replace/replace.h 2006-10-02 08:56:35 UTC (rev 19029) +++ branches/SAMBA_3_0/source/lib/replace/replace.h 2006-10-02 09:20:18 UTC (rev 19030) @@ -121,12 +121,14 @@ size_t rep_strlcat(char *d, const char *s, size_t bufsize); #endif -#ifndef HAVE_STRNDUP +#if (defined(BROKEN_STRNDUP) || !defined(HAVE_STRNDUP)) +#undef HAVE_STRNDUP #define strndup rep_strndup char *rep_strndup(const char *s, size_t n); #endif -#ifndef HAVE_STRNLEN +#if (defined(BROKEN_STRNLEN) || !defined(HAVE_STRNLEN)) +#undef HAVE_STRNLEN #define strnlen rep_strnlen size_t rep_strnlen(const char *s, size_t n); #endif
svn commit: samba r19029 - in branches/SAMBA_4_0/source/lib/replace/test: .
Author: metze Date: 2006-10-02 08:56:35 + (Mon, 02 Oct 2006) New Revision: 19029 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19029 Log: test if opendir() on a file sets errno = ENOTDIR metze Modified: branches/SAMBA_4_0/source/lib/replace/test/os2_delete.c Changeset: Modified: branches/SAMBA_4_0/source/lib/replace/test/os2_delete.c === --- branches/SAMBA_4_0/source/lib/replace/test/os2_delete.c 2006-10-02 08:38:54 UTC (rev 19028) +++ branches/SAMBA_4_0/source/lib/replace/test/os2_delete.c 2006-10-02 08:56:35 UTC (rev 19029) @@ -21,7 +21,7 @@ static int test_readdir_os2_delete_ret; -#define FAILED(d) (fprintf(stderr, "Failed for %s - %s\n", d, strerror(errno)), test_readdir_os2_delete_ret = 1, 1) +#define FAILED(d) (fprintf(stderr, "Failed for %s - %d = %s\n", d, errno, strerror(errno)), test_readdir_os2_delete_ret = 1, 1) #ifndef MIN #define MIN(a,b) ((a)<(b)?(a):(b)) @@ -87,7 +87,11 @@ cleanup(); create_files(); - + + d = opendir(TESTDIR "/test0.txt"); + if (d != NULL) FAILED("opendir() on file succeed"); + if (errno != ENOTDIR) FAILED("opendir() on file didn't give ENOTDIR"); + d = opendir(TESTDIR); /* skip past . and .. */
svn commit: samba r19028 - in branches/SAMBA_3_0/source: include rpc_parse rpc_server
Author: vlendec Date: 2006-10-02 08:38:54 + (Mon, 02 Oct 2006) New Revision: 19028 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19028 Log: Implement getprinterinfo level 6 (only the status) and get rid of snum in the getprinter calls. Survives the RPC-SAMBA3-SPOOLSS test which I will activate when the Samba4 build farm has picked it up. Volker Modified: branches/SAMBA_3_0/source/include/rpc_spoolss.h branches/SAMBA_3_0/source/rpc_parse/parse_spoolss.c branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c Changeset: Sorry, the patch is too large (860 lines) to include; please use WebSVN to see it! WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19028
svn commit: samba r19027 - in branches/SAMBA_4_0/source/torture/rpc: .
Author: vlendec Date: 2006-10-02 08:35:19 + (Mon, 02 Oct 2006) New Revision: 19027 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19027 Log: Modify RPC-SAMBA3-SPOOLSS so that it can be activated in the build farm Modified: branches/SAMBA_4_0/source/torture/rpc/samba3rpc.c Changeset: Modified: branches/SAMBA_4_0/source/torture/rpc/samba3rpc.c === --- branches/SAMBA_4_0/source/torture/rpc/samba3rpc.c 2006-10-02 06:32:58 UTC (rev 19026) +++ branches/SAMBA_4_0/source/torture/rpc/samba3rpc.c 2006-10-02 08:35:19 UTC (rev 19027) @@ -2229,6 +2229,53 @@ return NT_STATUS_OK; } +static BOOL enumprinters(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *pipe, +int level) +{ + struct spoolss_EnumPrinters r; + NTSTATUS status; + DATA_BLOB blob; + + r.in.flags = PRINTER_ENUM_LOCAL; + r.in.server = "localhost"; + r.in.level = 1; + r.in.buffer = NULL; + r.in.offered = 0; + + status = dcerpc_spoolss_EnumPrinters(pipe, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + d_printf("(%s) dcerpc_spoolss_EnumPrinters failed: %s\n", +__location__, nt_errstr(status)); + return False; + } + + if (!W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) { + d_printf("(%s) EnumPrinters unexpected return code %s, should " +"be WERR_INSUFFICIENT_BUFFER\n", __location__, +win_errstr(r.out.result)); + return False; + } + + blob = data_blob_talloc(mem_ctx, NULL, r.out.needed); + if (blob.data == NULL) { + d_printf("(%s) data_blob_talloc failed\n", __location__); + return False; + } + + r.in.buffer = &blob; + r.in.offered = r.out.needed; + + status = dcerpc_spoolss_EnumPrinters(pipe, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) { + d_printf("(%s) dcerpc_spoolss_EnumPrinters failed: %s, " +"%s\n", __location__, nt_errstr(status), +win_errstr(r.out.result)); + return False; + } + + return True; +} + static NTSTATUS getprinterinfo(TALLOC_CTX *ctx, struct dcerpc_pipe *pipe, struct policy_handle *handle, int level, union spoolss_PrinterInfo **res) @@ -2352,9 +2399,7 @@ struct spoolss_OpenPrinterEx r; ZERO_STRUCT(r); - r.in.printername = talloc_asprintf( - mem_ctx, "%s", - lp_parm_string(-1, "torture", "host")); + r.in.printername = "localhost"; r.in.datatype = NULL; r.in.access_mask = 0; r.in.level = 1; @@ -2368,6 +2413,13 @@ talloc_free(mem_ctx); return False; } + if (!W_ERROR_IS_OK(r.out.result)) { + d_printf("(%s) dcerpc_spoolss_OpenPrinterEx failed: " +"%s\n", __location__, +win_errstr(r.out.result)); + talloc_free(mem_ctx); + return False; + } } { @@ -2383,6 +2435,13 @@ talloc_free(mem_ctx); return False; } + if (!W_ERROR_IS_OK(r.out.result)) { + d_printf("(%s) dcerpc_spoolss_ClosePrinter failed: " +"%s\n", __location__, +win_errstr(r.out.result)); + talloc_free(mem_ctx); + return False; + } } { @@ -2390,8 +2449,7 @@ ZERO_STRUCT(r); r.in.printername = talloc_asprintf( - mem_ctx, "%s\\%s", dcerpc_server_name(p), - printers[0]); + mem_ctx, "localhost\\%s", printers[0]); r.in.datatype = NULL; r.in.access_mask = 0; r.in.level = 1; @@ -2405,6 +2463,13 @@ talloc_free(mem_ctx); return False; } + if (!W_ERROR_IS_OK(r.out.result)) { + d_printf("(%s) dcerpc_spoolss_OpenPrinterEx failed: " +"%s\n", __location__, +win_errstr(r.out.result)); + talloc_free(mem_ctx); + return False; + } } { @@ -2441,6 +2506,12 @@ } } + if (!enumprinters(mem_ctx, p, 1)) { + d_printf("(%s) enumprinters failed\n", __location_