您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ unbecome_root函数代码示例

51自学网 2021-06-03 09:09:17
  C++
这篇教程C++ unbecome_root函数代码示例写得很实用,希望能帮到您。

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

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

示例1: smbXsrv_open_global_traverse

NTSTATUS smbXsrv_open_global_traverse(			int (*fn)(struct smbXsrv_open_global0 *, void *),			void *private_data){	NTSTATUS status;	int count = 0;	struct smbXsrv_open_global_traverse_state state = {		.fn = fn,		.private_data = private_data,	};	become_root();	status = smbXsrv_open_global_init();	if (!NT_STATUS_IS_OK(status)) {		unbecome_root();		DEBUG(0, ("Failed to initialize open_global: %s/n",			  nt_errstr(status)));		return status;	}	status = dbwrap_traverse_read(smbXsrv_open_global_db_ctx,				      smbXsrv_open_global_traverse_fn,				      &state,				      &count);	unbecome_root();	return status;}
开发者ID:DanilKorotenko,项目名称:samba,代码行数:29,


示例2: getfsquota

static int getfsquota(const AFPObj *obj, struct vol *vol, const int uid, struct dqblk *dq){	struct dqblk dqg;#ifdef __svr4__    struct quotctl      qc;#endif    memset(dq, 0, sizeof(struct dqblk));    memset(&dqg, 0, sizeof(dqg));	#ifdef __svr4__    qc.op = Q_GETQUOTA;    qc.uid = uid;    qc.addr = (caddr_t)dq;    if ( ioctl( vol->v_qfd, Q_QUOTACTL, &qc ) < 0 ) {        return( AFPERR_PARAM );    }#else /* __svr4__ */#ifdef ultrix    if ( quota( Q_GETDLIM, uid, vol->v_gvs, dq ) != 0 ) {        return( AFPERR_PARAM );    }#else /* ultrix */#ifndef USRQUOTA#define USRQUOTA   0#endif#ifndef QCMD#define QCMD(a,b)  (a)#endif#ifndef TRU64    /* for group quotas. we only use these if the user belongs    * to one group. */#endif /* TRU64 */#ifdef BSD4_4    become_root();        if ( quotactl( vol->v_path, QCMD(Q_GETQUOTA,USRQUOTA),                       uid, (char *)dq ) != 0 ) {            /* try group quotas */            if (obj->ngroups >= 1) {                if ( quotactl(vol->v_path, QCMD(Q_GETQUOTA, GRPQUOTA),                              obj->groups[0], (char *) &dqg) != 0 ) {                    unbecome_root();                    return( AFPERR_PARAM );                }            }        }        unbecome_root();    }
开发者ID:Netatalk,项目名称:Netatalk,代码行数:55,


示例3: rcinit_status

static WERROR rcinit_status( const char *service, struct SERVICE_STATUS *status ){	char *command = NULL;	int ret, fd;	if (asprintf(&command, "%s/%s/%s status",				get_dyn_MODULESDIR(), SVCCTL_SCRIPT_DIR, service) < 0) {		return WERR_NOT_ENOUGH_MEMORY;	}	/* we've already performed the access check when the service was opened */	/* assume as return code of 0 means that the service is ok.  Anything else	   is STOPPED */	become_root();	ret = smbrun(command, &fd, NULL);	unbecome_root();	DEBUGADD(5, ("rcinit_start: [%s] returned [%d]/n", command, ret));	close(fd);	SAFE_FREE(command);	ZERO_STRUCTP( status );	status->type			= SERVICE_TYPE_WIN32_SHARE_PROCESS;	status->state			= (ret == 0 ) ? SVCCTL_RUNNING : SVCCTL_STOPPED;	status->controls_accepted	= SVCCTL_ACCEPT_STOP |					  SVCCTL_ACCEPT_SHUTDOWN;	return WERR_OK;}
开发者ID:Alexander--,项目名称:samba,代码行数:32,


示例4: srv_fssa_start

NTSTATUS srv_fssa_start(struct messaging_context *msg_ctx){	NTSTATUS status;	fss_global.mem_ctx = talloc_named_const(NULL, 0,						"parent fss rpc server ctx");	if (fss_global.mem_ctx == NULL) {		return NT_STATUS_NO_MEMORY;	}	fss_global.db_path = lock_path(FSS_DB_NAME);	if (fss_global.db_path == NULL) {		talloc_free(fss_global.mem_ctx);		return NT_STATUS_NO_MEMORY;	}	fss_global.min_vers = FSRVP_RPC_VERSION_1;	fss_global.max_vers = FSRVP_RPC_VERSION_1;	/*	 * The server MUST populate the GlobalShadowCopySetTable with the	 * ShadowCopySet entries read from the configuration store.	 */	if (lp_parm_bool(GLOBAL_SECTION_SNUM, "fss", "prune stale", false)) {		fss_prune_stale(msg_ctx, fss_global.db_path);	}	become_root();	status = fss_state_retrieve(fss_global.mem_ctx, &fss_global.sc_sets,				    &fss_global.sc_sets_count,				    fss_global.db_path);	unbecome_root();	if (!NT_STATUS_IS_OK(status)) {		DEBUG(1, ("failed to retrieve fss server state: %s/n",			  nt_errstr(status)));	}	return NT_STATUS_OK;}
开发者ID:Distrotech,项目名称:samba,代码行数:35,


示例5: notify_deferred_opens

static void notify_deferred_opens(struct share_mode_lock *lck){ 	int i;  	for (i=0; i<lck->num_share_modes; i++) { 		struct share_mode_entry *e = &lck->share_modes[i];  		if (!is_deferred_open_entry(e)) { 			continue; 		}  		if (procid_is_me(&e->pid)) { 			/* 			 * We need to notify ourself to retry the open.  Do 			 * this by finding the queued SMB record, moving it to 			 * the head of the queue and changing the wait time to 			 * zero. 			 */ 			schedule_deferred_open_smb_message(e->op_mid); 		} else {			char msg[MSG_SMB_SHARE_MODE_ENTRY_SIZE];			share_mode_entry_to_message(msg, e);			become_root(); 			message_send_pid(e->pid, MSG_SMB_OPEN_RETRY, 					 msg, MSG_SMB_SHARE_MODE_ENTRY_SIZE, True);			unbecome_root(); 		} 	}}
开发者ID:jameshilliard,项目名称:WECB-BH-GPL,代码行数:31,


示例6: regdb_open

WERROR regdb_open( void ){	WERROR result = WERR_OK;	if ( tdb_reg ) {		DEBUG(10,("regdb_open: incrementing refcount (%d)/n", tdb_refcount));		tdb_refcount++;		return WERR_OK;	}		become_root();	tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);	if ( !tdb_reg ) {		result = ntstatus_to_werror( map_nt_error_from_unix( errno ) );		DEBUG(0,("regdb_open: Failed to open %s! (%s)/n", 			lock_path("registry.tdb"), strerror(errno) ));	}	unbecome_root();	tdb_refcount = 1;	DEBUG(10,("regdb_open: refcount reset (%d)/n", tdb_refcount));	return result;}
开发者ID:AllardJ,项目名称:Tomato,代码行数:26,


