亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? net_rpc_join.c

?? samba-3.0.22.tar.gz 編譯smb服務器的源碼
?? C
字號:
/*    Samba Unix/Linux SMB client library    Distributed SMB/CIFS Server Management Utility    Copyright (C) 2001 Andrew Bartlett (abartlet@samba.org)   Copyright (C) Tim Potter     2001   This program is free software; you can redistribute it and/or modify   it under the terms of the GNU General Public License as published by   the Free Software Foundation; either version 2 of the License, or   (at your option) any later version.      This program is distributed in the hope that it will be useful,   but WITHOUT ANY WARRANTY; without even the implied warranty of   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   GNU General Public License for more details.      You should have received a copy of the GNU General Public License   along with this program; if not, write to the Free Software   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */ #include "includes.h"#include "utils/net.h"/* Macro for checking RPC error codes to make things more readable */#define CHECK_RPC_ERR(rpc, msg) \        if (!NT_STATUS_IS_OK(result = rpc)) { \                DEBUG(0, (msg ": %s\n", nt_errstr(result))); \                goto done; \        }#define CHECK_RPC_ERR_DEBUG(rpc, debug_args) \        if (!NT_STATUS_IS_OK(result = rpc)) { \                DEBUG(0, debug_args); \                goto done; \        }/** * confirm that a domain join is still valid * * @return A shell status integer (0 for success) * **/static int net_rpc_join_ok(const char *domain){	uint32 neg_flags = NETLOGON_NEG_AUTH2_FLAGS|NETLOGON_NEG_SCHANNEL;	struct cli_state *cli = NULL;	struct rpc_pipe_client *pipe_hnd = NULL;	struct rpc_pipe_client *netlogon_pipe = NULL;	NTSTATUS ntret = NT_STATUS_UNSUCCESSFUL;	/* Connect to remote machine */	if (!(cli = net_make_ipc_connection(NET_FLAGS_ANONYMOUS | NET_FLAGS_PDC))) {		return -1;	}	/* Setup the creds as though we're going to do schannel... */        netlogon_pipe = get_schannel_session_key(cli, domain, &neg_flags, &ntret);	/* We return NT_STATUS_INVALID_NETWORK_RESPONSE if the server is refusing	   to negotiate schannel, but the creds were set up ok. That'll have to do. */        if (!netlogon_pipe) {		if (NT_STATUS_EQUAL(ntret, NT_STATUS_INVALID_NETWORK_RESPONSE)) {			cli_shutdown(cli);			return 0;		} else {			DEBUG(0,("net_rpc_join_ok: failed to get schannel session "					"key from server %s for domain %s. Error was %s\n",				cli->desthost, domain, nt_errstr(ntret) ));			cli_shutdown(cli);			return -1;		}	}	/* Only do the rest of the schannel test if the client is allowed to do this. */	if (!lp_client_schannel()) {		cli_shutdown(cli);		/* We're good... */		return 0;	}	pipe_hnd = cli_rpc_pipe_open_schannel_with_key(cli, PI_NETLOGON,				PIPE_AUTH_LEVEL_PRIVACY,				domain, netlogon_pipe->dc, &ntret);	if (!pipe_hnd) {		DEBUG(0,("net_rpc_join_ok: failed to open schannel session "				"on netlogon pipe to server %s for domain %s. Error was %s\n",			cli->desthost, domain, nt_errstr(ntret) ));		cli_shutdown(cli);		return -1;	}	cli_shutdown(cli);	return 0;}/** * Join a domain using the administrator username and password * * @param argc  Standard main() style argc * @param argc  Standard main() style argv.  Initial components are already *              stripped.  Currently not used. * @return A shell status integer (0 for success) * **/int net_rpc_join_newstyle(int argc, const char **argv) {	/* libsmb variables */	struct cli_state *cli;	TALLOC_CTX *mem_ctx;        uint32 acb_info = ACB_WSTRUST;	uint32 neg_flags = NETLOGON_NEG_AUTH2_FLAGS|(lp_client_schannel() ? NETLOGON_NEG_SCHANNEL : 0);	uint32 sec_channel_type;	struct rpc_pipe_client *pipe_hnd = NULL;	/* rpc variables */	POLICY_HND lsa_pol, sam_pol, domain_pol, user_pol;	DOM_SID *domain_sid;	uint32 user_rid;	/* Password stuff */	char *clear_trust_password = NULL;	uchar pwbuf[516];	SAM_USERINFO_CTR ctr;	SAM_USER_INFO_24 p24;	SAM_USER_INFO_16 p16;	uchar md4_trust_password[16];	/* Misc */	NTSTATUS result;	int retval = 1;	char *domain;	uint32 num_rids, *name_types, *user_rids;	uint32 flags = 0x3e8;	char *acct_name;	const char *const_acct_name;	/* check what type of join */	if (argc >= 0) {		sec_channel_type = get_sec_channel_type(argv[0]);	} else {		sec_channel_type = get_sec_channel_type(NULL);	}	switch (sec_channel_type) {	case SEC_CHAN_WKSTA:		acb_info = ACB_WSTRUST;		break;	case SEC_CHAN_BDC:		acb_info = ACB_SVRTRUST;		break;#if 0	case SEC_CHAN_DOMAIN:		acb_info = ACB_DOMTRUST;		break;#endif	}	/* Make authenticated connection to remote machine */	if (!(cli = net_make_ipc_connection(NET_FLAGS_PDC))) 		return 1;	if (!(mem_ctx = talloc_init("net_rpc_join_newstyle"))) {		DEBUG(0, ("Could not initialise talloc context\n"));		goto done;	}	/* Fetch domain sid */	pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_LSARPC, &result);	if (!pipe_hnd) {		DEBUG(0, ("Error connecting to LSA pipe. Error was %s\n",			nt_errstr(result) ));		goto done;	}	CHECK_RPC_ERR(rpccli_lsa_open_policy(pipe_hnd, mem_ctx, True,					  SEC_RIGHTS_MAXIMUM_ALLOWED,					  &lsa_pol),		      "error opening lsa policy handle");	CHECK_RPC_ERR(rpccli_lsa_query_info_policy(pipe_hnd, mem_ctx, &lsa_pol,						5, &domain, &domain_sid),		      "error querying info policy");	rpccli_lsa_close(pipe_hnd, mem_ctx, &lsa_pol);	cli_rpc_pipe_close(pipe_hnd); /* Done with this pipe */	/* Create domain user */	pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_SAMR, &result);	if (!pipe_hnd) {		DEBUG(0, ("Error connecting to SAM pipe. Error was %s\n",			nt_errstr(result) ));		goto done;	}	CHECK_RPC_ERR(rpccli_samr_connect(pipe_hnd, mem_ctx, 				       SEC_RIGHTS_MAXIMUM_ALLOWED,				       &sam_pol),		      "could not connect to SAM database");		CHECK_RPC_ERR(rpccli_samr_open_domain(pipe_hnd, mem_ctx, &sam_pol,					   SEC_RIGHTS_MAXIMUM_ALLOWED,					   domain_sid, &domain_pol),		      "could not open domain");	/* Create domain user */	acct_name = talloc_asprintf(mem_ctx, "%s$", global_myname()); 	strlower_m(acct_name);	const_acct_name = acct_name;	result = rpccli_samr_create_dom_user(pipe_hnd, mem_ctx, &domain_pol,					  acct_name, acb_info,					  0xe005000b, &user_pol, 					  &user_rid);	if (!NT_STATUS_IS_OK(result) && 	    !NT_STATUS_EQUAL(result, NT_STATUS_USER_EXISTS)) {		d_fprintf(stderr, "Creation of workstation account failed\n");		/* If NT_STATUS_ACCESS_DENIED then we have a valid		   username/password combo but the user does not have		   administrator access. */		if (NT_STATUS_V(result) == NT_STATUS_V(NT_STATUS_ACCESS_DENIED))			d_fprintf(stderr, "User specified does not have administrator privileges\n");		goto done;	}	/* We *must* do this.... don't ask... */	if (NT_STATUS_IS_OK(result)) {		rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol);	}	CHECK_RPC_ERR_DEBUG(rpccli_samr_lookup_names(pipe_hnd, mem_ctx,						  &domain_pol, flags,						  1, &const_acct_name, 						  &num_rids,						  &user_rids, &name_types),			    ("error looking up rid for user %s: %s\n",			     acct_name, nt_errstr(result)));	if (name_types[0] != SID_NAME_USER) {		DEBUG(0, ("%s is not a user account (type=%d)\n", acct_name, name_types[0]));		goto done;	}	user_rid = user_rids[0];			/* Open handle on user */	CHECK_RPC_ERR_DEBUG(		rpccli_samr_open_user(pipe_hnd, mem_ctx, &domain_pol,				   SEC_RIGHTS_MAXIMUM_ALLOWED,				   user_rid, &user_pol),		("could not re-open existing user %s: %s\n",		 acct_name, nt_errstr(result)));		/* Create a random machine account password */	{ 		char *str;		str = generate_random_str(DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);		clear_trust_password = SMB_STRDUP(str);		E_md4hash(clear_trust_password, md4_trust_password);	}	encode_pw_buffer(pwbuf, clear_trust_password, STR_UNICODE);	/* Set password on machine account */	ZERO_STRUCT(ctr);	ZERO_STRUCT(p24);	init_sam_user_info24(&p24, (char *)pwbuf,24);	ctr.switch_value = 24;	ctr.info.id24 = &p24;	CHECK_RPC_ERR(rpccli_samr_set_userinfo(pipe_hnd, mem_ctx, &user_pol, 24, 					    &cli->user_session_key, &ctr),		      "error setting trust account password");	/* Why do we have to try to (re-)set the ACB to be the same as what	   we passed in the samr_create_dom_user() call?  When a NT	   workstation is joined to a domain by an administrator the	   acb_info is set to 0x80.  For a normal user with "Add	   workstations to the domain" rights the acb_info is 0x84.  I'm	   not sure whether it is supposed to make a difference or not.  NT	   seems to cope with either value so don't bomb out if the set	   userinfo2 level 0x10 fails.  -tpot */	ZERO_STRUCT(ctr);	ctr.switch_value = 16;	ctr.info.id16 = &p16;	init_sam_user_info16(&p16, acb_info);	/* Ignoring the return value is necessary for joining a domain	   as a normal user with "Add workstation to domain" privilege. */	result = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, &user_pol, 16, 					&cli->user_session_key, &ctr);	rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol);	cli_rpc_pipe_close(pipe_hnd); /* Done with this pipe */	/* Now check the whole process from top-to-bottom */	pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_NETLOGON, &result);	if (!pipe_hnd) {		DEBUG(0,("Error connecting to NETLOGON pipe. Error was %s\n",			nt_errstr(result) ));		goto done;	}	result = rpccli_netlogon_setup_creds(pipe_hnd,					cli->desthost, /* server name */					domain,        /* domain */					global_myname(), /* client name */					global_myname(), /* machine account name */                                        md4_trust_password,                                        sec_channel_type,                                        &neg_flags);	if (!NT_STATUS_IS_OK(result)) {		DEBUG(0, ("Error in domain join verification (credential setup failed): %s\n\n",			  nt_errstr(result)));		if ( NT_STATUS_EQUAL(result, NT_STATUS_ACCESS_DENIED) &&		     (sec_channel_type == SEC_CHAN_BDC) ) {			d_fprintf(stderr, "Please make sure that no computer account\n"				 "named like this machine (%s) exists in the domain\n",				 global_myname());		}		goto done;	}	/* We can only check the schannel connection if the client is allowed	   to do this and the server supports it. If not, just assume success	   (after all the rpccli_netlogon_setup_creds() succeeded, and we'll	   do the same again (setup creds) in net_rpc_join_ok(). JRA. */	if (lp_client_schannel() && (neg_flags & NETLOGON_NEG_SCHANNEL)) {		struct rpc_pipe_client *netlogon_schannel_pipe = 						cli_rpc_pipe_open_schannel_with_key(cli,							PI_NETLOGON,							PIPE_AUTH_LEVEL_PRIVACY,							domain,							pipe_hnd->dc,							&result);		if (!NT_STATUS_IS_OK(result)) {			DEBUG(0, ("Error in domain join verification (schannel setup failed): %s\n\n",				  nt_errstr(result)));			if ( NT_STATUS_EQUAL(result, NT_STATUS_ACCESS_DENIED) &&			     (sec_channel_type == SEC_CHAN_BDC) ) {				d_fprintf(stderr, "Please make sure that no computer account\n"					 "named like this machine (%s) exists in the domain\n",					 global_myname());			}			goto done;		}		cli_rpc_pipe_close(netlogon_schannel_pipe);	}	cli_rpc_pipe_close(pipe_hnd);	/* Now store the secret in the secrets database */	strupper_m(domain);	if (!secrets_store_domain_sid(domain, domain_sid)) {		DEBUG(0, ("error storing domain sid for %s\n", domain));		goto done;	}	if (!secrets_store_machine_password(clear_trust_password, domain, sec_channel_type)) {		DEBUG(0, ("error storing plaintext domain secrets for %s\n", domain));	}	/* double-check, connection from scratch */	retval = net_rpc_join_ok(domain);	done:	/* Display success or failure */	if (retval != 0) {		fprintf(stderr,"Unable to join domain %s.\n",domain);	} else {		printf("Joined domain %s.\n",domain);	}		cli_shutdown(cli);	SAFE_FREE(clear_trust_password);	return retval;}/** * check that a join is OK * * @return A shell status integer (0 for success) * **/int net_rpc_testjoin(int argc, const char **argv) {	char *domain = smb_xstrdup(opt_target_workgroup);	/* Display success or failure */	if (net_rpc_join_ok(domain) != 0) {		fprintf(stderr,"Join to domain '%s' is not valid\n",domain);		free(domain);		return -1;	}	printf("Join to '%s' is OK\n",domain);	free(domain);	return 0;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
韩国在线一区二区| 色狠狠桃花综合| 日韩不卡免费视频| 亚洲欧美视频在线观看视频| 免费亚洲电影在线| 国产精品蜜臀av| 精品国一区二区三区| 在线观看亚洲专区| 成人av网站在线观看免费| 轻轻草成人在线| 国产精品久久777777| 亚洲一区二区三区自拍| 26uuu国产一区二区三区| 欧美婷婷六月丁香综合色| 9久草视频在线视频精品| 国产精品一区免费在线观看| 麻豆成人综合网| 欧美aⅴ一区二区三区视频| 亚洲丰满少妇videoshd| 夜夜嗨av一区二区三区| 最新欧美精品一区二区三区| 国产欧美日本一区二区三区| 亚洲精品在线观| 久久久亚洲精华液精华液精华液 | 久久久蜜桃精品| 精品人伦一区二区色婷婷| 日韩欧美一级二级三级| 日韩一区国产二区欧美三区| 欧美日韩高清一区二区不卡| 欧美理论片在线| 日韩欧美一二三四区| 精品久久久久99| 日韩午夜精品电影| 久久综合狠狠综合久久激情| 国产午夜精品在线观看| 国产女主播在线一区二区| 精品福利视频一区二区三区| 欧美大白屁股肥臀xxxxxx| 久久午夜电影网| 亚洲欧美日韩在线| 性欧美疯狂xxxxbbbb| 美女国产一区二区| 国产99久久久国产精品| caoporen国产精品视频| 欧美在线观看视频在线| 欧美一a一片一级一片| 91精品国产aⅴ一区二区| 国产亚洲欧美激情| 亚洲激情六月丁香| 蜜桃视频一区二区| 波多野结衣中文一区| 色婷婷国产精品综合在线观看| 久久综合av免费| √…a在线天堂一区| 亚洲最大成人网4388xx| 国产在线精品一区二区不卡了| 懂色av中文一区二区三区| 欧美性一级生活| 国产精品无人区| 久久66热re国产| 日本韩国一区二区三区视频| 欧美一区二区黄| 一区在线中文字幕| 国产综合成人久久大片91| 欧美伊人久久大香线蕉综合69| 国产午夜精品久久久久久免费视 | 99天天综合性| 久久在线观看免费| 亚洲亚洲人成综合网络| 成人性视频免费网站| 69堂成人精品免费视频| 亚洲欧美视频在线观看视频| 国产原创一区二区三区| 91精品免费在线| 亚洲成人一二三| 欧亚一区二区三区| 亚洲欧美另类小说| 成人av先锋影音| 欧美国产欧美亚州国产日韩mv天天看完整| 日韩一区精品字幕| 91免费看`日韩一区二区| 欧美国产精品一区二区| 国产精品一区二区在线观看不卡| 欧美日韩国产乱码电影| 亚洲午夜精品网| 欧洲亚洲国产日韩| 亚洲男人都懂的| 91久久精品一区二区三| 亚洲激情欧美激情| 欧美在线视频你懂得| 亚洲精品免费一二三区| 色婷婷激情一区二区三区| 一区二区三区在线视频免费观看 | 中文字幕中文在线不卡住| 91小视频在线| 午夜av一区二区| 精品国产1区2区3区| 成人免费毛片a| 亚洲第四色夜色| 2021中文字幕一区亚洲| 91一区二区在线| 日韩和欧美的一区| 国产女主播在线一区二区| 欧美影视一区在线| 国产一区二区看久久| 亚洲一区中文在线| 国产日韩欧美不卡| 欧美精品三级在线观看| 成人中文字幕在线| 日韩有码一区二区三区| 国产精品欧美极品| 欧美一卡二卡三卡| av在线不卡免费看| 极品美女销魂一区二区三区免费| 亚洲日本va午夜在线影院| 亚洲精品一区二区三区福利 | 成人黄色软件下载| 蜜桃av噜噜一区| 一区二区三区国产精品| 国产麻豆精品theporn| 日韩精品91亚洲二区在线观看| 国产精品国产精品国产专区不片| 日韩免费福利电影在线观看| 日本道在线观看一区二区| 丰满放荡岳乱妇91ww| 黄页网站大全一区二区| 午夜激情综合网| 亚洲永久精品大片| 亚洲精品乱码久久久久| 国产精品女人毛片| 国产精品毛片a∨一区二区三区| 精品国免费一区二区三区| 7777精品伊人久久久大香线蕉最新版| 99r精品视频| 成人黄色免费短视频| 国产成人精品www牛牛影视| 韩日av一区二区| 国产一区二区免费视频| 国产在线精品视频| 精品国产91久久久久久久妲己| 欧美一区二视频| 91精品国产高清一区二区三区蜜臀| 色菇凉天天综合网| 欧美最猛性xxxxx直播| 在线观看91精品国产入口| 欧美性生活一区| 欧美剧在线免费观看网站| 6080国产精品一区二区| 91精品蜜臀在线一区尤物| 91精品国产一区二区三区香蕉| 日韩视频中午一区| 国产无遮挡一区二区三区毛片日本| wwww国产精品欧美| 亚洲国产精品成人综合| 国产精品久久久爽爽爽麻豆色哟哟| 国产精品久久免费看| 亚洲色图在线视频| 天堂av在线一区| 久久精品72免费观看| 不卡欧美aaaaa| 欧美日韩在线播放| 久久亚区不卡日本| 国产精品久久久久aaaa樱花| 亚洲日本青草视频在线怡红院| 亚洲成人动漫精品| 国产精品1024| 欧美精品在线一区二区三区| 精品国产乱码久久久久久免费| 中文字幕亚洲综合久久菠萝蜜| 亚洲一区二区影院| 国产一区二区三区香蕉| 99国产精品国产精品毛片| 日韩美女视频在线| 一区二区三区四区精品在线视频| 奇米色777欧美一区二区| 99国产精品视频免费观看| 日韩欧美电影一二三| 亚洲日本电影在线| 国产精品综合视频| 欧美日韩中字一区| 国产欧美视频一区二区三区| 日韩精品色哟哟| 91久久线看在观草草青青| 久久久久久久精| 日韩精彩视频在线观看| 91麻豆国产香蕉久久精品| 精品日韩成人av| 亚洲高清免费观看高清完整版在线观看| 国产一区美女在线| 日韩午夜激情电影| 亚洲国产精品久久艾草纯爱| 91麻豆成人久久精品二区三区| 国产欧美日韩综合精品一区二区| 美女mm1313爽爽久久久蜜臀| 欧美日韩亚洲综合在线 | 国产无一区二区| 国产自产视频一区二区三区| 在线播放一区二区三区| 午夜视频在线观看一区二区 | 欧美日韩aaaaaa|