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

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

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

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

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

示例1: tdbsam_tdbopen

static TDB_CONTEXT * tdbsam_tdbopen (const char *name, int open_flags){	TDB_CONTEXT 	*pdb_tdb;	tdbsamver_t	version;		/* Try to open tdb passwd */	if (!(pdb_tdb = tdb_open_log(name, 0, TDB_DEFAULT, 				     open_flags, 0600))) {		DEBUG(0, ("Unable to open/create TDB passwd/n"));		return NULL;	}	/* Check the version */	version = (tdbsamver_t) tdb_fetch_int32(pdb_tdb, 						TDBSAM_VERSION_STRING);	if (version == -1)		version = 0;	/* Version not found, assume version 0 */		/* Compare the version */	if (version > TDBSAM_VERSION) {		/* Version more recent than the latest known */ 		DEBUG(0, ("TDBSAM version unknown: %d/n", version));		tdb_close(pdb_tdb);		pdb_tdb = NULL;	} 	else if (version < TDBSAM_VERSION) {		/* Older version, must be converted */		DEBUG(1, ("TDBSAM version too old (%d), trying to convert it./n", version));				/* Reopen the pdb file with read-write access if needed */		if (!(open_flags & O_RDWR)) {			DEBUG(10, ("tdbsam_tdbopen: TDB file opened with read only access, reopen it with read-write access./n"));			tdb_close(pdb_tdb);			pdb_tdb = tdb_open_log(name, 0, TDB_DEFAULT, (open_flags & 07777770) | O_RDWR, 0600);		}				/* Convert */		if (!tdbsam_convert(pdb_tdb, version)){			DEBUG(0, ("tdbsam_tdbopen: Error when trying to convert tdbsam: %s/n",name));			tdb_close(pdb_tdb);			pdb_tdb = NULL;		} else {			DEBUG(1, ("TDBSAM converted successfully./n"));		}		/* Reopen the pdb file as it must be */		if (!(open_flags & O_RDWR)) {			tdb_close(pdb_tdb);			pdb_tdb = tdb_open_log(name, 0, TDB_DEFAULT, open_flags, 0600);		}	}		return pdb_tdb;}
开发者ID:Nymphetaminer,项目名称:dsl-n55u,代码行数:54,


示例2: send_message

/****************************************************************************send a message to a named destination****************************************************************************/static BOOL send_message(char *dest, int msg_type, void *buf, int len, BOOL duplicates){	BOOL retval = False;	pid_t pid = 0;	TDB_CONTEXT *the_tdb;	the_tdb = tdb_open_log(lock_path("connections.tdb"), 0, TDB_DEFAULT, O_RDWR, 0);	if (!the_tdb) {		fprintf(stderr,"Failed to open connections database in send_message./n");		return False;	}	/* "smbd" is the only broadcast operation */	if (strequal(dest,"smbd")) {		retval = message_send_all(the_tdb,msg_type, buf, len, duplicates, NULL);	} else if (strequal(dest,"nmbd")) {		pid = pidfile_pid(dest);		if (pid == 0) {			fprintf(stderr,"Can't find pid for nmbd/n");		}	} else if (strequal(dest,"self")) {		pid = getpid();	} else {		pid = atoi(dest);		if (pid == 0) {			fprintf(stderr,"Not a valid pid/n");		}			} 	tdb_close(the_tdb);	if (pid)		return message_send_pid(pid, msg_type, buf, len, duplicates);	else		return retval;}
开发者ID:livebox,项目名称:livebox2,代码行数:38,


示例3: net_idmap_dump

