当前位置: 首页>>代码示例>>C++>>正文


C++ WBC_ERROR_IS_OK函数代码示例

本文整理汇总了C++中WBC_ERROR_IS_OK函数的典型用法代码示例。如果您正苦于以下问题:C++ WBC_ERROR_IS_OK函数的具体用法?C++ WBC_ERROR_IS_OK怎么用?C++ WBC_ERROR_IS_OK使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了WBC_ERROR_IS_OK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: wbinfo_get_userdomgroups

static bool wbinfo_get_userdomgroups(const char *user_sid_str)
{
	wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
	uint32_t num_sids;
	uint32_t i;
	struct wbcDomainSid user_sid, *sids = NULL;

	/* Send request */

	wbc_status = wbcStringToSid(user_sid_str, &user_sid);
	if (!WBC_ERROR_IS_OK(wbc_status)) {
		return false;
	}

	wbc_status = wbcLookupUserSids(&user_sid, true, &num_sids, &sids);
	if (!WBC_ERROR_IS_OK(wbc_status)) {
		return false;
	}

	for (i = 0; i < num_sids; i++) {
		char *str = NULL;
		wbc_status = wbcSidToString(&sids[i], &str);
		if (!WBC_ERROR_IS_OK(wbc_status)) {
			wbcFreeMemory(sids);
			return false;
		}
		d_printf("%s\n", str);
		wbcFreeMemory(str);
	}

	wbcFreeMemory(sids);

	return true;
}
开发者ID:jameshilliard,项目名称:WECB-BH-GPL,代码行数:34,代码来源:wbinfo.c

示例2: wbinfo_gid_to_sid

static bool wbinfo_gid_to_sid(gid_t gid)
{
	wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
	struct wbcDomainSid sid;
	char *sid_str = NULL;

	/* Send request */

	wbc_status = wbcGidToSid(gid, &sid);
	if (!WBC_ERROR_IS_OK(wbc_status)) {
		return false;
	}

	wbc_status = wbcSidToString(&sid, &sid_str);
	if (!WBC_ERROR_IS_OK(wbc_status)) {
		return false;
	}

	/* Display response */

	d_printf("%s\n", sid_str);

	wbcFreeMemory(sid_str);

	return true;
}
开发者ID:jameshilliard,项目名称:WECB-BH-GPL,代码行数:26,代码来源:wbinfo.c

示例3: wbinfo_lookupsid

static bool wbinfo_lookupsid(const char *sid_str)
{
	wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
	struct wbcDomainSid sid;
	char *domain;
	char *name;
	enum wbcSidType type;

	/* Send off request */

	wbc_status = wbcStringToSid(sid_str, &sid);
	if (!WBC_ERROR_IS_OK(wbc_status)) {
		return false;
	}

	wbc_status = wbcLookupSid(&sid, &domain, &name, &type);
	if (!WBC_ERROR_IS_OK(wbc_status)) {
		return false;
	}

	/* Display response */

	d_printf("%s%c%s %d\n",
		 domain, winbind_separator(), name, type);

	return true;
}
开发者ID:jameshilliard,项目名称:WECB-BH-GPL,代码行数:27,代码来源:wbinfo.c

示例4: wbinfo_lookupname

static bool wbinfo_lookupname(const char *full_name)
{
	wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
	struct wbcDomainSid sid;
	char *sid_str;
	enum wbcSidType type;
	fstring domain_name;
	fstring account_name;

	/* Send off request */

	parse_wbinfo_domain_user(full_name, domain_name,
				 account_name);

	wbc_status = wbcLookupName(domain_name, account_name,
				   &sid, &type);
	if (!WBC_ERROR_IS_OK(wbc_status)) {
		return false;
	}

	wbc_status = wbcSidToString(&sid, &sid_str);
	if (!WBC_ERROR_IS_OK(wbc_status)) {
		return false;
	}

	/* Display response */

	d_printf("%s %s (%d)\n", sid_str, sid_type_lookup(type), type);

	wbcFreeMemory(sid_str);

	return true;
}
开发者ID:jameshilliard,项目名称:WECB-BH-GPL,代码行数:33,代码来源:wbinfo.c

示例5: wbinfo_get_sidaliases

