Author: mimir
Date: 2005-08-04 19:59:57 +0000 (Thu, 04 Aug 2005)
New Revision: 9070

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

Log:
More fields in ejs credentials object.


rafal


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


Changeset:
Modified: branches/SAMBA_4_0/source/scripting/ejs/smbcalls_creds.c
===================================================================
--- branches/SAMBA_4_0/source/scripting/ejs/smbcalls_creds.c    2005-08-04 
19:59:55 UTC (rev 9069)
+++ branches/SAMBA_4_0/source/scripting/ejs/smbcalls_creds.c    2005-08-04 
19:59:57 UTC (rev 9070)
@@ -48,6 +48,26 @@
 }
 
 
+/*
+  set a domain
+*/
+static int ejs_creds_set_domain(MprVarHandle eid, int argc, char **argv)
+{
+       struct cli_credentials *creds = ejs_creds_get_credentials(eid);
+       if (argc != 1) {
+               ejsSetErrorMsg(eid, "bad arguments to set_domain");
+               return -1;
+       }
+
+       cli_credentials_set_domain(creds, argv[0], CRED_SPECIFIED);
+       mpr_Return(eid, mprCreateBoolVar(True));
+       return 0;
+}
+
+
+/*
+  get a username
+*/
 static int ejs_creds_get_username(MprVarHandle eid, int argc, struct MprVar 
**argv)
 {
        struct cli_credentials *creds = ejs_creds_get_credentials(eid);
@@ -56,6 +76,10 @@
        return 0;
 }
 
+
+/*
+  set a username
+*/
 static int ejs_creds_set_username(MprVarHandle eid, int argc, char **argv)
 {
        struct cli_credentials *creds = ejs_creds_get_credentials(eid);
@@ -71,6 +95,35 @@
 
 
 /*
+  get user password
+*/
+static int ejs_creds_get_password(MprVarHandle eid, int argc, struct MprVar 
**argv)
+{
+       struct cli_credentials *creds = ejs_creds_get_credentials(eid);
+       
+       mpr_Return(eid, mprString(cli_credentials_get_password(creds)));
+       return 0;
+}
+
+
+/*
+  set user password
+*/
+static int ejs_creds_set_password(MprVarHandle eid, int argc, char **argv)
+{
+       struct cli_credentials *creds = ejs_creds_get_credentials(eid);
+       if (argc != 1) {
+               ejsSetErrorMsg(eid, "bad arguments to set_password");
+               return -1;
+       }
+
+       cli_credentials_set_password(creds, argv[0], CRED_SPECIFIED);
+       mpr_Return(eid, mprCreateBoolVar(True));
+       return 0;
+}
+
+
+/*
   initialise credentials ejs object
 */
 static int ejs_credentials_init(MprVarHandle eid, int argc, struct MprVar 
**argv)
@@ -91,8 +144,11 @@
 
        /* setup our object methods */
        mprSetCFunction(obj, "get_domain", ejs_creds_get_domain);
+       mprSetStringCFunction(obj, "set_domain", ejs_creds_set_domain);
        mprSetCFunction(obj, "get_username", ejs_creds_get_username);
        mprSetStringCFunction(obj, "set_username", ejs_creds_set_username);
+       mprSetCFunction(obj, "get_password", ejs_creds_get_password);
+       mprSetStringCFunction(obj, "set_password", ejs_creds_set_password);
 
        return 0;
 }

Reply via email to