mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
Clean up
This commit is contained in:
parent
b97d1b74e2
commit
801e6f1136
@ -117,19 +117,19 @@ ipmi_password_file_read(char * filename)
|
|||||||
fp = ipmi_open_file_read((const char *)filename);
|
fp = ipmi_open_file_read((const char *)filename);
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
lprintf(LOG_ERR, "Unable to open password file %s",
|
lprintf(LOG_ERR, "Unable to open password file %s",
|
||||||
filename);
|
filename);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read in id */
|
/* read in id */
|
||||||
if (fgets(pass, 16, fp) == NULL) {
|
if (fgets(pass, 16, fp) == NULL) {
|
||||||
lprintf(LOG_ERR, "Unable to read password from file %s",
|
lprintf(LOG_ERR, "Unable to read password from file %s",
|
||||||
filename);
|
filename);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remove trailing whitespace */
|
/* remove trailing whitespace */
|
||||||
l = strcspn(pass, " \r\n\t");
|
l = strcspn(pass, " \r\n\t");
|
||||||
if (l > 0) {
|
if (l > 0) {
|
||||||
pass[l] = '\0';
|
pass[l] = '\0';
|
||||||
@ -334,7 +334,7 @@ ipmi_parse_hex(const char *str)
|
|||||||
shift = 4;
|
shift = 4;
|
||||||
q++;
|
q++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
@ -351,8 +351,8 @@ ipmi_parse_hex(const char *str)
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
ipmi_main(int argc, char ** argv,
|
ipmi_main(int argc, char ** argv,
|
||||||
struct ipmi_cmd * cmdlist,
|
struct ipmi_cmd * cmdlist,
|
||||||
struct ipmi_intf_support * intflist)
|
struct ipmi_intf_support * intflist)
|
||||||
{
|
{
|
||||||
struct ipmi_intf_support * sup;
|
struct ipmi_intf_support * sup;
|
||||||
int privlvl = 0;
|
int privlvl = 0;
|
||||||
@ -402,8 +402,8 @@ ipmi_main(int argc, char ** argv,
|
|||||||
found = 0;
|
found = 0;
|
||||||
for (sup=intflist; sup->name != NULL; sup++) {
|
for (sup=intflist; sup->name != NULL; sup++) {
|
||||||
if (strncmp(sup->name, intfname, strlen(intfname)) == 0 &&
|
if (strncmp(sup->name, intfname, strlen(intfname)) == 0 &&
|
||||||
strncmp(sup->name, intfname, strlen(sup->name)) == 0 &&
|
strncmp(sup->name, intfname, strlen(sup->name)) == 0 &&
|
||||||
sup->supported == 1)
|
sup->supported == 1)
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
@ -450,7 +450,7 @@ ipmi_main(int argc, char ** argv,
|
|||||||
password = ipmi_password_file_read(optarg);
|
password = ipmi_password_file_read(optarg);
|
||||||
if (password == NULL)
|
if (password == NULL)
|
||||||
lprintf(LOG_ERR, "Unable to read password "
|
lprintf(LOG_ERR, "Unable to read password "
|
||||||
"from file %s", optarg);
|
"from file %s", optarg);
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
#ifdef HAVE_GETPASSPHRASE
|
#ifdef HAVE_GETPASSPHRASE
|
||||||
@ -534,7 +534,7 @@ ipmi_main(int argc, char ** argv,
|
|||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
if (strncmp(oemtype, "list", 4) == 0 ||
|
if (strncmp(oemtype, "list", 4) == 0 ||
|
||||||
strncmp(oemtype, "help", 4) == 0) {
|
strncmp(oemtype, "help", 4) == 0) {
|
||||||
ipmi_oem_print();
|
ipmi_oem_print();
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
@ -639,7 +639,7 @@ ipmi_main(int argc, char ** argv,
|
|||||||
|
|
||||||
/* check for command before doing anything */
|
/* check for command before doing anything */
|
||||||
if (argc-optind > 0 &&
|
if (argc-optind > 0 &&
|
||||||
strncmp(argv[optind], "help", 4) == 0) {
|
strncmp(argv[optind], "help", 4) == 0) {
|
||||||
ipmi_cmd_print(cmdlist);
|
ipmi_cmd_print(cmdlist);
|
||||||
rc = 0;
|
rc = 0;
|
||||||
goto out_free;
|
goto out_free;
|
||||||
@ -654,7 +654,7 @@ ipmi_main(int argc, char ** argv,
|
|||||||
* then prompt the user.
|
* then prompt the user.
|
||||||
*/
|
*/
|
||||||
if (hostname != NULL && password == NULL &&
|
if (hostname != NULL && password == NULL &&
|
||||||
(authtype != IPMI_SESSION_AUTHTYPE_NONE || authtype < 0)) {
|
(authtype != IPMI_SESSION_AUTHTYPE_NONE || authtype < 0)) {
|
||||||
#ifdef HAVE_GETPASSPHRASE
|
#ifdef HAVE_GETPASSPHRASE
|
||||||
tmp = getpassphrase("Password: ");
|
tmp = getpassphrase("Password: ");
|
||||||
#else
|
#else
|
||||||
@ -850,7 +850,6 @@ ipmi_main(int argc, char ** argv,
|
|||||||
ipmi_kontronoem_set_large_buffer( ipmi_main_intf, 0 );
|
ipmi_kontronoem_set_large_buffer( ipmi_main_intf, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* clean repository caches */
|
/* clean repository caches */
|
||||||
ipmi_cleanup(ipmi_main_intf);
|
ipmi_cleanup(ipmi_main_intf);
|
||||||
|
|
||||||
@ -858,7 +857,7 @@ ipmi_main(int argc, char ** argv,
|
|||||||
if (ipmi_main_intf->opened > 0 && ipmi_main_intf->close != NULL)
|
if (ipmi_main_intf->opened > 0 && ipmi_main_intf->close != NULL)
|
||||||
ipmi_main_intf->close(ipmi_main_intf);
|
ipmi_main_intf->close(ipmi_main_intf);
|
||||||
|
|
||||||
out_free:
|
out_free:
|
||||||
log_halt();
|
log_halt();
|
||||||
|
|
||||||
if (intfname != NULL)
|
if (intfname != NULL)
|
||||||
|
@ -403,9 +403,12 @@ ipmi_mc_get_deviceid(struct ipmi_intf * intf)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Structure follow the IPMI V.2 Rev 1.0
|
||||||
|
* See Table 20-10 */
|
||||||
#ifdef HAVE_PRAGMA_PACK
|
#ifdef HAVE_PRAGMA_PACK
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct ipmi_guid {
|
struct ipmi_guid {
|
||||||
uint32_t time_low; /* timestamp low field */
|
uint32_t time_low; /* timestamp low field */
|
||||||
uint16_t time_mid; /* timestamp middle field */
|
uint16_t time_mid; /* timestamp middle field */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user