コード例 #1
0
/**
  connect to the schannel ldb
*/
struct ldb_context *schannel_db_connect(TALLOC_CTX *mem_ctx)
{
	char *path;
	struct ldb_context *ldb;
	BOOL existed;
	const char *init_ldif = 
		"dn: @ATTRIBUTES\n" \
		"computerName: CASE_INSENSITIVE\n" \
		"flatname: CASE_INSENSITIVE\n";

	path = smbd_tmp_path(mem_ctx, "schannel.ldb");
	if (!path) {
		return NULL;
	}

	existed = file_exist(path);
	
	ldb = ldb_wrap_connect(mem_ctx, path, system_session(mem_ctx), 
			       NULL, LDB_FLG_NOSYNC, NULL);
	talloc_free(path);
	if (!ldb) {
		return NULL;
	}
	
	if (!existed) {
		gendb_add_ldif(ldb, init_ldif);
	}

	return ldb;
}
コード例 #2
0
ファイル: server.c プロジェクト: rti7743/samba
/*
  cleanup temporary files. This is the new alternative to
  TDB_CLEAR_IF_FIRST. Unfortunately TDB_CLEAR_IF_FIRST is not
  efficient on unix systems due to the lack of scaling of the byte
  range locking system. So instead of putting the burden on tdb to
  cleanup tmp files, this function deletes them. 
*/
static void cleanup_tmp_files(struct loadparm_context *lp_ctx)
{
	char *path;
	TALLOC_CTX *mem_ctx = talloc_new(NULL);

	path = smbd_tmp_path(mem_ctx, lp_ctx, NULL);

	recursive_delete(path);
	talloc_free(mem_ctx);
}
コード例 #3
0
ファイル: file_server.c プロジェクト: amitay/samba
/*
  generate a smbd config file for the file server
 */
static const char *generate_smb_conf(struct task_server *task)
{
	int fd;
	struct loadparm_context *lp_ctx = task->lp_ctx;
	const char *path = smbd_tmp_path(task, lp_ctx, "fileserver.conf");

	if (path == NULL) {
		return NULL;
	}

	fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, 0644);
	if (fd == -1) {
		DEBUG(0,("Failed to create %s", path));
		return NULL;
	}

	fdprintf(fd, "# auto-generated config for fileserver\n");
	fdprintf(fd, "auth methods = guest samba4\n");
	fdprintf(fd, "passdb backend = samba4\n");
        fdprintf(fd, "rpc_server:default = external\n");
        fdprintf(fd, "rpc_server:dssetup = disabled\n");
	fdprintf(fd, "rpc_server:spoolss = embedded\n");
	fdprintf(fd, "rpc_daemon:spoolssd = disabled\n");
	fdprintf(fd, "rpc_server:tcpip = no\n");

	/* If we are using xattr_tdb:file or posix:eadb then we need to load another VFS object */
	if (lpcfg_parm_string(lp_ctx, NULL, "xattr_tdb", "file")) {
		fdprintf(fd, "vfs objects = acl_xattr xattr_tdb\n");
	} else if (lpcfg_parm_string(lp_ctx, NULL, "posix", "eadb")) {
		fdprintf(fd, "vfs objects = acl_xattr posix_eadb\n");
	} else {
		fdprintf(fd, "vfs objects = acl_xattr\n");
	}

	fdprintf(fd, "include = %s\n", lpcfg_configfile(lp_ctx));

	fdprintf(fd, "[IPC$]\n");
	fdprintf(fd, " vfs objects = dfs_samba4\n");

	close(fd);
	return path;
}
コード例 #4
0
ファイル: util.c プロジェクト: amitay/samba
const char *lpcfg_imessaging_path(TALLOC_CTX *mem_ctx,
				       struct loadparm_context *lp_ctx)
{
	return smbd_tmp_path(mem_ctx, lp_ctx, "msg");
}