summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/scripting/ejs/mprutil.c23
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;
+}