diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-07-20 04:27:09 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:29:46 -0500 |
commit | e9c925f8727a8fa01935129ba8209183d111bd86 (patch) | |
tree | d76b05c716a41b6f14184517a3c25314066cf77f /source4/scripting/ejs/smbcalls_auth.c | |
parent | d9cfd55dbb969b08914fd306fb9d123e52ad6541 (diff) | |
download | samba-e9c925f8727a8fa01935129ba8209183d111bd86.tar.gz samba-e9c925f8727a8fa01935129ba8209183d111bd86.tar.bz2 samba-e9c925f8727a8fa01935129ba8209183d111bd86.zip |
r8629: - moved the getDomainList() call out of smbcalls_auth.c and into libjs/auth.js
- tried to make the ejs_userAuth() call work for the sam, not just for
unix auth. I didn't get this working. Andrew, when you get a chance
can you see what I'm doing wrong? I suspect its because we aren't
supplying a challenge, but a challenge doesn't really make sense in a
'is this username/password' correct call.
(This used to be commit 9e07c08a71908e99c2f44efc40a3249facd6850f)
Diffstat (limited to 'source4/scripting/ejs/smbcalls_auth.c')
-rw-r--r-- | source4/scripting/ejs/smbcalls_auth.c | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/source4/scripting/ejs/smbcalls_auth.c b/source4/scripting/ejs/smbcalls_auth.c index 10c63fb4dd..4739922e38 100644 --- a/source4/scripting/ejs/smbcalls_auth.c +++ b/source4/scripting/ejs/smbcalls_auth.c @@ -26,19 +26,21 @@ #include "auth/auth.h" #include "scripting/ejs/smbcalls.h" -static int ejs_systemAuth(TALLOC_CTX *tmp_ctx, struct MprVar *auth, const char *username, const char *password, const char *domain, const char *remote_host) +static int ejs_doauth(TALLOC_CTX *tmp_ctx, struct MprVar *auth, const char *username, + const char *password, const char *domain, const char *remote_host, + const char *authtype) { struct auth_usersupplied_info *user_info = NULL; struct auth_serversupplied_info *server_info = NULL; struct auth_context *auth_context; - const char *auth_unix[] = { "unix", NULL }; + const char *auth_types[] = { authtype, NULL }; NTSTATUS nt_status; DATA_BLOB pw_blob; /* darn, we need some way to get the right event_context here */ - nt_status = auth_context_create(tmp_ctx, auth_unix, &auth_context, NULL); + nt_status = auth_context_create(tmp_ctx, auth_types, &auth_context, NULL); if (!NT_STATUS_IS_OK(nt_status)) { mprSetPropertyValue(auth, "result", mprCreateBoolVar(False)); mprSetPropertyValue(auth, "report", mprString("Auth System Failure")); @@ -104,12 +106,9 @@ static int ejs_userAuth(MprVarHandle eid, int argc, struct MprVar **argv) auth = mprObject("auth"); if (domain && strcmp("System User", domain) == 0) { - - ejs_systemAuth(tmp_ctx, &auth, username, password, domain, remote_host); - } else { - - mprSetPropertyValue(&auth, "result", mprCreateBoolVar(False)); - mprSetPropertyValue(&auth, "report", mprString("Unknown Domain")); + ejs_doauth(tmp_ctx, &auth, username, password, domain, remote_host, "unix"); + } else { + ejs_doauth(tmp_ctx, &auth, username, password, domain, remote_host, "sam"); } mpr_Return(eid, auth); @@ -117,28 +116,10 @@ static int ejs_userAuth(MprVarHandle eid, int argc, struct MprVar **argv) return 0; } -static int ejs_domain_list(MprVarHandle eid, int argc, char **argv) -{ - struct MprVar list; - - if (argc != 0) { - ejsSetErrorMsg(eid, "domList invalid arguments"); - return -1; - } - - list = mprObject("list"); - mprSetVar(&list, "0", mprString("System User")); - - mpr_Return(eid, list); - - return 0; -} - /* setup C functions that be called from ejs */ void smb_setup_ejs_auth(void) { - ejsDefineStringCFunction(-1, "getDomainList", ejs_domain_list, NULL, MPR_VAR_SCRIPT_HANDLE); ejsDefineCFunction(-1, "userAuth", ejs_userAuth, NULL, MPR_VAR_SCRIPT_HANDLE); } |