diff options
author | Rafal Szczesniak <mimir@samba.org> | 2005-08-04 19:59:57 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:31:14 -0500 |
commit | 1702f5ba11de18e5566ea8b28c2583ea73ba8b65 (patch) | |
tree | 85ec08ce7fb53bde716724151648dc6519b32ded | |
parent | abeaa08b58e2c8f1ebe3b980ac3343e586265319 (diff) | |
download | samba-1702f5ba11de18e5566ea8b28c2583ea73ba8b65.tar.gz samba-1702f5ba11de18e5566ea8b28c2583ea73ba8b65.tar.bz2 samba-1702f5ba11de18e5566ea8b28c2583ea73ba8b65.zip |
r9070: More fields in ejs credentials object.
rafal
(This used to be commit e819c035f79477b5dd8ee62292a18c9e8532c9f7)
-rw-r--r-- | source4/scripting/ejs/smbcalls_creds.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/source4/scripting/ejs/smbcalls_creds.c b/source4/scripting/ejs/smbcalls_creds.c index eb937aebb6..546ae84d17 100644 --- a/source4/scripting/ejs/smbcalls_creds.c +++ b/source4/scripting/ejs/smbcalls_creds.c @@ -48,6 +48,26 @@ static int ejs_creds_get_domain(MprVarHandle eid, int argc, struct MprVar **argv } +/* + 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 @@ static int ejs_creds_get_username(MprVarHandle eid, int argc, struct MprVar **ar 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 @@ static int ejs_creds_set_username(MprVarHandle eid, int argc, char **argv) /* + 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 @@ static int ejs_credentials_init(MprVarHandle eid, int argc, struct MprVar **argv /* 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; } |