summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1997-10-10 01:32:26 +0000
committerJeremy Allison <jra@samba.org>1997-10-10 01:32:26 +0000
commit805749baab4e79fbdb9897f22b2c801d9dd9efc2 (patch)
treeaabf74ff61c45ea907a0a4c3fb07822ba9aa8ba0
parent502a377794f157502cc1432c3d923209a6d69ff4 (diff)
downloadsamba-805749baab4e79fbdb9897f22b2c801d9dd9efc2.tar.gz
samba-805749baab4e79fbdb9897f22b2c801d9dd9efc2.tar.bz2
samba-805749baab4e79fbdb9897f22b2c801d9dd9efc2.zip
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 53915bd160eda8c099482ddcef74d1d7606e752b)
-rw-r--r--source3/include/smb.h53
-rw-r--r--source3/smbd/trans2.c22
-rw-r--r--source3/utils/nmblookup.c18
3 files changed, 72 insertions, 21 deletions
diff --git a/source3/include/smb.h b/source3/include/smb.h
index d0baa66992..54ce9e88e8 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -438,8 +438,8 @@ typedef struct id_info_1
DOM_LOGON_ID logon_id; /* logon ID */
UNIHDR hdr_user_name; /* user name unicode header */
UNIHDR hdr_workgroup_name; /* workgroup name unicode header */
- ARC4_OWF arc4_lm_owf; /* rc4 LM OWF Password */
- ARC4_OWF arc4_nt_owf; /* rc4 NT OWF Password */
+ ARC4_OWF arc4_lm_owf; /* arc4 LM OWF Password */
+ ARC4_OWF arc4_nt_owf; /* arc4 NT OWF Password */
UNISTR2 uni_domain_name; /* domain name unicode string */
UNISTR2 uni_user_name; /* user 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 SMBulogoffX 0x74 /* user logoff */
-
-/* these are the TRANS2 sub commands */
-#define TRANSACT2_OPEN 0
-#define TRANSACT2_FINDFIRST 1
-#define TRANSACT2_FINDNEXT 2
-#define TRANSACT2_QFSINFO 3
-#define TRANSACT2_SETFSINFO 4
-#define TRANSACT2_QPATHINFO 5
-#define TRANSACT2_SETPATHINFO 6
-#define TRANSACT2_QFILEINFO 7
-#define TRANSACT2_SETFILEINFO 8
-#define TRANSACT2_FSCTL 9
-#define TRANSACT2_IOCTL 10
-#define TRANSACT2_FINDNOTIFYFIRST 11
-#define TRANSACT2_FINDNOTIFYNEXT 12
-#define TRANSACT2_MKDIR 13
-
+/* 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 */
+#define TRANSACT2_OPEN 0
+#define TRANSACT2_FINDFIRST 1
+#define TRANSACT2_FINDNEXT 2
+#define TRANSACT2_QFSINFO 3
+#define TRANSACT2_SETFSINFO 4
+#define TRANSACT2_QPATHINFO 5
+#define TRANSACT2_SETPATHINFO 6
+#define TRANSACT2_QFILEINFO 7
+#define TRANSACT2_SETFILEINFO 8
+#define TRANSACT2_FSCTL 9
+#define TRANSACT2_IOCTL 0xA
+#define TRANSACT2_FINDNOTIFYFIRST 0xB
+#define TRANSACT2_FINDNOTIFYNEXT 0xC
+#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 */
#define smb_tpscnt smb_vwv0
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 092a069a6e..a56df9cb9c 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -1181,12 +1181,32 @@ static int call_trans2qfilepathinfo(char *inbuf, char *outbuf, int length,
data_size = 4;
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:
+ {
+ 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;
SIVAL(pdata,0,l);
pstrcpy(pdata+4,fname);
break;
+
case SMB_QUERY_FILE_ALLOCATION_INFO:
case SMB_QUERY_FILE_END_OF_FILEINFO:
data_size = 8;
diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c
index 36905aa5ae..63ca156449 100644
--- a/source3/utils/nmblookup.c
+++ b/source3/utils/nmblookup.c
@@ -88,6 +88,8 @@ static void usage(void)
printf("\t-B broadcast address the address to use for broadcasts\n");
printf("\t-M searches for a master browser\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");
}
@@ -108,6 +110,7 @@ int main(int argc,char *argv[])
static pstring servicesf = CONFIGFILE;
struct in_addr bcast_addr;
BOOL got_bcast = False;
+ BOOL lookup_by_ip = False;
DEBUGLEVEL = 1;
*lookup = 0;
@@ -118,7 +121,7 @@ int main(int argc,char *argv[])
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)
{
case 'B':
@@ -149,6 +152,9 @@ int main(int argc,char *argv[])
usage();
exit(0);
break;
+ case 'A':
+ lookup_by_ip = True;
+ break;
default:
usage();
exit(1);
@@ -182,6 +188,16 @@ int main(int argc,char *argv[])
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 (*lookup == '-') {
strcpy(lookup,"\01\02__MSBROWSE__\02");