Reverse previous patch from Stefan and me after comments by Andrew Bartlett.
[samba.git] / source3 / 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 2 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, write to the Free Software
18    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 #include "includes.h"
22
23 main()
24 {
25         char filter[]="0123456789ABCDEF";
26
27         char s[128];
28         char d=0;
29         int x=0;
30         prs_struct ps;
31         TALLOC_CTX *ctx;
32
33         /* change that struct */
34         SAMR_R_QUERY_USERINFO rpc_stub;
35         
36         ZERO_STRUCT(rpc_stub);
37
38         setup_logging("", True);
39         DEBUGLEVEL=10;
40
41         ctx=talloc_init("main");
42         if (!ctx) exit(1);
43
44         prs_init(&ps, 1600, 4, ctx, MARSHALL);
45
46         while (scanf("%s", s)!=-1) {
47                 if (strlen(s)==2 && strchr_m(filter, *s)!=NULL && strchr_m(filter, *(s+1))!=NULL) {
48                         d=strtol(s, NULL, 16);
49                         if(!prs_append_data(&ps, &d, 1))
50                                 printf("error while reading data\n");
51                 }
52         }
53         
54         prs_switch_type(&ps, UNMARSHALL);
55         prs_set_offset(&ps, 0);
56         
57         /* change that call */  
58         if(!samr_io_r_query_userinfo("", &rpc_stub, &ps, 0))
59                 printf("error while UNMARSHALLING the data\n");
60
61         printf("\n");
62 }