示例7: _eventlog_ClearEventLogW

NTSTATUS _eventlog_ClearEventLogW(pipes_struct *p,				  struct eventlog_ClearEventLogW *r){	EVENTLOG_INFO *info = find_eventlog_info_by_hnd( p, r->in.handle );	if ( !info )		return NT_STATUS_INVALID_HANDLE;	if (r->in.backupfile && r->in.backupfile->string) {		DEBUG(8,( "_eventlog_ClearEventLogW: Using [%s] as the backup "			"file name for log [%s].",			 r->in.backupfile->string, info->logname ) );	}	/* check for WRITE access to the file */	if ( !(info->access_granted&SA_RIGHT_FILE_WRITE_DATA) )		return NT_STATUS_ACCESS_DENIED;	/* Force a close and reopen */	elog_close_tdb( info->etdb, True );	become_root();	info->etdb = elog_open_tdb( info->logname, True, False );	unbecome_root();	if ( !info->etdb )		return NT_STATUS_ACCESS_DENIED;	return NT_STATUS_OK;}
开发者ID:0x24bin,项目名称:winexe-1,代码行数:32,


示例8: sys_getgrouplist

static int sys_getgrouplist(const char *user, gid_t gid, gid_t *groups, int *grpcnt){	int retval;	bool winbind_env;	DEBUG(10,("sys_getgrouplist: user [%s]/n", user));	/* This is only ever called for Unix users, remote memberships are	 * always determined by the info3 coming back from auth3 or the	 * PAC. */	winbind_env = winbind_env_set();	(void)winbind_off();#ifdef HAVE_GETGROUPLIST	retval = getgrouplist(user, gid, groups, grpcnt);#else#ifdef HAVE_GETGRSET	retval = getgrouplist_getgrset(user, gid, groups, grpcnt);#else	become_root();	retval = getgrouplist_internals(user, gid, groups, grpcnt);	unbecome_root();#endif /* HAVE_GETGRSET */#endif /* HAVE_GETGROUPLIST */	/* allow winbindd lookups, but only if they were not already disabled */	if (!winbind_env) {		(void)winbind_on();	}	return retval;}
开发者ID:AIdrifter,项目名称:samba,代码行数:32,


示例9: ad_conv_v22ea

static int ad_conv_v22ea(const char *path, const struct stat *sp, const struct vol *vol){    EC_INIT;    const char *adpath;    int adflags = S_ISDIR(sp->st_mode) ? ADFLAGS_DIR : 0;    become_root();    EC_ZERO( ad_conv_v22ea_hf(path, sp, vol) );    EC_ZERO( ad_conv_v22ea_rf(path, sp, vol) );    EC_NULL( adpath = ad_path(path, adflags) );    LOG(log_debug, logtype_default,"ad_conv_v22ea_hf(/"%s/"): deleting adouble:v2 file: /"%s/"",        path, fullpathname(adpath));    unlink(adpath);EC_CLEANUP:    if (errno == ENOENT)        EC_STATUS(0);    unbecome_root();    EC_EXIT;}
开发者ID:NTmatter,项目名称:Netatalk,代码行数:25,


示例10: regdb_open

WERROR regdb_open( void ){	WERROR result = WERR_OK;	if ( regdb ) {		DEBUG(10, ("regdb_open: incrementing refcount (%d->%d)/n",			   regdb_refcount, regdb_refcount+1));		regdb_refcount++;		return WERR_OK;	}	become_root();	regdb = db_open(NULL, state_path("registry.tdb"), 0,			REG_TDB_FLAGS, O_RDWR, 0600,			DBWRAP_LOCK_ORDER_1);	if ( !regdb ) {		result = ntstatus_to_werror( map_nt_error_from_unix( errno ) );		DEBUG(0,("regdb_open: Failed to open %s! (%s)/n",			state_path("registry.tdb"), strerror(errno) ));	}	unbecome_root();	regdb_refcount = 1;	DEBUG(10, ("regdb_open: registry db opened. refcount reset (%d)/n",		   regdb_refcount));	return result;}
开发者ID:ekohl,项目名称:samba,代码行数:30,


示例11: sys_getgrouplist

int sys_getgrouplist(const char *user, gid_t gid, gid_t *groups, int *grpcnt){	char *p;	int retval;	DEBUG(10,("sys_getgrouplist: user [%s]/n", user));		/* see if we should disable winbindd lookups for local users */	if ( (p = strchr(user, *lp_winbind_separator())) == NULL ) {		if ( !winbind_off() )			DEBUG(0,("sys_getgroup_list: Insufficient environment space for %s/n",				WINBINDD_DONT_ENV));		else			DEBUG(10,("sys_getgrouplist(): disabled winbindd for group lookup [user == %s]/n",				user));	}#ifdef HAVE_GETGROUPLIST	retval = getgrouplist(user, gid, groups, grpcnt);#else	become_root();	retval = getgrouplist_internals(user, gid, groups, grpcnt);	unbecome_root();#endif	/* allow winbindd lookups */	winbind_on();		return retval;}
开发者ID:Nymphetaminer,项目名称:dsl-n55u,代码行数:30,


示例12: add_printers_by_registry

static BOOL add_printers_by_registry( REGSUBKEY_CTR *subkeys ){	int i, num_keys, snum;	char *printername;	NT_PRINTER_INFO_LEVEL_2 info2;	NT_PRINTER_INFO_LEVEL printer;		ZERO_STRUCT( info2 );	printer.info_2 = &info2;		num_keys = regsubkey_ctr_numkeys( subkeys );		become_root();	for ( i=0; i<num_keys; i++ ) {		printername = regsubkey_ctr_specific_key( subkeys, i );		snum = find_service( printername );				/* just verify a valied snum for now */		if ( snum == -1 ) {			fstrcpy( info2.printername, printername );			fstrcpy( info2.sharename, printername );			if ( !add_printer_hook( NULL, &printer ) ) {				DEBUG(0,("add_printers_by_registry: Failed to add printer [%s]/n",					printername));			}			}	}	unbecome_root();	return True;}
开发者ID:AllardJ,项目名称:Tomato,代码行数:31,


示例13: store_acl_blob_fsp

static NTSTATUS store_acl_blob_fsp(vfs_handle_struct *handle,				files_struct *fsp,				DATA_BLOB *pblob){	int ret;	int saved_errno = 0;	DEBUG(10,("store_acl_blob_fsp: storing blob length %u on file %s/n",		  (unsigned int)pblob->length, fsp_str_dbg(fsp)));	become_root();	if (fsp->fh->fd != -1) {		ret = SMB_VFS_FSETXATTR(fsp, XATTR_NTACL_NAME,			pblob->data, pblob->length, 0);	} else {		ret = SMB_VFS_SETXATTR(fsp->conn, fsp->fsp_name->base_name,				XATTR_NTACL_NAME,				pblob->data, pblob->length, 0);	}	if (ret) {		saved_errno = errno;	}	unbecome_root();	if (ret) {		DEBUG(5, ("store_acl_blob_fsp: setting attr failed for file %s"			"with error %s/n",			fsp_str_dbg(fsp),			strerror(saved_errno) ));		errno = saved_errno;		return map_nt_error_from_unix(saved_errno);	}	return NT_STATUS_OK;}
开发者ID:DanilKorotenko,项目名称:samba,代码行数:33,


示例14: ad_conv_dehex

/*! * Remove hexencoded dots and slashes (":2e" and ":2f") */static int ad_conv_dehex(const char *path, const struct stat *sp, const struct vol *vol, const char **newpathp){    EC_INIT;    static char buf[MAXPATHLEN];    const char *adpath, *p;    int adflags = S_ISDIR(sp->st_mode) ? ADFLAGS_DIR : 0;    bstring newpath = NULL;    LOG(log_debug, logtype_default,"ad_conv_dehex(/"%s/"): BEGIN", fullpathname(path));    *newpathp = NULL;    if ((p = strchr(path, ':')) == NULL)        goto EC_CLEANUP;    EC_NULL( newpath = bfromcstr(path) );    EC_ZERO( bfindreplace(newpath, bfromcstr(":2e"), bfromcstr("."), 0) );    EC_ZERO( bfindreplace(newpath, bfromcstr(":2f"), bfromcstr(":"), 0) );        become_root();    if (adflags != ADFLAGS_DIR)        rename(vol->ad_path(path, 0), vol->ad_path(bdata(newpath), 0));    rename(path, bdata(newpath));    unbecome_root();    strlcpy(buf, bdata(newpath), sizeof(buf));    *newpathp = buf;EC_CLEANUP:    if (newpath)        bdestroy(newpath);    EC_EXIT;}
开发者ID:NTmatter,项目名称:Netatalk,代码行数:37,


示例15: store_acl_blob_pathname

static NTSTATUS store_acl_blob_pathname(vfs_handle_struct *handle,					const char *fname,					DATA_BLOB *pblob){	connection_struct *conn = handle->conn;	int ret;	int saved_errno = 0;	DEBUG(10,("store_acl_blob_pathname: storing blob "			"length %u on file %s/n",			(unsigned int)pblob->length, fname));	become_root();	ret = SMB_VFS_SETXATTR(conn, fname,				XATTR_NTACL_NAME,				pblob->data, pblob->length, 0);	if (ret) {		saved_errno = errno;	}	unbecome_root();	if (ret) {		errno = saved_errno;		DEBUG(5, ("store_acl_blob_pathname: setting attr failed "			"for file %s with error %s/n",			fname,			strerror(errno) ));		return map_nt_error_from_unix(errno);	}	return NT_STATUS_OK;}
开发者ID:gojdic,项目名称:samba,代码行数:30,


示例16: acl_tdb_init

static bool acl_tdb_init(void){	char *dbname;	if (acl_db) {		ref_count++;		return true;	}	dbname = state_path("file_ntacls.tdb");	if (dbname == NULL) {		errno = ENOSYS;		return false;	}	become_root();	acl_db = db_open(NULL, dbname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600,			 DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);	unbecome_root();	if (acl_db == NULL) {#if defined(ENOTSUP)		errno = ENOTSUP;#else		errno = ENOSYS;#endif		TALLOC_FREE(dbname);		return false;	}	ref_count++;	TALLOC_FREE(dbname);	return true;}
开发者ID:encukou,项目名称:samba,代码行数:35,


示例17: posix_eadb_init

static bool posix_eadb_init(int snum, struct tdb_wrap **p_db){	struct tdb_wrap *db;	struct loadparm_context *lp_ctx;	const char *eadb = lp_parm_const_string(snum, "posix", "eadb", NULL);	if (!eadb) {		DEBUG(0, ("Can not use vfs_posix_eadb without posix:eadb set/n"));		return false;	}	lp_ctx = loadparm_init_s3(NULL, loadparm_s3_helpers());	become_root();	db = tdb_wrap_open(NULL, eadb, 50000,			   TDB_DEFAULT, O_RDWR|O_CREAT, 0600,			   lp_ctx);	unbecome_root();	talloc_unlink(NULL, lp_ctx);	/* now we know dbname is not NULL */	if (db == NULL) {#if defined(ENOTSUP)		errno = ENOTSUP;#else		errno = ENOSYS;#endif		return false;	}	*p_db = db;	return true;}
开发者ID:AIdrifter,项目名称:samba,代码行数:34,


示例18: update_smbpassword_file

/** * update the encrypted smbpasswd file from the plaintext username and password * *  this ugly hack needs to die, but not quite yet, I think people still use it... **/static BOOL update_smbpassword_file(const char *user, const char *password){    struct samu 	*sampass;    BOOL            ret;    if ( !(sampass = samu_new( NULL )) ) {        return False;    }    become_root();    ret = pdb_getsampwnam(sampass, user);    unbecome_root();    if(ret == False) {        DEBUG(0,("pdb_getsampwnam returned NULL/n"));        TALLOC_FREE(sampass);        return False;    }    /*     * Remove the account disabled flag - we are updating the     * users password from a login.     */    if (!pdb_set_acct_ctrl(sampass, pdb_get_acct_ctrl(sampass) & ~ACB_DISABLED, PDB_CHANGED)) {        TALLOC_FREE(sampass);        return False;    }    if (!pdb_set_plaintext_passwd (sampass, password)) {        TALLOC_FREE(sampass);        return False;    }    /* Now write it into the file. */    become_root();    ret = NT_STATUS_IS_OK(pdb_update_sam_account (sampass));    unbecome_root();    if (ret) {        DEBUG(3,("pdb_update_sam_account returned %d/n",ret));    }    TALLOC_FREE(sampass);    return ret;}
开发者ID:schidler,项目名称:flyzjhz-rt-n56u,代码行数:52,


示例19: get_md4pw

static BOOL get_md4pw(char *md4pw, char *mach_acct){	SAM_ACCOUNT *sampass = NULL;	const uint8 *pass;	BOOL ret;	uint32 acct_ctrl;#if 0    /*     * Currently this code is redundent as we already have a filter     * by hostname list. What this code really needs to do is to      * get a hosts allowed/hosts denied list from the SAM database     * on a per user basis, and make the access decision there.     * I will leave this code here for now as a reminder to implement     * this at a later date. JRA.     */	if (!allow_access(lp_domain_hostsdeny(), lp_domain_hostsallow(),	                  client_name(), client_addr()))	{		DEBUG(0,("get_md4pw: Workstation %s denied access to domain/n", mach_acct));		return False;	}#endif /* 0 */	if(!NT_STATUS_IS_OK(pdb_init_sam(&sampass)))		return False;	/* JRA. This is ok as it is only used for generating the challenge. */	become_root();	ret=pdb_getsampwnam(sampass, mach_acct);	unbecome_root();  	if (ret==False) { 		DEBUG(0,("get_md4pw: Workstation %s: no account in domain/n", mach_acct));		pdb_free_sam(&sampass);		return False;	}	acct_ctrl = pdb_get_acct_ctrl(sampass);	if (!(acct_ctrl & ACB_DISABLED) &&	    ((acct_ctrl & ACB_DOMTRUST) ||	     (acct_ctrl & ACB_WSTRUST) ||	     (acct_ctrl & ACB_SVRTRUST)) &&	    ((pass=pdb_get_nt_passwd(sampass)) != NULL)) {		memcpy(md4pw, pass, 16);		dump_data(5, md4pw, 16); 		pdb_free_sam(&sampass);		return True;	} 		DEBUG(0,("get_md4pw: Workstation %s: no account in domain/n", mach_acct));	pdb_free_sam(&sampass);	return False;}
开发者ID:Nymphetaminer,项目名称:dsl-n55u,代码行数:56,


示例20: atalk_unlink_file

static int atalk_unlink_file(const char *path){	int ret = 0;	become_root();	ret = unlink(path);	unbecome_root();		return ret;}
开发者ID:jameshilliard,项目名称:WECB-BH-GPL,代码行数:10,


示例21: file_ntimes

int file_ntimes(connection_struct *conn, const struct smb_filename *smb_fname,		struct smb_file_time *ft){	int ret = -1;	errno = 0;	DEBUG(6, ("file_ntime: actime: %s",		  time_to_asc(convert_timespec_to_time_t(ft->atime))));	DEBUG(6, ("file_ntime: modtime: %s",		  time_to_asc(convert_timespec_to_time_t(ft->mtime))));	DEBUG(6, ("file_ntime: ctime: %s",		  time_to_asc(convert_timespec_to_time_t(ft->ctime))));	DEBUG(6, ("file_ntime: createtime: %s",		  time_to_asc(convert_timespec_to_time_t(ft->create_time))));	/* Don't update the time on read-only shares */	/* We need this as set_filetime (which can be called on	   close and other paths) can end up calling this function	   without the NEED_WRITE protection. Found by : 	   Leo Weppelman <[email
C++ unbind函数代码示例
C++ umtx_unlock函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。