63c2f14601f3f8735e376e49ce7379acb37061d7
[jra/samba/.git] / source / utils / rpccheck.c
1 /* 
2    Unix SMB/CIFS implementation.
3    
4    Copyright (C) Jean François Micouleau 2001
5    
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10    
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15    
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "includes.h"
21
22 main()
23 {
24         char filter[]="0123456789ABCDEF";
25
26         char s[128];
27         char d=0;
28         int x=0;
29         prs_struct ps;
30         TALLOC_CTX *ctx;
31
32         /* change that struct */
33         SAMR_R_QUERY_USERINFO rpc_stub;
34         
35         ZERO_STRUCT(rpc_stub);
36
37         setup_logging("", True);
38         DEBUGLEVEL=10;
39
40         ctx=talloc_init("main");
41         if (!ctx) exit(1);
42
43         prs_init(&ps, 1600, 4, ctx, MARSHALL);
44
45         while (scanf("%s", s)!=-1) {
46                 if (strlen(s)==2 && strchr_m(filter, *s)!=NULL && strchr_m(filter, *(s+1))!=NULL) {
47                         d=strtol(s, NULL, 16);
48                         if(!prs_append_data(&ps, &d, 1))
49                                 printf("error while reading data\n");
50                 }
51         }
52         
53         prs_switch_type(&ps, UNMARSHALL);
54         prs_set_offset(&ps, 0);
55         
56         /* change that call */  
57         if(!samr_io_r_query_userinfo("", &rpc_stub, &ps, 0))
58                 printf("error while UNMARSHALLING the data\n");
59
60         printf("\n");
61 }