static bool wbinfo_get_sidaliases(const char *domain,
				  const char *user_sid_str)
{
	wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
	struct wbcDomainInfo *dinfo = NULL;
	uint32_t i;
	struct wbcDomainSid user_sid;
	uint32_t *alias_rids = NULL;
	uint32_t num_alias_rids;
	char *domain_sid_str = NULL;

	/* Send request */
	if ((domain == NULL) || (strequal(domain, ".")) ||
           (domain[0] == '\0')) {
		domain = get_winbind_domain();
	}

	/* Send request */

	wbc_status = wbcDomainInfo(domain, &dinfo);
	if (!WBC_ERROR_IS_OK(wbc_status)) {
		d_printf("wbcDomainInfo(%s) failed: %s\n", domain,
			 wbcErrorString(wbc_status));
		goto done;
	}
	wbc_status = wbcStringToSid(user_sid_str, &user_sid);
	if (!WBC_ERROR_IS_OK(wbc_status)) {
		goto done;
	}

	wbc_status = wbcGetSidAliases(&dinfo->sid, &user_sid, 1,
	    &alias_rids, &num_alias_rids);
	if (!WBC_ERROR_IS_OK(wbc_status)) {
		goto done;
	}

	wbc_status = wbcSidToString(&dinfo->sid, &domain_sid_str);
	if (!WBC_ERROR_IS_OK(wbc_status)) {
		goto done;
	}

	for (i = 0; i < num_alias_rids; i++) {
		d_printf("%s-%d\n", domain_sid_str, alias_rids[i]);
	}

	wbcFreeMemory(alias_rids);

done:
	if (domain_sid_str) {
		wbcFreeMemory(domain_sid_str);
	}
	if (dinfo) {
		wbcFreeMemory(dinfo);
	}
	return (WBC_ERR_SUCCESS == wbc_status);
}
开发者ID:gojdic,项目名称:samba,代码行数:56,代码来源:wbinfo.c

示例6: wbinfo_ping

static bool wbinfo_ping(void)
{
	wbcErr wbc_status;

	wbc_status = wbcPing();

	/* Display response */

	d_printf("Ping to winbindd %s\n",
		 WBC_ERROR_IS_OK(wbc_status) ? "succeeded" : "failed");

	return WBC_ERROR_IS_OK(wbc_status);
}
开发者ID:jameshilliard,项目名称:WECB-BH-GPL,代码行数:13,代码来源:wbinfo.c

示例7: wbcUidToSid

/* Convert a Unix uid to a Windows SID, allocating a SID if needed */
wbcErr wbcUidToSid(uid_t uid, struct wbcDomainSid *sid)
{
    int ret;
    char *str_sid;
    enum sss_id_type type;
    wbcErr wbc_status;

    ret = sss_nss_getsidbyid(uid, &str_sid, &type);
    if (ret != 0) {
        return WBC_ERR_UNKNOWN_FAILURE;
    }

    if (type != SSS_ID_TYPE_UID && type != SSS_ID_TYPE_BOTH) {
        free(str_sid);
        return WBC_ERR_UNKNOWN_USER;
    }

    wbc_status = wbcStringToSid(str_sid, sid);
    free(str_sid);
    if (!WBC_ERROR_IS_OK(wbc_status)) {
        return wbc_status;
    }

    return WBC_ERR_SUCCESS;
}
开发者ID:celestian,项目名称:sssd,代码行数:26,代码来源:wbc_idmap_sssd.c

示例8: wbcUnixIdsToSids

wbcErr wbcUnixIdsToSids(const struct wbcUnixId *ids, uint32_t num_ids,
                        struct wbcDomainSid *sids)
{
    size_t c;
    wbcErr wbc_status;

    for (c = 0; c < num_ids; c++) {
        switch (ids[c].type) {
        case WBC_ID_TYPE_UID:
            wbc_status = wbcUidToSid(ids[c].id.uid, &sids[c]);
            break;
        case WBC_ID_TYPE_GID:
            wbc_status = wbcGidToSid(ids[c].id.gid, &sids[c]);
            break;
        default:
            wbc_status = WBC_ERR_INVALID_PARAM;
        }

        if (!WBC_ERROR_IS_OK(wbc_status)) {
            sids[c] = (struct wbcDomainSid){ 0 };
        };
    }

    return WBC_ERR_SUCCESS;
}
开发者ID:celestian,项目名称:sssd,代码行数:25,代码来源:wbc_idmap_sssd.c

示例9: wbcLookupSid

/* Convert a SID to a domain and name */
wbcErr wbcLookupSid(const struct wbcDomainSid *sid,
		    char **pdomain,
		    char **pname,
		    enum wbcSidType *pname_type)
{
	struct winbindd_request request;
	struct winbindd_response response;
	wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
	char *domain, *name;

	if (!sid) {
		return WBC_ERR_INVALID_PARAM;
	}

	/* Initialize request */

	ZERO_STRUCT(request);
	ZERO_STRUCT(response);

