mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
nmblookup.c: Added -A ability to do status on ip address.
smb.h: Added defines we will need for NT SMB calls.
trans2.c: Fixed SMB_QUERY_FILE_ALT_NAME_INFO return - this is only
for short name returns (and only used when you negotiate NT SMB calls
to boot !).
Jeremy (jallison@whistle.com)
(This used to be commit 53915bd160
)
This commit is contained in:
parent
502a377794
commit
805749baab
@ -438,8 +438,8 @@ typedef struct id_info_1
|
|||||||
DOM_LOGON_ID logon_id; /* logon ID */
|
DOM_LOGON_ID logon_id; /* logon ID */
|
||||||
UNIHDR hdr_user_name; /* user name unicode header */
|
UNIHDR hdr_user_name; /* user name unicode header */
|
||||||
UNIHDR hdr_workgroup_name; /* workgroup name unicode header */
|
UNIHDR hdr_workgroup_name; /* workgroup name unicode header */
|
||||||
ARC4_OWF arc4_lm_owf; /* rc4 LM OWF Password */
|
ARC4_OWF arc4_lm_owf; /* arc4 LM OWF Password */
|
||||||
ARC4_OWF arc4_nt_owf; /* rc4 NT OWF Password */
|
ARC4_OWF arc4_nt_owf; /* arc4 NT OWF Password */
|
||||||
UNISTR2 uni_domain_name; /* domain name unicode string */
|
UNISTR2 uni_domain_name; /* domain name unicode string */
|
||||||
UNISTR2 uni_user_name; /* user name unicode string */
|
UNISTR2 uni_user_name; /* user name unicode string */
|
||||||
UNISTR2 uni_workgroup_name; /* workgroup name unicode string */
|
UNISTR2 uni_workgroup_name; /* workgroup name unicode string */
|
||||||
@ -1305,23 +1305,38 @@ struct connect_record
|
|||||||
#define SMBfindnclose 0x35 /* Terminate a TRANSACT2_FINDNOTIFYFIRST */
|
#define SMBfindnclose 0x35 /* Terminate a TRANSACT2_FINDNOTIFYFIRST */
|
||||||
#define SMBulogoffX 0x74 /* user logoff */
|
#define SMBulogoffX 0x74 /* user logoff */
|
||||||
|
|
||||||
|
/* NT SMB extensions. */
|
||||||
|
#define SMBnttrans 0xA0 /* NT transact */
|
||||||
|
#define SMBnttranss 0xA1 /* NT transact secondary */
|
||||||
|
#define SMBntcreateX 0xA2 /* NT create and X */
|
||||||
|
#define SMBntcancel 0xA4 /* NT cancel */
|
||||||
|
|
||||||
/* these are the TRANS2 sub commands */
|
/* These are the TRANS2 sub commands */
|
||||||
#define TRANSACT2_OPEN 0
|
#define TRANSACT2_OPEN 0
|
||||||
#define TRANSACT2_FINDFIRST 1
|
#define TRANSACT2_FINDFIRST 1
|
||||||
#define TRANSACT2_FINDNEXT 2
|
#define TRANSACT2_FINDNEXT 2
|
||||||
#define TRANSACT2_QFSINFO 3
|
#define TRANSACT2_QFSINFO 3
|
||||||
#define TRANSACT2_SETFSINFO 4
|
#define TRANSACT2_SETFSINFO 4
|
||||||
#define TRANSACT2_QPATHINFO 5
|
#define TRANSACT2_QPATHINFO 5
|
||||||
#define TRANSACT2_SETPATHINFO 6
|
#define TRANSACT2_SETPATHINFO 6
|
||||||
#define TRANSACT2_QFILEINFO 7
|
#define TRANSACT2_QFILEINFO 7
|
||||||
#define TRANSACT2_SETFILEINFO 8
|
#define TRANSACT2_SETFILEINFO 8
|
||||||
#define TRANSACT2_FSCTL 9
|
#define TRANSACT2_FSCTL 9
|
||||||
#define TRANSACT2_IOCTL 10
|
#define TRANSACT2_IOCTL 0xA
|
||||||
#define TRANSACT2_FINDNOTIFYFIRST 11
|
#define TRANSACT2_FINDNOTIFYFIRST 0xB
|
||||||
#define TRANSACT2_FINDNOTIFYNEXT 12
|
#define TRANSACT2_FINDNOTIFYNEXT 0xC
|
||||||
#define TRANSACT2_MKDIR 13
|
#define TRANSACT2_MKDIR 0xD
|
||||||
|
#define TRANSACT2_SESSION_SETUP 0xE
|
||||||
|
#define TRANSACT2_GET_DFS_REFERRAL 0x10
|
||||||
|
#define TRANSACT2_REPORT_DFS_INCONSISTANCY 0x11
|
||||||
|
|
||||||
|
/* These are the NT transact sub commands. */
|
||||||
|
#define NT_TRANSACT_CREATE 1
|
||||||
|
#define NT_TRANSACT_IOCTL 2
|
||||||
|
#define NT_TRANSACT_SET_SECURITY_DESC 3
|
||||||
|
#define NT_TRANSACT_NOTIFY_CHANGE 4
|
||||||
|
#define NT_TRANSACT_RENAME 5
|
||||||
|
#define NT_TRANSACT_QUERY_SECURITY_DESC 6
|
||||||
|
|
||||||
/* these are the trans2 sub fields for primary requests */
|
/* these are the trans2 sub fields for primary requests */
|
||||||
#define smb_tpscnt smb_vwv0
|
#define smb_tpscnt smb_vwv0
|
||||||
|
@ -1181,12 +1181,32 @@ static int call_trans2qfilepathinfo(char *inbuf, char *outbuf, int length,
|
|||||||
data_size = 4;
|
data_size = 4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SMB_QUERY_FILE_NAME_INFO:
|
/* Get the 8.3 name - used if NT SMB was negotiated. */
|
||||||
case SMB_QUERY_FILE_ALT_NAME_INFO:
|
case SMB_QUERY_FILE_ALT_NAME_INFO:
|
||||||
|
{
|
||||||
|
pstring short_name;
|
||||||
|
pstrcpy(short_name,fname);
|
||||||
|
/* Mangle if not already 8.3 */
|
||||||
|
if(!is_8_3(short_name, True))
|
||||||
|
{
|
||||||
|
if(!name_map_mangle(short_name,True,SNUM(cnum)))
|
||||||
|
*short_name = '\0';
|
||||||
|
}
|
||||||
|
strncpy(pdata + 4,short_name,12);
|
||||||
|
(pdata + 4)[12] = 0;
|
||||||
|
strupper(pdata + 4);
|
||||||
|
l = strlen(pdata + 4);
|
||||||
|
data_size = 4 + l;
|
||||||
|
SIVAL(pdata,0,l);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SMB_QUERY_FILE_NAME_INFO:
|
||||||
data_size = 4 + l;
|
data_size = 4 + l;
|
||||||
SIVAL(pdata,0,l);
|
SIVAL(pdata,0,l);
|
||||||
pstrcpy(pdata+4,fname);
|
pstrcpy(pdata+4,fname);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SMB_QUERY_FILE_ALLOCATION_INFO:
|
case SMB_QUERY_FILE_ALLOCATION_INFO:
|
||||||
case SMB_QUERY_FILE_END_OF_FILEINFO:
|
case SMB_QUERY_FILE_END_OF_FILEINFO:
|
||||||
data_size = 8;
|
data_size = 8;
|
||||||
|
@ -88,6 +88,8 @@ static void usage(void)
|
|||||||
printf("\t-B broadcast address the address to use for broadcasts\n");
|
printf("\t-B broadcast address the address to use for broadcasts\n");
|
||||||
printf("\t-M searches for a master browser\n");
|
printf("\t-M searches for a master browser\n");
|
||||||
printf("\t-S lookup node status as well\n");
|
printf("\t-S lookup node status as well\n");
|
||||||
|
printf("\t-r Use root port 137 (Win95 only replies to this)\n");
|
||||||
|
printf("\t-A Do a node status on <name> as an IP Address\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,6 +110,7 @@ int main(int argc,char *argv[])
|
|||||||
static pstring servicesf = CONFIGFILE;
|
static pstring servicesf = CONFIGFILE;
|
||||||
struct in_addr bcast_addr;
|
struct in_addr bcast_addr;
|
||||||
BOOL got_bcast = False;
|
BOOL got_bcast = False;
|
||||||
|
BOOL lookup_by_ip = False;
|
||||||
|
|
||||||
DEBUGLEVEL = 1;
|
DEBUGLEVEL = 1;
|
||||||
*lookup = 0;
|
*lookup = 0;
|
||||||
@ -118,7 +121,7 @@ int main(int argc,char *argv[])
|
|||||||
|
|
||||||
charset_initialise();
|
charset_initialise();
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "d:B:i:s:SMrh")) != EOF)
|
while ((opt = getopt(argc, argv, "d:B:i:s:SMrhA")) != EOF)
|
||||||
switch (opt)
|
switch (opt)
|
||||||
{
|
{
|
||||||
case 'B':
|
case 'B':
|
||||||
@ -149,6 +152,9 @@ int main(int argc,char *argv[])
|
|||||||
usage();
|
usage();
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
|
case 'A':
|
||||||
|
lookup_by_ip = True;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -182,6 +188,16 @@ int main(int argc,char *argv[])
|
|||||||
|
|
||||||
fstrcpy(lookup,argv[i]);
|
fstrcpy(lookup,argv[i]);
|
||||||
|
|
||||||
|
if(lookup_by_ip)
|
||||||
|
{
|
||||||
|
strcpy(lookup,"*");
|
||||||
|
ip = *interpret_addr2(argv[i]);
|
||||||
|
printf("Looking up status of %s\n",inet_ntoa(ip));
|
||||||
|
name_status(ServerFD,lookup,lookup_type,True,ip,NULL,NULL,NULL);
|
||||||
|
printf("\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (find_master) {
|
if (find_master) {
|
||||||
if (*lookup == '-') {
|
if (*lookup == '-') {
|
||||||
strcpy(lookup,"\01\02__MSBROWSE__\02");
|
strcpy(lookup,"\01\02__MSBROWSE__\02");
|
||||||
|
Loading…
Reference in New Issue
Block a user