/* Safely copy the input string, In, into buf[]. */
(void)memset( buf, 0, 20 );
- if( '*' == In[0] )
+ if (strcmp(In,"*") == 0)
buf[0] = '*';
else
(void)slprintf( buf, sizeof(buf) - 1, "%-15.15s%c", In, name_type );
send a session request. see rfc1002.txt 4.3 and 4.3.2
****************************************************************************/
BOOL cli_session_request(struct cli_state *cli,
- struct nmb_name *calling, struct nmb_name *called)
+ struct nmb_name *calling, struct nmb_name *called)
{
char *p;
int len = 4;
fstring buf1;
char *p;
- if (name->name[0] == '*') {
+ if (strcmp(name->name,"*") == 0) {
/* special case for wildcard name */
bzero(buf1,20);
buf1[0] = '*';
return NULL;
}
+ make_nmb_name(&calling, global_myname, 0x0, "");
+ make_nmb_name(&called , server, 0x20, "");
+
+ again:
/* have to open a new connection */
if (!cli_initialise(&c) || !cli_connect(&c, server, NULL)) {
errno = ENOENT;
return NULL;
}
- make_nmb_name(&calling, global_myname, 0x0, "");
- make_nmb_name(&called , server, 0x20, "");
-
if (!cli_session_request(&c, &calling, &called)) {
cli_shutdown(&c);
+ if (strcmp(called.name, "*SMBSERVER")) {
+ make_nmb_name(&called , "*SMBSERVER", 0x20, "");
+ goto again;
+ }
errno = ENOENT;
return NULL;
}
+
if (!cli_negprot(&c)) {
cli_shutdown(&c);
errno = ENOENT;