コード例 #1
0
ファイル: net_lookup.c プロジェクト: DavidMulder/samba
/* lookup hosts or IP addresses using internal samba lookup fns */
int net_lookup(struct net_context *c, int argc, const char **argv)
{
	int i;

	struct functable table[] = {
		{"HOST", net_lookup_host},
		{"LDAP", net_lookup_ldap},
		{"DC", net_lookup_dc},
		{"PDC", net_lookup_pdc},
		{"MASTER", net_lookup_master},
		{"KDC", net_lookup_kdc},
		{"NAME", net_lookup_name},
		{"SID", net_lookup_sid},
		{"DSGETDCNAME", net_lookup_dsgetdcname},
		{NULL, NULL}
	};

	if (argc < 1) {
		d_printf(_("\nUsage: \n"));
		return net_lookup_usage(c, argc, argv);
	}
	for (i=0; table[i].funcname; i++) {
		if (strcasecmp_m(argv[0], table[i].funcname) == 0)
			return table[i].fn(c, argc-1, argv+1);
	}

	/* Default to lookup a hostname so 'net lookup foo#1b' can be
	   used instead of 'net lookup host foo#1b'.  The host syntax
	   is a bit confusing as non #00 names can't really be
	   considered hosts as such. */

	return net_lookup_host(c, argc, argv);
}
コード例 #2
0
ファイル: net_lookup.c プロジェクト: hajuuk/R7000
/* lookup hosts or IP addresses using internal samba lookup fns */
int net_lookup(int argc, const char **argv)
{
	int i;

	struct functable table[] = {
		{"HOST", net_lookup_host},
		{"LDAP", net_lookup_ldap},
		{"DC", net_lookup_dc},
		{"MASTER", net_lookup_master},
		{"KDC", net_lookup_kdc},
		{NULL, NULL}
	};

	if (argc < 1) {
		d_printf("\nUsage: \n");
		return net_lookup_usage(argc, argv);
	}
	for (i=0; table[i].funcname; i++) {
		if (StrCaseCmp(argv[0], table[i].funcname) == 0)
			return table[i].fn(argc-1, argv+1);
	}

	/* Default to lookup a hostname so 'net lookup foo#1b' can be 
	   used instead of 'net lookup host foo#1b'.  The host syntax
	   is a bit confusing as non #00 names can't really be 
	   considered hosts as such. */

	return net_lookup_host(argc, argv);
}