summaryrefslogtreecommitdiff
path: root/source3/aparser
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-05-16 15:03:48 +0000
committerAndrew Tridgell <tridge@samba.org>2000-05-16 15:03:48 +0000
commit9b863398690af5ea356506a7f51da8a862b45087 (patch)
treec792ee476656bcb12aebffc85eee8f3c47839053 /source3/aparser
parent058ecd89b45bf4e52194595a320e140483c93d30 (diff)
downloadsamba-9b863398690af5ea356506a7f51da8a862b45087.tar.gz
samba-9b863398690af5ea356506a7f51da8a862b45087.tar.bz2
samba-9b863398690af5ea356506a7f51da8a862b45087.zip
the vluke program now takes a structure name on the command line
(This used to be commit 6a3e7ba4f0716eb414daba4ab8aae974db4deba0)
Diffstat (limited to 'source3/aparser')
-rw-r--r--source3/aparser/harness.awk9
-rw-r--r--source3/aparser/parsetree.awk3
-rw-r--r--source3/aparser/srvsvc.struct68
-rw-r--r--source3/aparser/templates/harness.tpl5
-rw-r--r--source3/aparser/templates/harness_end.tpl3
-rw-r--r--source3/aparser/vluke.c7
6 files changed, 79 insertions, 16 deletions
diff --git a/source3/aparser/harness.awk b/source3/aparser/harness.awk
index f63863d638..6c4c35c40f 100644
--- a/source3/aparser/harness.awk
+++ b/source3/aparser/harness.awk
@@ -7,16 +7,11 @@ function produce_harness(f,
print_template(f, "harness_start.tpl", v);
- for (i=0;i<num_tests;i++) {
- v["TEST"] = tests[i];
+ for (i=0;i<num_structs;i++) {
+ v["TEST"] = structs[i, "name"];
print_template(f, "harness.tpl", v);
}
print_template(f, "harness_end.tpl", v);
}
-function add_test(test)
-{
- tests[num_tests] = test;
- num_tests++;
-}
diff --git a/source3/aparser/parsetree.awk b/source3/aparser/parsetree.awk
index cd4e442c9b..e99793f516 100644
--- a/source3/aparser/parsetree.awk
+++ b/source3/aparser/parsetree.awk
@@ -20,6 +20,9 @@ function start_struct(name)
function end_struct()
{
+ printf("struct %s with %d elements\n",
+ structs[num_structs, "name"],
+ structs[num_structs, "num_elems"]);
num_structs++;
current_struct="";
}
diff --git a/source3/aparser/srvsvc.struct b/source3/aparser/srvsvc.struct
index f8dd94a2e6..3ba36836ad 100644
--- a/source3/aparser/srvsvc.struct
+++ b/source3/aparser/srvsvc.struct
@@ -1,7 +1,4 @@
module srvsvc
-test SRV_R_NET_SHARE_ENUM
-test SRV_R_NET_SERVER_INFO
-test SRV_Q_NET_SERVER_INFO
#define SRV_NETCONNENUM 0x08
#define SRV_NETFILEENUM 0x09
@@ -42,21 +39,78 @@ struct CONN_INFO_1 {
LPWSTR net_name;
};
-struct SRV_R_NET_CONN_ENUM {
+struct CONN_ENUM_CTR {
uint32 level;
- uint32 level2;
uint32 num_entries;
union *info[level] {
case 0 CONN_INFO_0 info0[num_entries];
case 1 CONN_INFO_1 info1[num_entries];
}
+};
+
+struct SRV_R_NET_CONN_ENUM {
.trailer;
- uint32 count;
+ uint32 level;
+ CONN_ENUM_CTR ctr;
ENUM_HND handle;
- uint32 status1;
+ uint32 num_entries;
+ uint32 status;
uint32 status2;
};
+struct SRV_Q_NET_CONN_ENUM {
+ .trailer;
+ LPWSTR dest_srv;
+ LPWSTR qual_srv;
+ uint32 level;
+ uint32 level2;
+ CONN_ENUM_CTR *ctr;
+ uint32 max_len;
+ ENUM_HND handle;
+};
+
+/* function 9 */
+struct FILE_INFO_3 {
+ uint32 id; /* file index */
+ uint32 perms; /* file permissions. don't know what format */
+ uint32 num_locks; /* file locks */
+ LPWSTR path_name; /* file name */
+ LPWSTR user_name; /* file owner */
+};
+
+struct SRV_FILE_INFO_CTR {
+ uint32 level;
+ uint32 num_entries;
+ uint32 dummy;
+ union *file[level] {
+ case 3 FILE_INFO_3 info3[num_entries];
+ }
+};
+
+struct SRV_Q_NET_FILE_ENUM {
+ .trailer;
+ LPWSTR srv_name;
+ LPWSTR qual_name;
+ uint32 dummy;
+ uint32 level;
+ SRV_FILE_INFO_CTR ctr;
+ uint32 *status;
+ uint32 preferred_len;
+ ENUM_HND enum_hnd;
+};
+
+
+struct SRV_R_NET_FILE_ENUM {
+ .trailer;
+ uint32 level;
+ uint32 dummy;
+ SRV_FILE_INFO_CTR *ctr;
+ uint32 total_entries; /* total number of files */
+ ENUM_HND enum_hnd;
+ uint32 status; /* return status */
+};
+
+
/* function 15 */
struct SRV_SHARE_INFO_1 {
LPWSTR uni_netname;
diff --git a/source3/aparser/templates/harness.tpl b/source3/aparser/templates/harness.tpl
new file mode 100644
index 0000000000..bd2355d2a2
--- /dev/null
+++ b/source3/aparser/templates/harness.tpl
@@ -0,0 +1,5 @@
+
+ if (strcmp(test,"@TEST@")==0) {
+ @TEST@ il;
+ ret = io_@TEST@("@TEST@", ps, 0, &il, PARSE_SCALARS|PARSE_BUFFERS);
+ }
diff --git a/source3/aparser/templates/harness_end.tpl b/source3/aparser/templates/harness_end.tpl
new file mode 100644
index 0000000000..191351bee2
--- /dev/null
+++ b/source3/aparser/templates/harness_end.tpl
@@ -0,0 +1,3 @@
+
+ return ret;
+}
diff --git a/source3/aparser/vluke.c b/source3/aparser/vluke.c
index 5a64e06eb0..7adc396f6d 100644
--- a/source3/aparser/vluke.c
+++ b/source3/aparser/vluke.c
@@ -30,11 +30,14 @@ int main(int argc, char *argv[])
prs_init(&ps, 0, 4, MARSHALL);
ps.is_dynamic=True;
prs_read(&ps, fd, st.st_size, 0);
- ps.data_offset = 0;
+ ps.data_offset = 0;
+ ps.buffer_size = ps.grow_size;
ps.io = UNMARSHALL;
ret = run_test(test, &ps);
printf("\nret=%s\n", ret?"OK":"Bad");
printf("Trailer is %d bytes\n\n", ps.grow_size - ps.data_offset);
- dump_data(0, ps.data_p, ps.grow_size);
+ if (ps.grow_size - ps.data_offset > 0) {
+ dump_data(0, ps.data_p + ps.data_offset, ps.grow_size - ps.data_offset);
+ }
return !ret;
}