	wbcSidToStringBuf(sid, request.data.sid, sizeof(request.data.sid));

	/* Make request */

	wbc_status = wbcRequestResponse(WINBINDD_LOOKUPSID, &request,
					&response);
	if (!WBC_ERROR_IS_OK(wbc_status)) {
		return wbc_status;
	}

	/* Copy out result */

	wbc_status = WBC_ERR_NO_MEMORY;
	domain = NULL;
	name = NULL;

	domain = wbcStrDup(response.data.name.dom_name);
	if (domain == NULL) {
		goto done;
	}
	name = wbcStrDup(response.data.name.name);
	if (name == NULL) {
		goto done;
	}
	if (pdomain != NULL) {
		*pdomain = domain;
		domain = NULL;
	}
	if (pname != NULL) {
		*pname = name;
		name = NULL;
	}
	if (pname_type != NULL) {
		*pname_type = (enum wbcSidType)response.data.name.type;
	}
	wbc_status = WBC_ERR_SUCCESS;
done:
	wbcFreeMemory(name);
	wbcFreeMemory(domain);
	return wbc_status;
}
开发者ID:Alexandr-Galko,项目名称:samba,代码行数:61,代码来源:wbc_sid.c

示例10: lwi_get_id_from_sid

static NTSTATUS lwi_get_id_from_sid(struct idmap_domain *dom,
				    struct id_map **ids)
{
	NTSTATUS nt_status = NT_STATUS_NONE_MAPPED;	
	int i;

	for (i = 0; ids[i]; i++) {
		struct wbcDomainSid wbc_sid;
		wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;

		/* Setup */
		memcpy(&wbc_sid, ids[i]->sid, sizeof(wbc_sid));
		ids[i]->status = ID_UNMAPPED;

		switch (ids[i]->xid.type) {
		case ID_TYPE_UID:
			wbc_status = wbcSidToUid(&wbc_sid, (uid_t*)&ids[i]->xid.id);
			break;
		case ID_TYPE_GID:
			wbc_status = wbcSidToGid(&wbc_sid, (gid_t*)&ids[i]->xid.id);
			break;
		default:
			return NT_STATUS_INVALID_PARAMETER;
		}

		if (WBC_ERROR_IS_OK(wbc_status)) {
			ids[i]->status = ID_MAPPED;
			nt_status = NT_STATUS_OK;
		}
	}
	
	return nt_status;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:33,代码来源:lwicompat_v4.c

示例11: lwi_get_sid_from_id

static NTSTATUS lwi_get_sid_from_id(struct idmap_domain *dom,
				    struct id_map **ids)
{
	int i;
	NTSTATUS nt_status = NT_STATUS_NONE_MAPPED;	

	/* loop over the array and issue requests one at a time */

	for (i = 0; ids[i]; i++) {
		struct wbcDomainSid wbc_sid;
		wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;

		ids[i]->status = ID_UNMAPPED;

		switch (ids[i]->xid.type) {
		case ID_TYPE_UID:
			wbc_status = wbcUidToSid(ids[i]->xid.id, &wbc_sid);			
			break;
		case ID_TYPE_GID:
			wbc_status = wbcGidToSid(ids[i]->xid.id, &wbc_sid);
			break;
		default:
			return NT_STATUS_INVALID_PARAMETER;
		}

		if (WBC_ERROR_IS_OK(wbc_status)) {
			memcpy(ids[i]->sid, &wbc_sid, sizeof(*ids[i]->sid));
			ids[i]->status = ID_MAPPED;
			nt_status = NT_STATUS_OK;			
		}
	}

