1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
/*
* Stonith module for ipmi lan Stonith device
*
* Copyright (c) 2003 Intel Corp.
* Yixiong Zou <yixiong.zou@intel.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/*
* A quick test program to verify that IPMI host is setup correctly.
*
* You will need to modify the values in user, pass, ip, and port.
*/
#include <stdio.h>
#include <string.h>
#include "ipmilan.h"
#include <OpenIPMI/ipmi_auth.h>
int main(int argc, char * argv[])
{
struct ipmilanHostInfo host;
int request = 2;
int rv;
char user[] = "joe";
char pass[] = "blow";
char ip[] = "192.168.1.7";
host.hostname = NULL;
host.portnumber = 999;
host.authtype = IPMI_AUTHTYPE_NONE;
host.privilege = IPMI_PRIVILEGE_ADMIN;
host.ipaddr = ip;
memcpy(host.username, user, sizeof(user));
memcpy(host.password, pass, sizeof(pass));
/*
memset(host.username, 0, sizeof(host.username));
memset(host.password, 0, sizeof(host.password));
*/
rv = do_ipmi_cmd(&host, request);
if (rv)
printf("rv = %d, operation failed. \n", rv);
else
printf("operation succeeded. \n");
return rv;
}
|