1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

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 commit is contained in:
Tim Potter 2005-06-03 12:31:56 +00:00 committed by Gerald (Jerry) Carter
parent e40c44e9cd
commit d81d5f8317

View File

@ -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;
}