summaryrefslogtreecommitdiff
path: root/source4/scripting/ejs/smbcalls_creds.c
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2005-08-22 14:32:58 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:34:20 -0500
commit55e746ad560d4406821bc2d721cbb929b79a7a0a (patch)
treed9baa6d6d7651e3f95313699510335c714a2e681 /source4/scripting/ejs/smbcalls_creds.c
parent5bd6a114711c0033403a656b42574380a6ebcd3d (diff)
downloadsamba-55e746ad560d4406821bc2d721cbb929b79a7a0a.tar.gz
samba-55e746ad560d4406821bc2d721cbb929b79a7a0a.tar.bz2
samba-55e746ad560d4406821bc2d721cbb929b79a7a0a.zip
r9477: Convert popt options to an ejs object. Doesn't seem to break anything
except of popt help (-h) option (unexpected ?). rafal (This used to be commit 1990793b23d6198a85ce1bdf6ad43e12015db203)
Diffstat (limited to 'source4/scripting/ejs/smbcalls_creds.c')
-rw-r--r--source4/scripting/ejs/smbcalls_creds.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/source4/scripting/ejs/smbcalls_creds.c b/source4/scripting/ejs/smbcalls_creds.c
index 61a5139cda..45da5895e4 100644
--- a/source4/scripting/ejs/smbcalls_creds.c
+++ b/source4/scripting/ejs/smbcalls_creds.c
@@ -23,6 +23,7 @@
#include "includes.h"
#include "scripting/ejs/smbcalls.h"
#include "lib/appweb/ejs/ejs.h"
+#include "lib/cmdline/popt_common.h"
/*
helper function to get the local objects credentials ptr
@@ -184,19 +185,9 @@ static int ejs_creds_get_workstation(MprVarHandle eid, int argc, struct MprVar *
/*
initialise credentials ejs object
*/
-static int ejs_credentials_init(MprVarHandle eid, int argc, struct MprVar **argv)
+static int ejs_credentials_obj(MprVarHandle eid, int argc, struct MprVar **argv, struct cli_credentials *creds)
{
struct MprVar *obj = mprInitObject(eid, "credentials", argc, argv);
- struct cli_credentials *creds;
-
- creds = cli_credentials_init(mprMemCtx());
- if (creds == NULL) {
- return -1;
- }
-
- cli_credentials_guess(creds);
- cli_credentials_set_username(creds, "", CRED_GUESSED);
- cli_credentials_set_password(creds, "", CRED_GUESSED);
mprSetPtrChild(obj, "creds", creds);
@@ -217,6 +208,30 @@ static int ejs_credentials_init(MprVarHandle eid, int argc, struct MprVar **argv
/*
+ initialise credentials ejs object
+*/
+static int ejs_credentials_init(MprVarHandle eid, int argc, struct MprVar **argv)
+{
+ struct cli_credentials *creds;
+
+ creds = cli_credentials_init(mprMemCtx());
+ if (creds == NULL) {
+ return -1;
+ }
+
+ return ejs_credentials_obj(eid, argc, argv, creds);
+}
+
+/*
+ initialise cmdline credentials ejs object
+*/
+int ejs_credentials_cmdline(int eid, int argc, struct MprVar **argv)
+{
+ return ejs_credentials_obj(eid, argc, argv, cmdline_credentials);
+}
+
+
+/*
setup C functions that be called from ejs
*/
void smb_setup_ejs_credentials(void)