r9661: fallback to cn attribubte if displayName is not available
[Samba.git] / source / rpcclient / cmd_wkssvc.c
blob137ff3bdae93d09545bd23a43f1fff004c1e84a0
1 /*
2 Unix SMB/CIFS implementation.
3 NT Domain Authentication SMB / MSRPC client
4 Copyright (C) Andrew Tridgell 1994-1997
5 Copyright (C) Luke Kenneth Casson Leighton 1996-1997
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.
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.
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.
22 #include "includes.h"
24 #define DEBUG_TESTING
26 extern struct cli_state *smb_cli;
28 extern FILE* out_hnd;
31 /****************************************************************************
32 workstation get info query
33 ****************************************************************************/
34 void cmd_wks_query_info(struct client_info *info)
36 fstring dest_wks;
37 fstring tmp;
38 WKS_INFO_100 ctr;
39 uint32 info_level = 100;
41 BOOL res = True;
43 memset((char *)&ctr, '\0', sizeof(ctr));
45 fstrcpy(dest_wks, "\\\\");
46 fstrcat(dest_wks, info->dest_host);
47 strupper_m(dest_wks);
49 if (next_token_nr(NULL, tmp, NULL, sizeof(tmp)))
51 info_level = (uint32)strtol(tmp, (char**)NULL, 10);
54 DEBUG(4,("cmd_wks_query_info: server:%s info level: %d\n",
55 dest_wks, info_level));
57 DEBUG(5, ("cmd_wks_query_info: smb_cli->fd:%d\n", smb_cli->fd));
59 /* open LSARPC session. */
60 res = res ? cli_nt_session_open(smb_cli, PI_WKSSVC) : False;
62 /* send info level: receive requested info. hopefully. */
63 res = res ? do_wks_query_info(smb_cli,
64 dest_wks, info_level, &ctr) : False;
66 /* close the session */
67 cli_nt_session_close(smb_cli);
69 if (res)
71 DEBUG(5,("cmd_wks_query_info: query succeeded\n"));
73 #if 0
74 display_wks_info_100(out_hnd, ACTION_HEADER , &ctr);
75 display_wks_info_100(out_hnd, ACTION_ENUMERATE, &ctr);
76 display_wks_info_100(out_hnd, ACTION_FOOTER , &ctr);
77 #endif
80 else
82 DEBUG(5,("cmd_wks_query_info: query failed\n"));