本文整理汇总了C++中NT_STATUS_NOT_OK_RETURN函数的典型用法代码示例。如果您正苦于以下问题:C++ NT_STATUS_NOT_OK_RETURN函数的具体用法?C++ NT_STATUS_NOT_OK_RETURN怎么用?C++ NT_STATUS_NOT_OK_RETURN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NT_STATUS_NOT_OK_RETURN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gpo_fetch_files
NTSTATUS gpo_fetch_files(TALLOC_CTX *mem_ctx,
struct cli_state *cli,
struct GROUP_POLICY_OBJECT *gpo)
{
NTSTATUS result;
char *server, *service, *nt_path, *unix_path;
char *nt_ini_path, *unix_ini_path;
result = gpo_explode_filesyspath(mem_ctx, gpo->file_sys_path,
&server, &service, &nt_path,
&unix_path);
NT_STATUS_NOT_OK_RETURN(result);
result = gpo_prepare_local_store(mem_ctx, unix_path);
NT_STATUS_NOT_OK_RETURN(result);
unix_ini_path = talloc_asprintf(mem_ctx, "%s/%s", unix_path, GPT_INI);
nt_ini_path = talloc_asprintf(mem_ctx, "%s\\%s", nt_path, GPT_INI);
NT_STATUS_HAVE_NO_MEMORY(unix_ini_path);
NT_STATUS_HAVE_NO_MEMORY(nt_ini_path);
result = gpo_copy_file(mem_ctx, cli, nt_ini_path, unix_ini_path);
NT_STATUS_NOT_OK_RETURN(result);
result = gpo_sync_directories(mem_ctx, cli, nt_path, unix_path);
NT_STATUS_NOT_OK_RETURN(result);
return NT_STATUS_OK;
}
示例2: cldapd_startup_interfaces
/*
setup our listening sockets on the configured network interfaces
*/
static NTSTATUS cldapd_startup_interfaces(struct cldapd_server *cldapd, struct loadparm_context *lp_ctx,
struct interface *ifaces)
{
int i, num_interfaces;
TALLOC_CTX *tmp_ctx = talloc_new(cldapd);
NTSTATUS status;
num_interfaces = iface_list_count(ifaces);
/* if we are allowing incoming packets from any address, then
we need to bind to the wildcard address */
if (!lpcfg_bind_interfaces_only(lp_ctx)) {
const char **wcard = iface_list_wildcard(cldapd, lp_ctx);
NT_STATUS_HAVE_NO_MEMORY(wcard);
for (i=0; wcard[i]; i++) {
status = cldapd_add_socket(cldapd, lp_ctx, wcard[i]);
NT_STATUS_NOT_OK_RETURN(status);
}
talloc_free(wcard);
}
/* now we have to also listen on the specific interfaces,
so that replies always come from the right IP */
for (i=0; i<num_interfaces; i++) {
const char *address = talloc_strdup(tmp_ctx, iface_list_n_ip(ifaces, i));
status = cldapd_add_socket(cldapd, lp_ctx, address);
NT_STATUS_NOT_OK_RETURN(status);
}
talloc_free(tmp_ctx);
return NT_STATUS_OK;
}
示例3: nbtd_startup_interfaces
/*
setup our listening sockets on the configured network interfaces
*/
NTSTATUS nbtd_startup_interfaces(struct nbtd_server *nbtsrv, struct loadparm_context *lp_ctx,
struct interface *ifaces)
{
int num_interfaces = iface_count(ifaces);
int i;
TALLOC_CTX *tmp_ctx = talloc_new(nbtsrv);
NTSTATUS status;
/* if we are allowing incoming packets from any address, then
we also need to bind to the wildcard address */
if (!lp_bind_interfaces_only(lp_ctx)) {
const char *primary_address;
/* the primary address is the address we will return
for non-WINS queries not made on a specific
interface */
if (num_interfaces > 0) {
primary_address = iface_n_ip(ifaces, 0);
} else {
primary_address = inet_ntoa(interpret_addr2(
lp_netbios_name(lp_ctx)));
}
primary_address = talloc_strdup(tmp_ctx, primary_address);
NT_STATUS_HAVE_NO_MEMORY(primary_address);
status = nbtd_add_socket(nbtsrv,
lp_ctx,
"0.0.0.0",
primary_address,
talloc_strdup(tmp_ctx, "255.255.255.255"),
talloc_strdup(tmp_ctx, "0.0.0.0"));
NT_STATUS_NOT_OK_RETURN(status);
}
for (i=0; i<num_interfaces; i++) {
const char *bcast = iface_n_bcast(ifaces, i);
const char *address, *netmask;
/* we can't assume every interface is broadcast capable */
if (bcast == NULL) continue;
address = talloc_strdup(tmp_ctx, iface_n_ip(ifaces, i));
bcast = talloc_strdup(tmp_ctx, bcast);
netmask = talloc_strdup(tmp_ctx, iface_n_netmask(ifaces, i));
status = nbtd_add_socket(nbtsrv, lp_ctx,
address, address, bcast, netmask);
NT_STATUS_NOT_OK_RETURN(status);
}
if (lp_wins_server_list(lp_ctx)) {
status = nbtd_add_wins_socket(nbtsrv);
NT_STATUS_NOT_OK_RETURN(status);
}
talloc_free(tmp_ctx);
return NT_STATUS_OK;
}
示例4: authsam_password_ok
/****************************************************************************
Do a specific test for an smb password being correct, given a smb_password and
the lanman and NT responses.
****************************************************************************/
static NTSTATUS authsam_password_ok(struct auth4_context *auth_context,
TALLOC_CTX *mem_ctx,
uint16_t acct_flags,
const struct samr_Password *lm_pwd,
const struct samr_Password *nt_pwd,
const struct auth_usersupplied_info *user_info,
DATA_BLOB *user_sess_key,
DATA_BLOB *lm_sess_key)
{
NTSTATUS status;
switch (user_info->password_state) {
case AUTH_PASSWORD_PLAIN:
{
const struct auth_usersupplied_info *user_info_temp;
status = encrypt_user_info(mem_ctx, auth_context,
AUTH_PASSWORD_HASH,
user_info, &user_info_temp);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Failed to convert plaintext password to password HASH: %s\n", nt_errstr(status)));
return status;
}
user_info = user_info_temp;
FALL_THROUGH;
}
case AUTH_PASSWORD_HASH:
*lm_sess_key = data_blob(NULL, 0);
*user_sess_key = data_blob(NULL, 0);
status = hash_password_check(mem_ctx,
lpcfg_lanman_auth(auth_context->lp_ctx),
user_info->password.hash.lanman,
user_info->password.hash.nt,
user_info->mapped.account_name,
lm_pwd, nt_pwd);
NT_STATUS_NOT_OK_RETURN(status);
break;
case AUTH_PASSWORD_RESPONSE:
status = ntlm_password_check(mem_ctx,
lpcfg_lanman_auth(auth_context->lp_ctx),
lpcfg_ntlm_auth(auth_context->lp_ctx),
user_info->logon_parameters,
&auth_context->challenge.data,
&user_info->password.response.lanman,
&user_info->password.response.nt,
user_info->mapped.account_name,
user_info->client.account_name,
user_info->client.domain_name,
lm_pwd, nt_pwd,
user_sess_key, lm_sess_key);
NT_STATUS_NOT_OK_RETURN(status);
break;
}
return NT_STATUS_OK;
}
示例5: libnetapi_lsa_lookup_names3
static NTSTATUS libnetapi_lsa_lookup_names3(TALLOC_CTX *mem_ctx,
struct rpc_pipe_client *lsa_pipe,
const char *name,
struct dom_sid *sid)
{
NTSTATUS status, result;
struct policy_handle lsa_handle;
struct dcerpc_binding_handle *b = lsa_pipe->binding_handle;
struct lsa_RefDomainList *domains = NULL;
struct lsa_TransSidArray3 sids;
uint32_t count = 0;
struct lsa_String names;
uint32_t num_names = 1;
if (!sid || !name) {
return NT_STATUS_INVALID_PARAMETER;
}
ZERO_STRUCT(sids);
init_lsa_String(&names, name);
status = rpccli_lsa_open_policy2(lsa_pipe, mem_ctx,
false,
SEC_STD_READ_CONTROL |
LSA_POLICY_VIEW_LOCAL_INFORMATION |
LSA_POLICY_LOOKUP_NAMES,
&lsa_handle);
NT_STATUS_NOT_OK_RETURN(status);
status = dcerpc_lsa_LookupNames3(b, mem_ctx,
&lsa_handle,
num_names,
&names,
&domains,
&sids,
LSA_LOOKUP_NAMES_ALL, /* sure ? */
&count,
0, 0,
&result);
NT_STATUS_NOT_OK_RETURN(status);
NT_STATUS_NOT_OK_RETURN(result);
if (count != 1 || sids.count != 1) {
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
sid_copy(sid, sids.sids[0].sid);
return NT_STATUS_OK;
}
示例6: smb2_create_blob_add
/*
add a blob to a smb2_create attribute blob
*/
NTSTATUS smb2_create_blob_add(TALLOC_CTX *mem_ctx, DATA_BLOB *blob,
uint32_t tag,
DATA_BLOB add, BOOL last)
{
NTSTATUS status;
uint32_t ofs = blob->length;
uint8_t pad = smb2_padding_size(add.length, 8);
status = data_blob_realloc(mem_ctx, blob, blob->length + 0x18 + add.length + pad);
NT_STATUS_NOT_OK_RETURN(status);
if (last) {
SIVAL(blob->data, ofs+0x00, 0);
} else {
SIVAL(blob->data, ofs+0x00, 0x18 + add.length + pad);
}
SSVAL(blob->data, ofs+0x04, 0x10); /* offset of tag */
SIVAL(blob->data, ofs+0x06, 0x04); /* tag length */
SSVAL(blob->data, ofs+0x0A, 0x18); /* offset of data */
SIVAL(blob->data, ofs+0x0C, add.length);
SIVAL(blob->data, ofs+0x10, tag);
SIVAL(blob->data, ofs+0x14, 0); /* pad? */
memcpy(blob->data+ofs+0x18, add.data, add.length);
memset(blob->data+ofs+0x18+add.length, 0, pad);
return NT_STATUS_OK;
}
示例7: do_node_query
/* do a single node query */
static NTSTATUS do_node_query(struct nbt_name_socket *nbtsock,
const char *addr,
const char *node_name,
enum nbt_name_type node_type,
BOOL broadcast)
{
struct nbt_name_query io;
NTSTATUS status;
int i;
io.in.name.name = node_name;
io.in.name.type = node_type;
io.in.name.scope = NULL;
io.in.dest_addr = addr;
io.in.broadcast = broadcast;
io.in.wins_lookup = options.wins_lookup;
io.in.timeout = 1;
io.in.retries = 2;
status = nbt_name_query(nbtsock, nbtsock, &io);
NT_STATUS_NOT_OK_RETURN(status);
for (i=0;i<io.out.num_addrs;i++) {
printf("%s %s<%02x>\n",
io.out.reply_addrs[i],
io.out.name.name,
io.out.name.type);
}
if (options.node_status && io.out.num_addrs > 0) {
do_node_status(nbtsock, io.out.reply_addrs[0]);
}
return status;
}
示例8: scripts_get_reg_config
static NTSTATUS scripts_get_reg_config(TALLOC_CTX *mem_ctx,
struct gp_extension_reg_info **reg_info)
{
NTSTATUS status;
struct gp_extension_reg_info *info = NULL;
struct gp_extension_reg_table table[] = {
{ "ProcessGroupPolicy", REG_SZ, "scripts_process_group_policy" },
{ "NoGPOListChanges", REG_DWORD, "1" },
{ "NoSlowLink", REG_DWORD, "1" },
{ "NotifyLinkTransition", REG_DWORD, "1" },
{ NULL, REG_NONE, NULL },
};
info = talloc_zero(mem_ctx, struct gp_extension_reg_info);
NT_STATUS_HAVE_NO_MEMORY(info);
status = gpext_info_add_entry(mem_ctx, GP_EXT_NAME,
GP_EXT_GUID_SCRIPTS,
table, info);
NT_STATUS_NOT_OK_RETURN(status);
*reg_info = info;
return NT_STATUS_OK;
}
示例9: streams
/*
form the lock context used for byte range locking. This is separate
from the locking key used for opendb locking as it needs to take
account of file streams (each stream is a separate byte range
locking space)
*/
static NTSTATUS pvfs_brl_locking_handle(TALLOC_CTX *mem_ctx,
struct pvfs_filename *name,
struct ntvfs_handle *ntvfs,
struct brl_handle **_h)
{
DATA_BLOB odb_key, key;
NTSTATUS status;
struct brl_handle *h;
status = pvfs_locking_key(name, mem_ctx, &odb_key);
NT_STATUS_NOT_OK_RETURN(status);
if (name->stream_name == NULL) {
key = odb_key;
} else {
key = data_blob_talloc(mem_ctx, NULL,
odb_key.length + strlen(name->stream_name) + 1);
NT_STATUS_HAVE_NO_MEMORY(key.data);
memcpy(key.data, odb_key.data, odb_key.length);
memcpy(key.data + odb_key.length,
name->stream_name, strlen(name->stream_name) + 1);
data_blob_free(&odb_key);
}
h = brl_create_handle(mem_ctx, ntvfs, &key);
NT_STATUS_HAVE_NO_MEMORY(h);
*_h = h;
return NT_STATUS_OK;
}
示例10: ntvfs_handle_set_backend_data
NTSTATUS ntvfs_handle_set_backend_data(struct ntvfs_handle *h,
struct ntvfs_module_context *ntvfs,
TALLOC_CTX *private_data)
{
struct ntvfs_handle_data *d;
bool first_time = h->backend_data?false:true;
for (d=h->backend_data; d; d = d->next) {
if (d->owner != ntvfs) continue;
d->private_data = talloc_steal(d, private_data);
return NT_STATUS_OK;
}
d = talloc(h, struct ntvfs_handle_data);
NT_STATUS_HAVE_NO_MEMORY(d);
d->owner = ntvfs;
d->private_data = talloc_steal(d, private_data);
DLIST_ADD(h->backend_data, d);
if (first_time) {
NTSTATUS status;
status = h->ctx->handles.make_valid(h->ctx->handles.private_data, h);
NT_STATUS_NOT_OK_RETURN(status);
}
return NT_STATUS_OK;
}
示例11: auth_generate_session_info
_PUBLIC_ NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx,
struct tevent_context *event_ctx,
struct loadparm_context *lp_ctx,
struct auth_serversupplied_info *server_info,
struct auth_session_info **_session_info)
{
struct auth_session_info *session_info;
NTSTATUS nt_status;
session_info = talloc(mem_ctx, struct auth_session_info);
NT_STATUS_HAVE_NO_MEMORY(session_info);
session_info->server_info = talloc_reference(session_info, server_info);
/* unless set otherwise, the session key is the user session
* key from the auth subsystem */
session_info->session_key = server_info->user_session_key;
nt_status = security_token_create(session_info,
event_ctx,
lp_ctx,
server_info->account_sid,
server_info->primary_group_sid,
server_info->n_domain_groups,
server_info->domain_groups,
server_info->authenticated,
&session_info->security_token);
NT_STATUS_NOT_OK_RETURN(nt_status);
session_info->credentials = NULL;
*_session_info = session_info;
return NT_STATUS_OK;
}
示例12: smb2srv_negprot_backend
static NTSTATUS smb2srv_negprot_backend(struct smb2srv_request *req, struct smb2_negprot *io)
{
NTSTATUS status;
struct timeval current_time;
struct timeval boot_time;
req->smb_conn->negotiate.protocol = PROTOCOL_SMB2;
current_time = timeval_current(); /* TODO: handle timezone?! */
boot_time = timeval_current(); /* TODO: fix me */
io->out._pad = 0;
io->out.unknown2 = 0x06;
ZERO_STRUCT(io->out.sessid);
io->out.unknown3 = 0x0d;
io->out.unknown4 = 0x00;
io->out.unknown5 = 0x01;
io->out.unknown6 = 0x01;
io->out.unknown7 = 0x01;
io->out.current_time = timeval_to_nttime(¤t_time);
io->out.boot_time = timeval_to_nttime(&boot_time);
status = smb2srv_negprot_secblob(req, &io->out.secblob);
NT_STATUS_NOT_OK_RETURN(status);
io->out.unknown9 = 0x204d4c20;
return NT_STATUS_OK;
}
示例13: wbsrv_samba3_send_reply
/*
* queue a wbsrv_call reply on a wbsrv_connection
* NOTE: that this implies talloc_free(call),
* use talloc_reference(call) if you need it after
* calling wbsrv_queue_reply
*/
NTSTATUS wbsrv_samba3_send_reply(struct wbsrv_samba3_call *call)
{
struct wbsrv_connection *wbsrv_conn = call->wbconn;
struct tevent_req *subreq;
NTSTATUS status;
status = wbsrv_samba3_push_reply(call);
NT_STATUS_NOT_OK_RETURN(status);
call->out_iov[0].iov_base = (char *) call->out.data;
call->out_iov[0].iov_len = call->out.length;
subreq = tstream_writev_queue_send(call,
wbsrv_conn->conn->event.ctx,
wbsrv_conn->tstream,
wbsrv_conn->send_queue,
call->out_iov, 1);
if (subreq == NULL) {
wbsrv_terminate_connection(wbsrv_conn, "wbsrv_call_loop: "
"no memory for tstream_writev_queue_send");
return NT_STATUS_NO_MEMORY;
}
tevent_req_set_callback(subreq, wbsrv_samba3_send_reply_done, call);
return status;
}
示例14: smb2_pull_o16s16_string
/*
pull a string in a uint16_t ofs/ uint16_t length/blob format
UTF-16 without termination
*/
NTSTATUS smb2_pull_o16s16_string(struct smb2_request_buffer *buf, TALLOC_CTX *mem_ctx,
uint8_t *ptr, const char **str)
{
DATA_BLOB blob;
NTSTATUS status;
void *vstr;
size_t converted_size = 0;
bool ret;
status = smb2_pull_o16s16_blob(buf, mem_ctx, ptr, &blob);
NT_STATUS_NOT_OK_RETURN(status);
if (blob.data == NULL) {
*str = NULL;
return NT_STATUS_OK;
}
if (blob.length == 0) {
char *s;
s = talloc_strdup(mem_ctx, "");
NT_STATUS_HAVE_NO_MEMORY(s);
*str = s;
return NT_STATUS_OK;
}
ret = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX,
blob.data, blob.length, &vstr, &converted_size);
data_blob_free(&blob);
(*str) = (char *)vstr;
if (!ret) {
return NT_STATUS_ILLEGAL_CHARACTER;
}
return NT_STATUS_OK;
}
示例15: wreplsrv_out_connect_wait_assoc_ctx
static NTSTATUS wreplsrv_out_connect_wait_assoc_ctx(struct wreplsrv_out_connect_state *state)
{
NTSTATUS status;
status = wrepl_associate_recv(state->subreq, &state->assoc_io);
TALLOC_FREE(state->subreq);
NT_STATUS_NOT_OK_RETURN(status);
state->wreplconn->assoc_ctx.peer_ctx = state->assoc_io.out.assoc_ctx;
state->wreplconn->assoc_ctx.peer_major = state->assoc_io.out.major_version;
if (state->type == WINSREPL_PARTNER_PUSH) {
if (state->wreplconn->assoc_ctx.peer_major >= 5) {
state->wreplconn->partner->push.wreplconn = state->wreplconn;
talloc_steal(state->wreplconn->partner, state->wreplconn);
} else {
state->type = WINSREPL_PARTNER_NONE;
}
} else if (state->type == WINSREPL_PARTNER_PULL) {
state->wreplconn->partner->pull.wreplconn = state->wreplconn;
talloc_steal(state->wreplconn->partner, state->wreplconn);
}
state->stage = WREPLSRV_OUT_CONNECT_STAGE_DONE;
return NT_STATUS_OK;
}