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

tridge at samba.org tridge at samba.org
Sun Aug 7 06:13:55 GMT 2005


Author: tridge
Date: 2005-08-07 06:13:55 +0000 (Sun, 07 Aug 2005)
New Revision: 9171

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

Log:
- support putting a credentials object in a rpc pipe object to allow authentication
  with other than the command line credentials in a rpc pipe

Modified:
   branches/SAMBA_4_0/source/scripting/ejs/mprutil.c
   branches/SAMBA_4_0/source/scripting/ejs/smbcalls_rpc.c


Changeset:
Modified: branches/SAMBA_4_0/source/scripting/ejs/mprutil.c
===================================================================
--- branches/SAMBA_4_0/source/scripting/ejs/mprutil.c	2005-08-07 02:53:27 UTC (rev 9170)
+++ branches/SAMBA_4_0/source/scripting/ejs/mprutil.c	2005-08-07 06:13:55 UTC (rev 9171)
@@ -357,15 +357,14 @@
 */
 void *mprGetPtr(struct MprVar *v, const char *propname)
 {
-	struct MprVar *val;
-	val = mprGetProperty(v, propname, NULL);
-	if (val == NULL) {
+	NTSTATUS status = mprGetVar(&v, propname);
+	if (!NT_STATUS_IS_OK(status)) {
 		return NULL;
 	}
-	if (val->type != MPR_TYPE_PTR) {
+	if (v->type != MPR_TYPE_PTR) {
 		return NULL;
 	}
-	return val->ptr;
+	return v->ptr;
 }
 
 /*

Modified: branches/SAMBA_4_0/source/scripting/ejs/smbcalls_rpc.c
===================================================================
--- branches/SAMBA_4_0/source/scripting/ejs/smbcalls_rpc.c	2005-08-07 02:53:27 UTC (rev 9170)
+++ branches/SAMBA_4_0/source/scripting/ejs/smbcalls_rpc.c	2005-08-07 06:13:55 UTC (rev 9171)
@@ -109,7 +109,7 @@
 	const struct dcerpc_interface_table *iface;
 	NTSTATUS status;
 	struct dcerpc_pipe *p;
-	struct cli_credentials *creds = cmdline_credentials;
+	struct cli_credentials *creds;
 	struct event_context *ev;
 	struct MprVar *this = mprGetProperty(ejsGetLocalObject(eid), "this", 0);
 
@@ -137,11 +137,14 @@
 		goto done;
 	}
 
+	creds = mprGetPtr(this, "credentials.creds");
 	if (creds == NULL) {
+		creds = cmdline_credentials;
+	}
+	if (creds == NULL) {
 		creds = cli_credentials_init(mprMemCtx());
 		cli_credentials_guess(creds);
-		cli_credentials_set_username(creds, "", CRED_GUESSED);
-		cli_credentials_set_password(creds, "", CRED_GUESSED);
+		cli_credentials_set_anonymous(creds);
 	}
 
 	ev = talloc_find_parent_bytype(mprMemCtx(), struct event_context);
@@ -157,7 +160,6 @@
 	/* by making the pipe a child of the connection variable, it will
 	   auto close when it goes out of scope in the script */
 	mprSetPtrChild(this, "pipe", p);
-	mprSetPtr(this, "iface", iface);
 
 done:
 	mpr_Return(eid, mprNTSTATUS(status));
@@ -353,7 +355,6 @@
 	return 0;
 }
 
-
 /* a list of registered ejs rpc modules */
 static struct ejs_register {
 	struct ejs_register *next, *prev;



More information about the samba-cvs mailing list