diff options
author | Rafal Szczesniak <mimir@samba.org> | 2005-08-04 20:22:25 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:31:14 -0500 |
commit | c11e266cba9e850382f5c5e4a0d927b183906e66 (patch) | |
tree | 9bf1d70755cdf4c5945c68c38e9284fbfa03a1ef /source4/scripting | |
parent | 1702f5ba11de18e5566ea8b28c2583ea73ba8b65 (diff) | |
download | samba-c11e266cba9e850382f5c5e4a0d927b183906e66.tar.gz samba-c11e266cba9e850382f5c5e4a0d927b183906e66.tar.bz2 samba-c11e266cba9e850382f5c5e4a0d927b183906e66.zip |
r9071: Set real and workstation fields in ejs credentials object.
rafal
(This used to be commit eb7a5d09c7a469f94357434c6dadbdf54b52d5db)
Diffstat (limited to 'source4/scripting')
-rw-r--r-- | source4/scripting/ejs/smbcalls_creds.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/source4/scripting/ejs/smbcalls_creds.c b/source4/scripting/ejs/smbcalls_creds.c index 546ae84d17..61a5139cda 100644 --- a/source4/scripting/ejs/smbcalls_creds.c +++ b/source4/scripting/ejs/smbcalls_creds.c @@ -124,6 +124,64 @@ static int ejs_creds_set_password(MprVarHandle eid, int argc, char **argv) /* + set realm +*/ +static int ejs_creds_set_realm(MprVarHandle eid, int argc, char **argv) +{ + struct cli_credentials *creds = ejs_creds_get_credentials(eid); + if (argc != 1) { + ejsSetErrorMsg(eid, "bad arguments to set_realm"); + return -1; + } + + cli_credentials_set_realm(creds, argv[0], CRED_SPECIFIED); + mpr_Return(eid, mprCreateBoolVar(True)); + return 0; +} + + +/* + get realm +*/ +static int ejs_creds_get_realm(MprVarHandle eid, int argc, struct MprVar **argv) +{ + struct cli_credentials *creds = ejs_creds_get_credentials(eid); + + mpr_Return(eid, mprString(cli_credentials_get_realm(creds))); + return 0; +} + + +/* + set workstation +*/ +static int ejs_creds_set_workstation(MprVarHandle eid, int argc, char **argv) +{ + struct cli_credentials *creds = ejs_creds_get_credentials(eid); + if (argc != 1) { + ejsSetErrorMsg(eid, "bad arguments to set_workstation"); + return -1; + } + + cli_credentials_set_workstation(creds, argv[0], CRED_SPECIFIED); + mpr_Return(eid, mprCreateBoolVar(True)); + return 0; +} + + +/* + get workstation +*/ +static int ejs_creds_get_workstation(MprVarHandle eid, int argc, struct MprVar **argv) +{ + struct cli_credentials *creds = ejs_creds_get_credentials(eid); + + mpr_Return(eid, mprString(cli_credentials_get_workstation(creds))); + return 0; +} + + +/* initialise credentials ejs object */ static int ejs_credentials_init(MprVarHandle eid, int argc, struct MprVar **argv) @@ -149,6 +207,10 @@ static int ejs_credentials_init(MprVarHandle eid, int argc, struct MprVar **argv mprSetStringCFunction(obj, "set_username", ejs_creds_set_username); mprSetCFunction(obj, "get_password", ejs_creds_get_password); mprSetStringCFunction(obj, "set_password", ejs_creds_set_password); + mprSetCFunction(obj, "get_realm", ejs_creds_get_realm); + mprSetStringCFunction(obj, "set_realm", ejs_creds_set_realm); + mprSetCFunction(obj, "get_workstation", ejs_creds_get_workstation); + mprSetStringCFunction(obj, "set_workstation", ejs_creds_set_workstation); return 0; } |