mirror of
https://github.com/samba-team/samba.git
synced 2025-03-05 20:58:40 +03:00
Add convenience function for getting at event context from ejs code.
(This used to be commit b659e83cd6b627dd0ae04064bccff7220a5bd1ce)
This commit is contained in:
parent
a145d21de6
commit
bbb826bdac
@ -31,6 +31,7 @@
|
||||
|
||||
#include "miniMpr.h"
|
||||
#include "param/param.h"
|
||||
#include "lib/events/events.h"
|
||||
|
||||
/************************************ Code ************************************/
|
||||
#if !BLD_APPWEB
|
||||
@ -50,6 +51,11 @@ void *mprMemCtx(void)
|
||||
return mpr_ctx;
|
||||
}
|
||||
|
||||
struct event_context *mprEventCtx(void)
|
||||
{
|
||||
return event_context_find(mprMemCtx());
|
||||
}
|
||||
|
||||
/* return the loadparm context being used for all ejs variables */
|
||||
struct loadparm_context *mprLpCtx(void)
|
||||
{
|
||||
|
@ -274,6 +274,8 @@ extern void mprSetCtx(void *ctx);
|
||||
extern void *mprMemCtx(void);
|
||||
struct loadparm_context;
|
||||
extern struct loadparm_context *mprLpCtx(void);
|
||||
struct event_context;
|
||||
extern struct event_context *mprEventCtx(void);
|
||||
|
||||
/* This function needs to be provided by anyone using ejs */
|
||||
void ejs_exception(const char *reason);
|
||||
|
@ -50,7 +50,7 @@ static int ejs_net_context(MprVarHandle eid, int argc, struct MprVar **argv)
|
||||
ejsSetErrorMsg(eid, "talloc_new() failed");
|
||||
return -1;
|
||||
}
|
||||
ev = event_context_find(event_mem_ctx);
|
||||
ev = mprEventCtx();
|
||||
|
||||
ctx = libnet_context_init(ev, mprLpCtx());
|
||||
/* IF we generated a new event context, it will be under here,
|
||||
|
@ -55,7 +55,7 @@ static int ejs_doauth(MprVarHandle eid,
|
||||
msg = c->msg_ctx;
|
||||
} else {
|
||||
/* Hope we can find the event context somewhere up there... */
|
||||
ev = event_context_find(tmp_ctx);
|
||||
ev = mprEventCtx();
|
||||
msg = messaging_client_init(tmp_ctx, lp_messaging_path(tmp_ctx, mprLpCtx()),
|
||||
lp_iconv_convenience(mprLpCtx()), ev);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ static int ejs_resolve_name(MprVarHandle eid, int argc, struct MprVar **argv)
|
||||
|
||||
result = 0;
|
||||
|
||||
nt_status = resolve_name(lp_resolve_context(mprLpCtx()), &name, tmp_ctx, &reply_addr, event_context_find(tmp_ctx));
|
||||
nt_status = resolve_name(lp_resolve_context(mprLpCtx()), &name, tmp_ctx, &reply_addr, mprEventCtx());
|
||||
|
||||
if (NT_STATUS_IS_OK(nt_status)) {
|
||||
mprSetPropertyValue(argv[0], "value", mprString(reply_addr));
|
||||
|
@ -73,7 +73,7 @@ static int ejs_irpc_connect(MprVarHandle eid, int argc, char **argv)
|
||||
|
||||
p->server_name = argv[0];
|
||||
|
||||
ev = event_context_find(p);
|
||||
ev = mprEventCtx();
|
||||
|
||||
/* create a messaging context, looping as we have no way to
|
||||
allocate temporary server ids automatically */
|
||||
@ -158,7 +158,7 @@ static int ejs_rpc_connect(MprVarHandle eid, int argc, char **argv)
|
||||
cli_credentials_set_anonymous(creds);
|
||||
}
|
||||
|
||||
ev = event_context_find(mprMemCtx());
|
||||
ev = mprEventCtx();
|
||||
|
||||
status = dcerpc_pipe_connect(this, &p, binding, iface, creds, ev,
|
||||
mprLpCtx());
|
||||
|
Loading…
x
Reference in New Issue
Block a user