compress a name component
*/
static uint8_t *compress_name(TALLOC_CTX *mem_ctx,
- uint8_t *name, enum nbt_name_type type)
+ const uint8_t *name, enum nbt_name_type type)
{
uint8_t *cname;
int i;
{
uint_t num_components;
uint8_t *components[MAX_COMPONENTS];
- char *dname, *dscope=NULL, *p;
+ char *dscope=NULL, *p;
uint8_t *cname;
int i;
return NT_STATUS_OK;
}
- dname = strupper_talloc(ndr, r->name);
- NT_STATUS_HAVE_NO_MEMORY(dname);
if (r->scope) {
- dscope = strupper_talloc(ndr, r->scope);
+ dscope = talloc_strdup(ndr, r->scope);
NT_STATUS_HAVE_NO_MEMORY(dscope);
}
- cname = compress_name(ndr, dname, r->type);
+ cname = compress_name(ndr, r->name, r->type);
NT_STATUS_HAVE_NO_MEMORY(cname);
/* form the base components */
status = nbt_name_dup(state, name, &state->name);
if (!NT_STATUS_IS_OK(status)) goto failed;
+ state->name.name = strupper_talloc(state, state->name.name);
+ if (state->name.name == NULL) goto failed;
+ if (state->name.scope) {
+ state->name.scope = strupper_talloc(state, state->name.scope);
+ if (state->name.scope == NULL) goto failed;
+ }
+
state->nbtsock = nbt_name_socket_init(state, event_ctx);
if (state->nbtsock == NULL) goto failed;
CHECK_VALUE(query.out.num_addrs, 1);
CHECK_STRING(query.out.reply_addrs[0], myaddress);
+
+ query.in.name.name = strupper_talloc(mem_ctx, name->name);
+ if (query.in.name.name &&
+ strcmp(query.in.name.name, name->name) != 0) {
+ printf("check case sensitivity\n");
+ status = nbt_name_query(nbtsock, mem_ctx, &query);
+ if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
+ printf("No response from %s for name query\n", address);
+ return False;
+ }
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
+ printf("Bad response from %s for name query - %s\n",
+ address, nt_errstr(status));
+ return False;
+ }
+ }
+
+ query.in.name = *name;
+ if (name->scope) {
+ query.in.name.scope = strupper_talloc(mem_ctx, name->scope);
+ }
+ if (query.in.name.scope &&
+ strcmp(query.in.name.scope, name->scope) != 0) {
+ printf("check case sensitivity on scope\n");
+ status = nbt_name_query(nbtsock, mem_ctx, &query);
+ if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
+ printf("No response from %s for name query\n", address);
+ return False;
+ }
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
+ printf("Bad response from %s for name query - %s\n",
+ address, nt_errstr(status));
+ return False;
+ }
+ }
+
printf("refresh the name\n");
refresh.in.name = *name;
refresh.in.wins_servers = str_list_make(mem_ctx, address, NULL);
printf("query the name to make sure its gone\n");
+ query.in.name = *name;
status = nbt_name_query(nbtsock, mem_ctx, &query);
if (NT_STATUS_IS_OK(status)) {
printf("ERROR: Name query success after release\n");
name.name = talloc_asprintf(mem_ctx, ".");
ret &= nbt_test_wins_name(mem_ctx, address, &name);
+ name.name = talloc_asprintf(mem_ctx, "%5u-\377\200\300FOO", r);
+ ret &= nbt_test_wins_name(mem_ctx, address, &name);
+
return ret;
}
BOOL node_status;
BOOL root_port;
BOOL lookup_by_ip;
+ BOOL case_sensitive;
} options;
/*
char *node_name, *p;
struct nbt_name_socket *nbtsock;
NTSTATUS status;
+
+ if (!options.case_sensitive) {
+ name = strupper_talloc(tmp_ctx, name);
+ }
if (options.find_master) {
node_type = NBT_NAME_MASTER;
{ "lookup-by-ip", 'A', POPT_ARG_VAL, &options.lookup_by_ip,
True, "Do a node status on <name> as an IP Address" },
+ { "case-sensitive", 0, POPT_ARG_VAL, &options.case_sensitive,
+ True, "Don't uppercase the name before sending" },
+
POPT_COMMON_SAMBA
{ 0, 0, 0, 0 }
};