	return nt_status;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:34,代码来源:lwicompat_v4.c

示例12: wbinfo_show_onlinestatus

/* show sequence numbers */
static bool wbinfo_show_onlinestatus(const char *domain)
{
	struct wbcDomainInfo *domain_list = NULL;
	size_t num_domains;
	wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
	int i;

	wbc_status = wbcListTrusts(&domain_list, &num_domains);
	if (!WBC_ERROR_IS_OK(wbc_status)) {
		return false;
	}

	for (i=0; i<num_domains; i++) {
		bool is_offline;

		if (domain) {
			if (!strequal(domain_list[i].short_name, domain)) {
				continue;
			}
		}

		is_offline = (domain_list[i].domain_flags & WBC_DOMINFO_DOMAIN_OFFLINE);
		
		d_printf("%s : %s\n", 
			 domain_list[i].short_name,
			 is_offline ? "offline" : "online" );
	}

	return true;
}
开发者ID:jameshilliard,项目名称:WECB-BH-GPL,代码行数:31,代码来源:wbinfo.c

示例13: print_domain_groups

static bool print_domain_groups(const char *domain)
{
	wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
	uint32_t i;
	uint32_t num_groups = 0;
	const char **groups = NULL;

	/* Send request to winbind daemon */

	/* '.' is the special sign for our own domain */
	if (domain && strcmp(domain, ".") == 0) {
		domain = get_winbind_domain();
	}

	wbc_status = wbcListGroups(domain, &num_groups, &groups);
	if (!WBC_ERROR_IS_OK(wbc_status)) {
		return false;
	}

	for (i=0; i < num_groups; i++) {
		d_printf("%s\n", groups[i]);
	}

	wbcFreeMemory(groups);

	return true;
}
开发者ID:jameshilliard,项目名称:WECB-BH-GPL,代码行数:27,代码来源:wbinfo.c

示例14: wbcSidToGid

wbcErr wbcSidToGid(const struct wbcDomainSid *sid, gid_t *pgid)
{
    int ret;
    char *sid_str;
    uint32_t id;
    enum sss_id_type type;
    wbcErr wbc_status;

    wbc_status = wbcSidToString(sid, &sid_str);
    if (!WBC_ERROR_IS_OK(wbc_status)) {
        return wbc_status;
    }

    ret = sss_nss_getidbysid(sid_str, &id, &type);
    wbcFreeMemory(sid_str);
    if (ret != 0) {
        return WBC_ERR_UNKNOWN_FAILURE;
    }

    if (type != SSS_ID_TYPE_GID && type != SSS_ID_TYPE_BOTH) {
        return WBC_ERR_UNKNOWN_GROUP;
    }

    *pgid = (gid_t) id;

    return WBC_ERR_SUCCESS;
}
开发者ID:celestian,项目名称:sssd,代码行数:27,代码来源:wbc_idmap_sssd.c

示例15: wbc_create_domain_controller_info_ex

static wbcErr wbc_create_domain_controller_info_ex(const struct winbindd_response *resp,
						   struct wbcDomainControllerInfoEx **_i)
{
	wbcErr wbc_status = WBC_ERR_SUCCESS;
	struct wbcDomainControllerInfoEx *i;
	struct wbcGuid guid;

	i = (struct wbcDomainControllerInfoEx *)wbcAllocateMemory(
		1, sizeof(struct wbcDomainControllerInfoEx),
		wbcDomainControllerInfoExDestructor);
	BAIL_ON_PTR_ERROR(i, wbc_status);

	i->dc_unc = strdup(resp->data.dsgetdcname.dc_unc);
	BAIL_ON_PTR_ERROR(i->dc_unc, wbc_status);

	i->dc_address = strdup(resp->data.dsgetdcname.dc_address);
	BAIL_ON_PTR_ERROR(i->dc_address, wbc_status);

	i->dc_address_type = resp->data.dsgetdcname.dc_address_type;

	wbc_status = wbcStringToGuid(resp->data.dsgetdcname.domain_guid, &guid);
	if (WBC_ERROR_IS_OK(wbc_status)) {
		i->domain_guid = (struct wbcGuid *)malloc(
			sizeof(struct wbcGuid));
		BAIL_ON_PTR_ERROR(i->domain_guid, wbc_status);

		*i->domain_guid = guid;
	}

	i->domain_name = strdup(resp->data.dsgetdcname.domain_name);
	BAIL_ON_PTR_ERROR(i->domain_name, wbc_status);

	if (resp->data.dsgetdcname.forest_name[0] != '\0') {
		i->forest_name = strdup(resp->data.dsgetdcname.forest_name);
		BAIL_ON_PTR_ERROR(i->forest_name, wbc_status);
	}

	i->dc_flags = resp->data.dsgetdcname.dc_flags;

	if (resp->data.dsgetdcname.dc_site_name[0] != '\0') {
		i->dc_site_name = strdup(resp->data.dsgetdcname.dc_site_name);
		BAIL_ON_PTR_ERROR(i->dc_site_name, wbc_status);
	}

	if (resp->data.dsgetdcname.client_site_name[0] != '\0') {
		i->client_site_name = strdup(
			resp->data.dsgetdcname.client_site_name);
		BAIL_ON_PTR_ERROR(i->client_site_name, wbc_status);
	}

	*_i = i;
	i = NULL;

done:
	if (i != NULL) {
		wbcFreeMemory(i);
	}
	return wbc_status;
}
开发者ID:Arkhont,项目名称:samba,代码行数:59,代码来源:wbc_util.c


注:本文中的WBC_ERROR_IS_OK函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。