/*********************************************************** Dump the current idmap **********************************************************/static int net_idmap_dump(struct net_context *c, int argc, const char **argv){	TDB_CONTEXT *idmap_tdb;	if ( argc != 1  || c->display_usage) {		d_printf(_("Usage:/n"			   "net idmap dump <inputfile>/n"			   "  Dump current ID mapping./n"			   "    inputfile/tTDB file to read mappings from./n"));		return c->display_usage?0:-1;	}	idmap_tdb = tdb_open_log(argv[0], 0, TDB_DEFAULT, O_RDONLY, 0);	if (idmap_tdb == NULL) {		d_fprintf(stderr, _("Could not open idmap: %s/n"), argv[0]);		return -1;	}	tdb_traverse(idmap_tdb, net_idmap_dump_one_entry, NULL);	tdb_close(idmap_tdb);	return 0;}
开发者ID:0x24bin,项目名称:winexe-1,代码行数:28,


示例4: unexpected_packet

/**************************************************************************** all unexpected packets are passed in here, to be stored in a unexpected packet database. This allows nmblookup and other tools to receive packets erroneoously sent to the wrong port by broken MS systems  **************************************************************************/void unexpected_packet(struct packet_struct *p){	static int count;	TDB_DATA kbuf, dbuf;	struct unexpected_key key;	char buf[1024];	int len=0;	if (!tdbd) {		tdbd = tdb_open_log(lock_path("unexpected.tdb"), 0,			       TDB_CLEAR_IF_FIRST|TDB_DEFAULT,			       O_RDWR | O_CREAT, 0644);		if (!tdbd) {			DEBUG(0,("Failed to open unexpected.tdb/n"));			return;		}	}	memset(buf,'/0',sizeof(buf));	len = build_packet(buf, p);	key.packet_type = p->packet_type;	key.timestamp = p->timestamp;	key.count = count++;	kbuf.dptr = (char *)&key;	kbuf.dsize = sizeof(key);	dbuf.dptr = buf;	dbuf.dsize = len;	tdb_store(tdbd, kbuf, dbuf, TDB_REPLACE);}
开发者ID:livebox,项目名称:livebox2,代码行数:38,


示例5: do_winbind_online

