diff options
author | Tim Potter <tpot@samba.org> | 2005-06-03 12:31:56 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:17:28 -0500 |
commit | e8cbe7f3a4d828619285cdfebf5b786ddebf7928 (patch) | |
tree | 5238f81a3be8f394f46ddea70338d7fd63cf582b /source4/scripting | |
parent | 0b4a3021e1db39dedb1eb16026ed2bff6aa2c4dd (diff) | |
download | samba-e8cbe7f3a4d828619285cdfebf5b786ddebf7928.tar.gz samba-e8cbe7f3a4d828619285cdfebf5b786ddebf7928.tar.bz2 samba-e8cbe7f3a4d828619285cdfebf5b786ddebf7928.zip |
r7225: Create a MprVar object from a NTSTATUS, e.g:
res: {
is_err: true,
is_ok: false,
errstr: "NT_STATUS_IO_TIMEOUT",
v: -1073741643
}
(This used to be commit d81d5f8317ca82a08e6fc38ef7313fad2e631281)
Diffstat (limited to 'source4/scripting')
-rw-r--r-- | source4/scripting/ejs/mprutil.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/source4/scripting/ejs/mprutil.c b/source4/scripting/ejs/mprutil.c index 3e47fdf9a3..4aee7d1c50 100644 --- a/source4/scripting/ejs/mprutil.c +++ b/source4/scripting/ejs/mprutil.c @@ -166,3 +166,26 @@ const char **mprToList(TALLOC_CTX *mem_ctx, struct MprVar *v) return list; } +/* + turn a NTSTATUS into a MprVar object with lots of funky properties +*/ +struct MprVar mprNTSTATUS(NTSTATUS status) +{ + struct MprVar res, val; + + res = mprCreateObjVar("ntstatus", MPR_DEFAULT_HASH_SIZE); + + val = mprCreateStringVar(nt_errstr(status), 1); + mprCreateProperty(&res, "errstr", &val); + + val = mprCreateIntegerVar(NT_STATUS_V(status)); + mprCreateProperty(&res, "v", &val); + + val = mprCreateBoolVar(NT_STATUS_IS_OK(status)); + mprCreateProperty(&res, "is_ok", &val); + + val = mprCreateBoolVar(NT_STATUS_IS_ERR(status)); + mprCreateProperty(&res, "is_err", &val); + + return res; +} |