示例#1
0
文件: fs.c 项目: RTOSkit/plan9
/*
 * We request the domain referral for "" which gives the
 * list of all the trusted domains in the clients forest, and
 * other trusted forests.
 *
 * We then sumbit each of these names in turn which gives the
 * names of the domain controllers for that domain.
 *
 * We get a DNS domain name for each domain controller as well as a
 * netbios name.  I THINK I am correct in saying that a name
 * containing a dot ('.') must be a DNS name, as the NetBios
 * name munging cannot encode one.  Thus names which contain no
 * dots must be netbios names.
 */
static void
dfsredir(Fmt *f, char *path, int depth)
{
	Refer *re, retab[128];
	int n, used, flags;

	n = T2getdfsreferral(Sess, &Ipc, path, &flags, &used, retab, nelem(retab));
	if(n == -1)
		return;
	for(re = retab; re < retab+n; re++){
		if(strcmp(path, re->path) != 0)
			dfsredir(f, re->path, depth+1);
		else
			fmtprint(f, "%-32q %q\n", re->path, re->addr);
		free(re->addr);
		free(re->path);
	}
}
示例#2
0
文件: dfs.c 项目: Requaos/harvey
static int
redir1(Session *s, char *path, Dfscache *cp, int level)
{
	Refer retab[16], *re;
	int n, gflags, used, found;

	if(level > 8)
		return -1;

	if((n = T2getdfsreferral(s, &Ipc, path, &gflags, &used, retab,
	    nelem(retab))) == -1)
		return -1;

	if(! (gflags & DFS_HEADER_ROOT))
		used = SINT_MAX;

	found = 0;
	for(re = retab; re < retab+n; re++){
		if(Debug && strstr(Debug, "dfs") != nil)
			print("referal level=%d prox=%d path=%q addr=%q\n",
				level, re->prox, re->path, re->addr);

		if(gflags & DFS_HEADER_STORAGE){
			if(remap(cp, re) == 0)
				found = 1;
		} else{
			if(redir1(s, re->addr, cp, level+1) != -1)  /* ???? */
				found = 1;
		}
		free(re->addr);
		free(re->path);
	}

	if(Debug && strstr(Debug, "dfs") != nil)
		print("referal level=%d path=%q found=%d used=%d\n",
			level, path, found, used);
	if(!found)
		return -1;
	return used;
}