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