static bool do_winbind_online(struct tevent_context *ev_ctx,			      struct messaging_context *msg_ctx,			      const struct server_id pid,			      const int argc, const char **argv){	TDB_CONTEXT *tdb;	if (argc != 1) {		fprintf(stderr, "Usage: smbcontrol winbindd online/n");		return False;	}	/* Remove the entry in the winbindd_cache tdb to tell a later	   starting winbindd that we're online. */	tdb = tdb_open_log(state_path("winbindd_cache.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);	if (!tdb) {		fprintf(stderr, "Cannot open the tdb %s for writing./n",			state_path("winbindd_cache.tdb"));		return False;	}	tdb_delete_bystring(tdb, "WINBINDD_OFFLINE");	tdb_close(tdb);	return send_message(msg_ctx, pid, MSG_WINBIND_ONLINE, NULL, 0);}
开发者ID:srimalik,项目名称:samba,代码行数:27,


示例6: share_info_db_init

BOOL share_info_db_init(void){	const char *vstring = "INFO/version";	int32 vers_id; 	if (share_tdb) {		return True;	}	share_tdb = tdb_open_log(lock_path("share_info.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);	if (!share_tdb) {		DEBUG(0,("Failed to open share info database %s (%s)/n",			lock_path("share_info.tdb"), strerror(errno) ));		return False;	} 	/* handle a Samba upgrade */	tdb_lock_bystring(share_tdb, vstring);	/* Cope with byte-reversed older versions of the db. */	vers_id = tdb_fetch_int32(share_tdb, vstring);	if ((vers_id == SHARE_DATABASE_VERSION_V1) || (IREV(vers_id) == SHARE_DATABASE_VERSION_V1)) {		/* Written on a bigendian machine with old fetch_int code. Save as le. */		tdb_store_int32(share_tdb, vstring, SHARE_DATABASE_VERSION_V2);		vers_id = SHARE_DATABASE_VERSION_V2;	}	if (vers_id != SHARE_DATABASE_VERSION_V2) {		tdb_traverse(share_tdb, tdb_traverse_delete_fn, NULL);		tdb_store_int32(share_tdb, vstring, SHARE_DATABASE_VERSION_V2);	}	tdb_unlock_bystring(share_tdb, vstring);	return True;}
开发者ID:AllardJ,项目名称:Tomato,代码行数:35,


示例7: gencache_init

BOOL gencache_init(void){	char* cache_fname = NULL;		/* skip file open if it's already opened */	if (cache) return True;	asprintf(&cache_fname, "%s/%s", lp_lockdir(), "gencache.tdb");	if (cache_fname)		DEBUG(5, ("Opening cache file at %s/n", cache_fname));	else {		DEBUG(0, ("Filename allocation failed./n"));		return False;	}	cache = tdb_open_log(cache_fname, 0, TDB_DEFAULT,	                     O_RDWR|O_CREAT, 0644);	SAFE_FREE(cache_fname);	if (!cache) {		DEBUG(5, ("Attempt to open gencache.tdb has failed./n"));		return False;	}	return True;}
开发者ID:Nymphetaminer,项目名称:dsl-n55u,代码行数:25,


示例8: namecache_enable

BOOL namecache_enable(void){	/* Check if we have been here before, or name caching disabled           by setting the name cache timeout to zero. */ 	if (done_namecache_init)		return False;	done_namecache_init = True;	if (lp_name_cache_timeout() == 0) {		DEBUG(5, ("namecache_init: disabling netbios name cache/n"));		return False;	}	/* Open namecache tdb in read/write or readonly mode */	namecache_tdb = tdb_open_log(		lock_path("namecache.tdb"), 0,		TDB_DEFAULT, O_RDWR | O_CREAT, 0644);	if (!namecache_tdb) {		DEBUG(5, ("namecache_init: could not open %s/n",			  lock_path("namecache.tdb")));		return False;	}	DEBUG(5, ("namecache_init: enabling netbios namecache, timeout %d "		  "seconds/n", lp_name_cache_timeout()));	enable_namecache = True;	return True;}
开发者ID:jophxy,项目名称:samba,代码行数:34,


示例9: _reg_perfcount_get_counter_data

static bool _reg_perfcount_get_counter_data(TDB_DATA key, TDB_DATA *data){	TDB_CONTEXT *counters;	char *fname;	fname = counters_directory(DATA_DB);	if (fname == NULL) {		return false;	}	counters = tdb_open_log(fname, 0, TDB_DEFAULT, O_RDONLY, 0444);	if (counters == NULL) {		DEBUG(1, ("reg_perfcount_get_counter_data: unable to open [%s]./n", fname));		TALLOC_FREE(fname);		return False;	}	TALLOC_FREE(fname);	*data = tdb_fetch(counters, key);	tdb_close(counters);	return True;}
开发者ID:Alexander--,项目名称:samba,代码行数:25,


示例10: login_cache_init

bool login_cache_init(void){	char* cache_fname = NULL;	/* skip file open if it's already opened */	if (cache) return True;	cache_fname = cache_path(LOGIN_CACHE_FILE);	if (cache_fname == NULL) {		DEBUG(0, ("Filename allocation failed./n"));		return False;	}	DEBUG(5, ("Opening cache file at %s/n", cache_fname));	cache = tdb_open_log(cache_fname, 0, TDB_DEFAULT,	                     O_RDWR|O_CREAT, 0644);	if (!cache)		DEBUG(5, ("Attempt to open %s failed./n", cache_fname));	TALLOC_FREE(cache_fname);	return (cache ? True : False);}
开发者ID:Alexander--,项目名称:samba,代码行数:25,


示例11: talloc

struct idmap_cache_ctx *idmap_cache_init(TALLOC_CTX *memctx){	struct idmap_cache_ctx *cache;	char* cache_fname = NULL;	cache = talloc(memctx, struct idmap_cache_ctx);	if ( ! cache) {		DEBUG(0, ("Out of memory!/n"));		return NULL;	}	cache_fname = lock_path("idmap_cache.tdb");	DEBUG(10, ("Opening cache file at %s/n", cache_fname));	cache->tdb = tdb_open_log(cache_fname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);	if (!cache->tdb) {		DEBUG(5, ("Attempt to open %s has failed./n", cache_fname));		return NULL;	}	talloc_set_destructor(cache, idmap_cache_destructor);	return cache;}
开发者ID:edwacode,项目名称:r6300v2,代码行数:26,


示例12: net_idmap_fixup_hwm

static NTSTATUS net_idmap_fixup_hwm(void){	NTSTATUS result = NT_STATUS_UNSUCCESSFUL;	TDB_CONTEXT *idmap_tdb;	char *tdbfile = NULL;	struct hwms hwms;	struct hwms highest;	if (!lp_idmap_uid(&hwms.user_hwm, &highest.user_hwm) ||	    !lp_idmap_gid(&hwms.group_hwm, &highest.group_hwm)) {		d_fprintf(stderr, "idmap range missing/n");		return NT_STATUS_UNSUCCESSFUL;	}	tdbfile = SMB_STRDUP(lock_path("winbindd_idmap.tdb"));	if (!tdbfile) {		DEBUG(0, ("idmap_init: out of memory!/n"));		return NT_STATUS_NO_MEMORY;	}	idmap_tdb = tdb_open_log(tdbfile, 0, TDB_DEFAULT, O_RDWR, 0);	if (idmap_tdb == NULL) {		d_fprintf(stderr, "Could not open idmap: %s/n", tdbfile);		return NT_STATUS_NO_SUCH_FILE;	}	hwms.ok = True;	tdb_traverse(idmap_tdb, net_idmap_find_max_id, &hwms);	if (!hwms.ok) {		goto done;	}	d_printf("USER HWM: %d  GROUP HWM: %d/n",		 hwms.user_hwm, hwms.group_hwm);	if (hwms.user_hwm >= highest.user_hwm) {		d_fprintf(stderr, "Highest UID out of uid range/n");		goto done;	}	if (hwms.group_hwm >= highest.group_hwm) {		d_fprintf(stderr, "Highest GID out of gid range/n");		goto done;	}	if ((tdb_store_int32(idmap_tdb, "USER HWM", (int32)hwms.user_hwm) != 0) ||	    (tdb_store_int32(idmap_tdb, "GROUP HWM", (int32)hwms.group_hwm) != 0)) {		d_fprintf(stderr, "Could not store HWMs/n");		goto done;	}	result = NT_STATUS_OK; done:	tdb_close(idmap_tdb);	return result;}
开发者ID:DeezNuts12,项目名称:freestyledash,代码行数:60,


示例13: DEBUG

TDB_CONTEXT *elog_init_tdb( char *tdbfilename ){	TDB_CONTEXT *tdb;	DEBUG(10,("elog_init_tdb: Initializing eventlog tdb (%s)/n",		tdbfilename));	tdb = tdb_open_log( tdbfilename, 0, TDB_DEFAULT,		O_RDWR|O_CREAT|O_TRUNC, 0660 );	if ( !tdb ) {		DEBUG( 0, ( "Can't open tdb for [%s]/n", tdbfilename ) );		return NULL;	}	/* initialize with defaults, copy real values in here from registry */	tdb_store_int32( tdb, EVT_OLDEST_ENTRY, 1 );	tdb_store_int32( tdb, EVT_NEXT_RECORD, 1 );	tdb_store_int32( tdb, EVT_MAXSIZE, 0x80000 );	tdb_store_int32( tdb, EVT_RETENTION, 0x93A80 );	tdb_store_int32( tdb, EVT_VERSION, EVENTLOG_DATABASE_VERSION_V1 );	return tdb;}
开发者ID:gojdic,项目名称:samba,代码行数:26,


示例14: 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,


示例15: send_message

static BOOL send_message(pid_t pid, int msg_type, const void *buf, int len,			 BOOL duplicates){	TDB_CONTEXT *tdb;	BOOL ret;	int n_sent = 0;	if (!message_init())		return False;	if (pid != 0)		return message_send_pid(pid, msg_type, buf, len, duplicates);	tdb = tdb_open_log(lock_path("connections.tdb"), 0, 			   TDB_DEFAULT, O_RDWR, 0);	if (!tdb) {		fprintf(stderr,"Failed to open connections database"			": %s/n", strerror(errno));		return False;	}		ret = message_send_all(tdb,msg_type, buf, len, duplicates,			       &n_sent);	DEBUG(10,("smbcontrol/send_message: broadcast message to "		  "%d processes/n", n_sent));		tdb_close(tdb);		return ret;}
开发者ID:hajuuk,项目名称:R7000,代码行数:30,


示例16: send_status_message

static BOOL send_status_message(struct process_id pid){	TDB_CONTEXT *tdb;	BOOL ret;	int n_sent = 0;	if (!message_init())		return False;	if (procid_to_pid(&pid) != 0) {		return NT_STATUS_IS_OK(message_send_pid(pid, MSG_USR_STATS,				    NULL, 0, False /* duplicates */));	}	tdb = tdb_open_log(lock_path("connections.tdb"), 0,			   TDB_DEFAULT, O_RDWR, 0);	if (!tdb) {		fprintf(stderr,"Failed to open connections database"			": %s/n", strerror(errno));		return False;	}	ret = message_send_all(tdb, MSG_USR_STATS, NULL, 0,				False /* duplicates */, &n_sent);	DEBUG(10,("smbcontrol/send_message: broadcast message to "		  "%d processes/n", n_sent));	tdb_close(tdb);	return ret;}
开发者ID:aosm,项目名称:samba,代码行数:29,


示例17: tdb_open_log

TDB_CONTEXT *conn_tdb_ctx(void){	if (!tdb)		tdb = tdb_open_log(lock_path("connections.tdb"), 0, TDB_CLEAR_IF_FIRST|TDB_DEFAULT, 			       O_RDWR | O_CREAT, 0644);	return tdb;}
开发者ID:niubl,项目名称:camera_project,代码行数:8,


示例18: privilege_init

/* initialise the privilege database */BOOL privilege_init(void){	tdb = tdb_open_log(lock_path("privilege.tdb"), 0, TDB_DEFAULT, 			   O_RDWR|O_CREAT, 0600);	if (!tdb) {		DEBUG(0,("Failed to open privilege database/n"));		return False;	}	return True;}
开发者ID:Nymphetaminer,项目名称:dsl-n55u,代码行数:12,


示例19: tdbsam_delete_sam_account

static NTSTATUS tdbsam_delete_sam_account(struct pdb_methods *my_methods, SAM_ACCOUNT *sam_pass){	NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;	struct tdbsam_privates *tdb_state = (struct tdbsam_privates *)my_methods->private_data;	TDB_CONTEXT 	*pwd_tdb;	TDB_DATA 	key;	fstring 	keystr;	uint32		rid;	fstring		name;		fstrcpy(name, pdb_get_username(sam_pass));	strlower_m(name);		/* open the TDB */	if (!(pwd_tdb = tdb_open_log(tdb_state->tdbsam_location, 0, TDB_DEFAULT, O_RDWR, 0600))) {		DEBUG(0, ("Unable to open TDB passwd!"));		return nt_status;	}    	/* set the search key */	slprintf(keystr, sizeof(keystr)-1, "%s%s", USERPREFIX, name);	key.dptr = keystr;	key.dsize = strlen (keystr) + 1;		rid = pdb_get_user_rid(sam_pass);	/* it's outaa here!  8^) */	if (tdb_delete(pwd_tdb, key) != TDB_SUCCESS) {		DEBUG(5, ("Error deleting entry from tdb passwd database!/n"));		DEBUGADD(5, (" Error: %s/n", tdb_errorstr(pwd_tdb)));		tdb_close(pwd_tdb); 		return nt_status;	}		/* delete also the RID key */  	/* set the search key */	slprintf(keystr, sizeof(keystr)-1, "%s%.8x", RIDPREFIX, rid);	key.dptr = keystr;	key.dsize = strlen (keystr) + 1;	/* it's outaa here!  8^) */	if (tdb_delete(pwd_tdb, key) != TDB_SUCCESS) {		DEBUG(5, ("Error deleting entry from tdb rid database!/n"));		DEBUGADD(5, (" Error: %s/n", tdb_errorstr(pwd_tdb)));		tdb_close(pwd_tdb); 		return nt_status;	}		tdb_close(pwd_tdb);		return NT_STATUS_OK;}
开发者ID:cmtsij,项目名称:Vizio_XWR100_GPL,代码行数:53,


示例20: reg_perfcount_get_base_index

uint32_t reg_perfcount_get_base_index(void){	char *fname;	TDB_CONTEXT *names;	TDB_DATA kbuf, dbuf;	char key[] = "1";	uint32_t retval = 0;	char buf[PERFCOUNT_MAX_LEN];	fname = counters_directory(NAMES_DB);	if (fname == NULL) {		return 0;	}	names = tdb_open_log(fname, 0, TDB_DEFAULT, O_RDONLY, 0444);	if ( !names ) {		DEBUG(2, ("reg_perfcount_get_base_index: unable to open [%s]./n", fname));		TALLOC_FREE(fname);		return 0;	}	/* needs to read the value of key "1" from the counter_names.tdb file, as that is	   where the total number of counters is stored. We're assuming no holes in the	   enumeration.	   The format for the counter_names.tdb file is:	   key        value	   1          num_counters	   2          perf_counter1	   3          perf_counter1_help	   4          perf_counter2	   5          perf_counter2_help	   even_num   perf_counter<even_num>	   even_num+1 perf_counter<even_num>_help	   and so on.	   So last_counter becomes num_counters*2, and last_help will be last_counter+1 */	kbuf = string_tdb_data(key);	dbuf = tdb_fetch(names, kbuf);	if(dbuf.dptr == NULL)	{		DEBUG(1, ("reg_perfcount_get_base_index: failed to find key /'1/' in [%s]./n", fname));		tdb_close(names);		TALLOC_FREE(fname);		return 0;	}	tdb_close(names);	TALLOC_FREE(fname);	memset(buf, 0, PERFCOUNT_MAX_LEN);	memcpy(buf, dbuf.dptr, dbuf.dsize);	retval = (uint32_t)atoi(buf);	SAFE_FREE(dbuf.dptr);	return retval;}
开发者ID:Alexander--,项目名称:samba,代码行数:53,


示例21: init_account_policy

BOOL init_account_policy(void){	const char *vstring = "INFO/version";	uint32 version;	int i;	if (tdb) {		return True;	}	tdb = tdb_open_log(lock_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);	if (!tdb) {		DEBUG(0,("Failed to open account policy database/n"));		return False;	}	/* handle a Samba upgrade */	tdb_lock_bystring(tdb, vstring);	if (!tdb_fetch_uint32(tdb, vstring, &version) || version != DATABASE_VERSION) {		tdb_store_uint32(tdb, vstring, DATABASE_VERSION);		for (i=0; account_policy_names[i].field; i++) {			if (!account_policy_set_default_on_empty(account_policy_names[i].field)) {				DEBUG(0,("failed to set default value in account policy tdb/n"));				return False;			}		}	}	tdb_unlock_bystring(tdb, vstring);	/* These exist by default on NT4 in [HKLM/SECURITY/Policy/Accounts] */	privilege_create_account( &global_sid_World );	privilege_create_account( &global_sid_Builtin_Account_Operators );	privilege_create_account( &global_sid_Builtin_Server_Operators );	privilege_create_account( &global_sid_Builtin_Print_Operators );	privilege_create_account( &global_sid_Builtin_Backup_Operators );	/* BUILTIN/Administrators get everything -- *always* */	if ( lp_enable_privileges() ) {		if ( !grant_all_privileges( &global_sid_Builtin_Administrators ) ) {			DEBUG(1,("init_account_policy: Failed to grant privileges "				"to BUILTIN//Administrators!/n"));		}	}	return True;}
开发者ID:DeezNuts12,项目名称:freestyledash,代码行数:53,


示例22: netsamlogon_cache_init

bool netsamlogon_cache_init(void){    bool first_try = true;    char *path = NULL;    int ret;    struct tdb_context *tdb;    if (netsamlogon_tdb) {        return true;    }    path = cache_path(NETSAMLOGON_TDB);    if (path == NULL) {        return false;    }again:    tdb = tdb_open_log(path, 0, TDB_DEFAULT|TDB_INCOMPATIBLE_HASH,                       O_RDWR | O_CREAT, 0600);    if (tdb == NULL) {        DEBUG(0,("tdb_open_log('%s') - failed/n", path));        goto clear;    }    ret = tdb_check(tdb, NULL, NULL);    if (ret != 0) {        tdb_close(tdb);        DEBUG(0,("tdb_check('%s') - failed/n", path));        goto clear;    }    netsamlogon_tdb = tdb;    talloc_free(path);    return true;clear:    if (!first_try) {        talloc_free(path);        return false;    }    first_try = false;    DEBUG(0,("retry after truncate for '%s'/n", path));    ret = truncate(path, 0);    if (ret == -1) {        DBG_ERR("truncate failed: %s/n", strerror(errno));        talloc_free(path);        return false;    }    goto again;}
开发者ID:samba-team,项目名称:samba,代码行数:51,


示例23: regdb_init

BOOL regdb_init( void ){	const char *vstring = "INFO/version";	uint32 vers_id;	if ( tdb_reg )		return True;	if ( !(tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600)) )	{		tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);		if ( !tdb_reg ) {			DEBUG(0,("regdb_init: Failed to open registry %s (%s)/n",				lock_path("registry.tdb"), strerror(errno) ));			return False;		}				DEBUG(10,("regdb_init: Successfully created registry tdb/n"));	}	tdb_refcount = 1;			vers_id = tdb_fetch_int32(tdb_reg, vstring);	if ( vers_id != REGVER_V1 ) {		/* any upgrade code here if needed */	}	/* always setup the necessary keys and values */	if ( !init_registry_data() ) {		DEBUG(0,("init_registry: Failed to initialize data in registry!/n"));		return False;	}	return True;}
开发者ID:AllardJ,项目名称:Tomato,代码行数:38,


示例24: tdbsam_setsampwent

static NTSTATUS tdbsam_setsampwent(struct pdb_methods *my_methods, BOOL update){	struct tdbsam_privates *tdb_state = (struct tdbsam_privates *)my_methods->private_data;		/* Open tdb passwd */	if (!(tdb_state->passwd_tdb = tdb_open_log(tdb_state->tdbsam_location, 0, TDB_DEFAULT, update?(O_RDWR|O_CREAT):O_RDONLY, 0600)))	{		DEBUG(0, ("Unable to open/create TDB passwd/n"));		return NT_STATUS_UNSUCCESSFUL;	}		tdb_state->key = tdb_firstkey(tdb_state->passwd_tdb);	return NT_STATUS_OK;}
开发者ID:cmtsij,项目名称:Vizio_XWR100_GPL,代码行数:15,


示例25: reg_perfcount_get_counter_names

uint32_t reg_perfcount_get_counter_names(uint32_t base_index, char **retbuf){	char *buf1 = NULL;	uint32_t buffer_size = 0;	TDB_CONTEXT *names;	char *fname;	int i;	if (base_index == 0) {		return 0;	}	fname = counters_directory(NAMES_DB);	if (fname == NULL) {		return 0;	}	names = tdb_open_log(fname, 0, TDB_DEFAULT, O_RDONLY, 0444);	if (names == NULL) {		DEBUG(1, ("reg_perfcount_get_counter_names: unable to open [%s]./n", fname));		TALLOC_FREE(fname);		return 0;	}	TALLOC_FREE(fname);	buffer_size = _reg_perfcount_multi_sz_from_tdb(names, 1, retbuf, buffer_size);	for(i = 1; i <= base_index; i++)	{		buffer_size = _reg_perfcount_multi_sz_from_tdb(names, i*2, retbuf, buffer_size);	}	tdb_close(names);	/* Now terminate the MULTI_SZ with a double unicode NULL */	buf1 = *retbuf;	buf1 = (char *)SMB_REALLOC(buf1, buffer_size + 2);	if(!buf1) {		buffer_size = 0;	} else {		buf1[buffer_size++] = '/0';		buf1[buffer_size++] = '/0';	}	*retbuf=buf1;	return buffer_size;}
开发者ID:Alexander--,项目名称:samba,代码行数:48,


示例26: dump_user_stats

static void dump_user_stats(void){	TDB_CONTEXT *tdb;	int nump = 0;	message_register(MSG_USR_STATS, handle_usr_stat_reply, NULL);	tdb = tdb_open_log(lock_path("sessionid.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0);	if (!tdb) {		d_printf("/nsessionid.tdb not initialised/n");	} else {		d_printf("/nPID     Username      Group         OpCount              ByteCount            /n");		d_printf("------------------------------------------------------------------------------/n");		nump = tdb_traverse(tdb, traverse_processes, NULL);		//DEBUG(10,("Total %d procs traversed/n", nump));		tdb_close(tdb);	}	message_deregister(MSG_USR_STATS);}
开发者ID:aosm,项目名称:samba,代码行数:17,


示例27: net_idmap_delete

/*********************************************************** Delete a SID mapping from a winbindd_idmap.tdb **********************************************************/static int net_idmap_delete(int argc, const char **argv){	TDB_CONTEXT *idmap_tdb;	TDB_DATA key, data;	fstring sid;	if (argc != 2)		return net_help_idmap(argc, argv);	idmap_tdb = tdb_open_log(argv[0], 0, TDB_DEFAULT, O_RDWR, 0);	if (idmap_tdb == NULL) {		d_fprintf(stderr, "Could not open idmap: %s/n", argv[0]);		return -1;	}	fstrcpy(sid, argv[1]);	if (strncmp(sid, "S-1-5-", strlen("S-1-5-")) != 0) {		d_fprintf(stderr, "Can only delete SIDs, %s is does not start with "			 "S-1-5-/n", sid);		return -1;	}	key.dptr = sid;	key.dsize = strlen(key.dptr)+1;	data = tdb_fetch(idmap_tdb, key);	if (data.dptr == NULL) {		d_fprintf(stderr, "Could not find sid %s/n", argv[1]);		return -1;	}	if (tdb_delete(idmap_tdb, key) != 0) {		d_fprintf(stderr, "Could not delete key %s/n", argv[1]);		return -1;	}	if (tdb_delete(idmap_tdb, data) != 0) {		d_fprintf(stderr, "Could not delete key %s/n", data.dptr);		return -1;	}	return 0;}
开发者ID:DeezNuts12,项目名称:freestyledash,代码行数:49,


示例28: tdb_validate_open

/* * tdb validation function. * returns 0 if tdb is ok, != 0 if it isn't. * this is a wrapper around the actual validation function that opens and closes * the tdb. */int tdb_validate_open(const char *tdb_path, tdb_validate_data_func validate_fn){	TDB_CONTEXT *tdb = NULL;	int ret = 1;	DEBUG(5, ("tdb_validate_open called for tdb '%s'/n", tdb_path));	tdb = tdb_open_log(tdb_path, 0, TDB_DEFAULT, O_RDONLY, 0);	if (!tdb) {		DEBUG(1, ("Error opening tdb %s/n", tdb_path));		return ret;	}	ret = tdb_validate(tdb, validate_fn);	tdb_close(tdb);	return ret;}
开发者ID:gojdic,项目名称:samba,代码行数:23,



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


C++ tdb_traverse函数代码示例
C++ tdb_open函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。