Author: metze Date: 2006-07-31 13:34:00 +0000 (Mon, 31 Jul 2006) New Revision: 17339
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17339 Log: pass the event context and messaging context together to the smb ejs functions metze Modified: branches/SAMBA_4_0/source/scripting/ejs/smbcalls.h branches/SAMBA_4_0/source/scripting/ejs/smbcalls_auth.c branches/SAMBA_4_0/source/web_server/http.c Changeset: Modified: branches/SAMBA_4_0/source/scripting/ejs/smbcalls.h =================================================================== --- branches/SAMBA_4_0/source/scripting/ejs/smbcalls.h 2006-07-31 09:41:25 UTC (rev 17338) +++ branches/SAMBA_4_0/source/scripting/ejs/smbcalls.h 2006-07-31 13:34:00 UTC (rev 17339) @@ -29,6 +29,11 @@ void mprSetCFunction(struct MprVar *obj, const char *name, MprCFunction fn); void mprSetStringCFunction(struct MprVar *obj, const char *name, MprStringCFunction fn); +struct smbcalls_context { + struct event_context *event_ctx; + struct messaging_context *msg_ctx; +}; + struct ldb_context; struct ldb_message; struct cli_credentials; Modified: branches/SAMBA_4_0/source/scripting/ejs/smbcalls_auth.c =================================================================== --- branches/SAMBA_4_0/source/scripting/ejs/smbcalls_auth.c 2006-07-31 09:41:25 UTC (rev 17338) +++ branches/SAMBA_4_0/source/scripting/ejs/smbcalls_auth.c 2006-07-31 13:34:00 UTC (rev 17339) @@ -39,9 +39,18 @@ struct MprVar *session_info_obj; NTSTATUS nt_status; - /* Hope we can find the event context somewhere up there... */ - struct event_context *ev = event_context_find(tmp_ctx); + struct smbcalls_context *c; + struct event_context *ev; + /* Hope we can find an smbcalls_context somewhere up there... */ + c = talloc_find_parent_bytype(tmp_ctx, struct smbcalls_context); + if (c) { + ev = c->event_ctx; + } else { + /* Hope we can find the event context somewhere up there... */ + ev = event_context_find(tmp_ctx); + } + nt_status = auth_context_create(tmp_ctx, auth_types, &auth_context, ev); if (!NT_STATUS_IS_OK(nt_status)) { mprSetPropertyValue(auth, "result", mprCreateBoolVar(False)); Modified: branches/SAMBA_4_0/source/web_server/http.c =================================================================== --- branches/SAMBA_4_0/source/web_server/http.c 2006-07-31 09:41:25 UTC (rev 17338) +++ branches/SAMBA_4_0/source/web_server/http.c 2006-07-31 13:34:00 UTC (rev 17339) @@ -755,8 +755,9 @@ void http_process_input(struct websrv_context *web) { NTSTATUS status; - struct esp_state *esp; + struct esp_state *esp = NULL; struct esp_data *edata = talloc_get_type(web->task->private, struct esp_data); + struct smbcalls_context *smbcalls_ctx; char *p; void *save_mpr_ctx = mprMemCtx(); void *ejs_save = ejs_save_state(); @@ -777,7 +778,16 @@ {"esp", "text/html", True} }; - esp = talloc_zero(web, struct esp_state); + /* + * give the smbcalls a chance to find the event context + * and messaging context + */ + smbcalls_ctx = talloc(web, struct smbcalls_context); + if (smbcalls_ctx == NULL) goto internal_error; + smbcalls_ctx->event_ctx = web->conn->event.ctx; + smbcalls_ctx->msg_ctx = web->conn->msg_ctx; + + esp = talloc_zero(smbcalls_ctx, struct esp_state); if (esp == NULL) goto internal_error; esp->web = web;
