Rebase to version 1.8.16

We're also dropping argenv patch. Upstream changed its mind about that
approach and so should we.

Resolves: rhbz#1310276
This commit is contained in:
Boris Ranto 2016-02-23 03:54:08 +01:00
parent 2c475f7497
commit 10c4114768
8 changed files with 7 additions and 1105 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ ipmitool-1.8.11.tar.bz2
/ipmitool-1.8.12-130731.tar.bz2
/ipmitool-1.8.13.tar.bz2
/ipmitool-1.8.15.tar.bz2
/ipmitool-1.8.16.tar.bz2

View File

@ -1,174 +0,0 @@
diff -up ./src/plugins/lan/lan.c.fips ./src/plugins/lan/lan.c
--- ./src/plugins/lan/lan.c.fips 2013-08-09 13:49:30.014768330 +0200
+++ ./src/plugins/lan/lan.c 2013-08-09 13:55:02.425532024 +0200
@@ -67,6 +67,10 @@
#define IPMI_LAN_PORT 0x26f
#define IPMI_LAN_CHANNEL_E 0x0e
+#if defined(HAVE_CRYPTO_MD2) || defined(HAVE_CRYPTO_MD5)
+#include <openssl/fips.h>
+#endif
+
extern const struct valstr ipmi_privlvl_vals[];
extern const struct valstr ipmi_authtype_session_vals[];
extern int verbose;
@@ -861,10 +865,22 @@ ipmi_lan_build_cmd(struct ipmi_intf * in
*/
switch (s->authtype) {
case IPMI_SESSION_AUTHTYPE_MD5:
+ if (FIPS_mode()) {
+ if (verbose > 1) {
+ printf("MD5 not supported in FIPS mode. Try -I lanplus\n");
+ }
+ return NULL;
+ }
temp = ipmi_auth_md5(s, msg+mp, msg[mp-1]);
memcpy(msg+ap, temp, 16);
break;
case IPMI_SESSION_AUTHTYPE_MD2:
+ if (FIPS_mode()) {
+ if (verbose > 1) {
+ printf("MD2 not supported in FIPS mode. Try -I lanplus\n");
+ }
+ return NULL;
+ }
temp = ipmi_auth_md2(s, msg+mp, msg[mp-1]);
memcpy(msg+ap, temp, 16);
break;
diff -up ./src/plugins/lanplus/lanplus.c.fips ./src/plugins/lanplus/lanplus.c
--- ./src/plugins/lanplus/lanplus.c.fips 2013-07-16 06:17:39.000000000 +0200
+++ ./src/plugins/lanplus/lanplus.c 2013-08-09 13:54:27.720451992 +0200
@@ -65,6 +65,10 @@
#include "rmcp.h"
#include "asf.h"
+#if defined(HAVE_CRYPTO_MD2) || defined(HAVE_CRYPTO_MD5)
+#include <openssl/fips.h>
+#endif
+
extern const struct valstr ipmi_rakp_return_codes[];
extern const struct valstr ipmi_priv_levels[];
extern const struct valstr ipmi_auth_algorithms[];
@@ -183,56 +187,122 @@ int lanplus_get_requested_ciphers(int
*auth_alg = IPMI_AUTH_RAKP_HMAC_SHA1;
*integrity_alg = IPMI_INTEGRITY_HMAC_SHA1_96;
*crypt_alg = IPMI_CRYPT_XRC4_128;
+ if (FIPS_mode()) {
+ if (verbose > 1) {
+ printf("RC4 not supported in FIPS mode. Try -C 3\n");
+ }
+ return 1;
+ }
break;
case 5:
*auth_alg = IPMI_AUTH_RAKP_HMAC_SHA1;
*integrity_alg = IPMI_INTEGRITY_HMAC_SHA1_96;
*crypt_alg = IPMI_CRYPT_XRC4_40;
+ if (FIPS_mode()) {
+ if (verbose > 1) {
+ printf("RC4 not supported in FIPS mode. Try -C 3\n");
+ }
+ return 1;
+ }
break;
case 6:
*auth_alg = IPMI_AUTH_RAKP_HMAC_MD5;
*integrity_alg = IPMI_INTEGRITY_NONE;
*crypt_alg = IPMI_CRYPT_NONE;
+ if (FIPS_mode()) {
+ if (verbose > 1) {
+ printf("MD5 not supported in FIPS mode. Try -C 1\n");
+ }
+ return 1;
+ }
break;
case 7:
*auth_alg = IPMI_AUTH_RAKP_HMAC_MD5;
*integrity_alg = IPMI_INTEGRITY_HMAC_MD5_128;
*crypt_alg = IPMI_CRYPT_NONE;
+ if (FIPS_mode()) {
+ if (verbose > 1) {
+ printf("MD5 not supported in FIPS mode. Try -C 2\n");
+ }
+ return 1;
+ }
break;
case 8:
*auth_alg = IPMI_AUTH_RAKP_HMAC_MD5;
*integrity_alg = IPMI_INTEGRITY_HMAC_MD5_128;
*crypt_alg = IPMI_CRYPT_AES_CBC_128;
+ if (FIPS_mode()) {
+ if (verbose > 1) {
+ printf("MD5 not supported in FIPS mode. Try -C 3\n");
+ }
+ return 1;
+ }
break;
case 9:
*auth_alg = IPMI_AUTH_RAKP_HMAC_MD5;
*integrity_alg = IPMI_INTEGRITY_HMAC_MD5_128;
*crypt_alg = IPMI_CRYPT_XRC4_128;
+ if (FIPS_mode()) {
+ if (verbose > 1) {
+ printf("MD5 not supported in FIPS mode. Try -C 3\n");
+ }
+ return 1;
+ }
break;
case 10:
*auth_alg = IPMI_AUTH_RAKP_HMAC_MD5;
*integrity_alg = IPMI_INTEGRITY_HMAC_MD5_128;
*crypt_alg = IPMI_CRYPT_XRC4_40;
+ if (FIPS_mode()) {
+ if (verbose > 1) {
+ printf("MD5 not supported in FIPS mode. Try -C 3\n");
+ }
+ return 1;
+ }
break;
case 11:
*auth_alg = IPMI_AUTH_RAKP_HMAC_MD5;
*integrity_alg = IPMI_INTEGRITY_MD5_128;
*crypt_alg = IPMI_CRYPT_NONE;
+ if (FIPS_mode()) {
+ if (verbose > 1) {
+ printf("MD5 not supported in FIPS mode. Try -C 3\n");
+ }
+ return 1;
+ }
break;
case 12:
*auth_alg = IPMI_AUTH_RAKP_HMAC_MD5;
*integrity_alg = IPMI_INTEGRITY_MD5_128;
*crypt_alg = IPMI_CRYPT_AES_CBC_128;
+ if (FIPS_mode()) {
+ if (verbose > 1) {
+ printf("MD5 not supported in FIPS mode. Try -C 3\n");
+ }
+ return 1;
+ }
break;
case 13:
*auth_alg = IPMI_AUTH_RAKP_HMAC_MD5;
*integrity_alg = IPMI_INTEGRITY_MD5_128;
*crypt_alg = IPMI_CRYPT_XRC4_128;
+ if (FIPS_mode()) {
+ if (verbose > 1) {
+ printf("MD5 not supported in FIPS mode. Try -C 3\n");
+ }
+ return 1;
+ }
break;
case 14:
*auth_alg = IPMI_AUTH_RAKP_HMAC_MD5;
*integrity_alg = IPMI_INTEGRITY_MD5_128;
*crypt_alg = IPMI_CRYPT_XRC4_40;
+ if (FIPS_mode()) {
+ if (verbose > 1) {
+ printf("MD5 not supported in FIPS mode. Try -C 3\n");
+ }
+ return 1;
+ }
break;
}

View File

@ -1,19 +0,0 @@
diff -up ./doc/ipmitool.1.fipsman ./doc/ipmitool.1
--- ./doc/ipmitool.1.fipsman 2013-08-09 13:13:27.005088284 +0200
+++ ./doc/ipmitool.1 2013-08-09 13:23:07.975337252 +0200
@@ -98,6 +98,7 @@ The remote server authentication, integr
to use for IPMIv2.0 \fIlanplus\fP connections. See table 22\-19 in the
IPMIv2.0 specification. The default is 3 which specifies RAKP\-HMAC\-SHA1
authentication, HMAC\-SHA1\-96 integrity, and AES\-CBC\-128 encryption algorithms.
+In FIPS mode the 0-3 are available.
.TP
\fB\-d \fIN\fP\fR
Use device number N to specify the /dev/ipmiN (or
@@ -132,6 +133,7 @@ option is required for \fIlan\fP and \fI
\fB\-I\fR <\fIinterface\fP>
Selects IPMI interface to use. Supported interfaces that are
compiled in are visible in the usage help output.
+In FIPS mode the lan interface is not available due to implemented authentication.
.TP
\fB\-k\fR <\fIkey\fP>
Use supplied Kg key for IPMIv2.0 authentication. The default is not to

View File

@ -1,86 +0,0 @@
diff -up ./lib/ipmi_main.c.passarg ./lib/ipmi_main.c
--- ./lib/ipmi_main.c.passarg 2012-12-13 16:47:34.585182645 +0100
+++ ./lib/ipmi_main.c 2012-12-13 16:57:12.023739444 +0100
@@ -403,6 +403,7 @@ ipmi_main(int argc, char ** argv,
int argflag, i, found;
int rc = -1;
char sol_escape_char = SOL_ESCAPE_CHARACTER_DEFAULT;
+ int querrypass = 0;
/* save program name */
progname = strrchr(argv[0], '/');
@@ -501,6 +502,7 @@ ipmi_main(int argc, char ** argv,
}
break;
case 'f':
+ querrypass = 0;
if (password)
free(password);
password = ipmi_password_file_read(optarg);
@@ -509,22 +511,7 @@ ipmi_main(int argc, char ** argv,
"from file %s", optarg);
break;
case 'a':
- if (tmp)
- free(tmp);
-#ifdef HAVE_GETPASSPHRASE
- tmp = getpassphrase("Password: ");
-#else
- tmp = getpass("Password: ");
-#endif
- if (tmp != NULL) {
- if (password)
- free(password);
- password = strdup(tmp);
- if (password == NULL) {
- lprintf(LOG_ERR, "%s: malloc failure", progname);
- goto out_free;
- }
- }
+ querrypass = 1;
break;
case 'k':
if (kgkey)
@@ -623,6 +610,7 @@ ipmi_main(int argc, char ** argv,
oemtype = strdup("supermicro");
break;
case 'P':
+ querrypass = 0;
if (password)
free(password);
password = strdup(optarg);
@@ -636,6 +624,7 @@ ipmi_main(int argc, char ** argv,
memset(optarg, 'X', i);
break;
case 'E':
+ querrypass = 0;
if ((tmpe = getenv("IPMITOOL_PASSWORD"))) {
if (password)
free(password);
@@ -755,6 +744,26 @@ ipmi_main(int argc, char ** argv,
}
}
+ /* ask for password once and only if going to use it */
+ if (querrypass) {
+ if (tmp)
+ free(tmp);
+#ifdef HAVE_GETPASSPHRASE
+ tmp = getpassphrase("Password: ");
+#else
+ tmp = getpass("Password: ");
+#endif
+ if (tmp != NULL) {
+ if (password)
+ free(password);
+ password = strdup(tmp);
+ if (password == NULL) {
+ lprintf(LOG_ERR, "%s: malloc failure", progname);
+ goto out_free;
+ }
+ }
+ }
+
/* check for command before doing anything */
if (argc-optind > 0 &&
strncmp(argv[optind], "help", 4) == 0) {

View File

@ -1,13 +0,0 @@
diff -up ipmitool-1.8.13/doc/ipmitool.1.dualbridge ipmitool-1.8.13/doc/ipmitool.1
--- ipmitool-1.8.13/doc/ipmitool.1.dualbridge 2013-11-05 10:10:20.139940133 +0100
+++ ipmitool-1.8.13/doc/ipmitool.1 2013-11-05 10:10:35.197947425 +0100
@@ -156,9 +156,6 @@ Set the local IPMB address. The local a
or is auto discovered on PICMG platforms when -m is not specified.
There should be no need to change the local address for normal operation.
.TP
-\fB\-M\fR <\fIaddress\fP>
-Set transit local address for bridge request. (dual bridge)
-.TP
\fB\-N\fR <\fIsec\fP>
Specify nr. of seconds between retransmissions of lan/lanplus messages.
Defaults are 2 seconds for lan and 1 second for lanplus interfaces.

View File

@ -1,795 +0,0 @@
diff --git a/lib/ipmi_main.c b/lib/ipmi_main.c
index 1885bb5..0e420f6 100644
--- a/lib/ipmi_main.c
+++ b/lib/ipmi_main.c
@@ -388,401 +388,444 @@ ipmi_main(int argc, char ** argv,
char sol_escape_char = SOL_ESCAPE_CHARACTER_DEFAULT;
char * devfile = NULL;
+ int cnt = argc;
+ char **arg = argv;
+ int voptind;
+ int argecnt = 0;
+ char **arge = NULL;
+ char **narge = NULL;
+ char *argestr = NULL;
+
/* save program name */
progname = strrchr(argv[0], '/');
progname = ((progname == NULL) ? argv[0] : progname+1);
signal(SIGINT, ipmi_catch_sigint);
- while ((argflag = getopt(argc, (char **)argv, OPTION_STRING)) != -1)
+ do
{
- switch (argflag) {
- case 'I':
- if (intfname) {
- free(intfname);
- intfname = NULL;
- }
- intfname = strdup(optarg);
- if (intfname == NULL) {
- lprintf(LOG_ERR, "%s: malloc failure", progname);
- goto out_free;
- }
- if (intflist != NULL) {
- found = 0;
- for (sup=intflist; sup->name != NULL; sup++) {
- if (strncmp(sup->name, intfname, strlen(intfname)) == 0 &&
- strncmp(sup->name, intfname, strlen(sup->name)) == 0 &&
- sup->supported == 1)
- found = 1;
+ if (arge != NULL) {
+ voptind = optind;
+ cnt = argecnt;
+ arg = arge;
+ }
+ while ((argflag = getopt(cnt, (char **)arg, OPTION_STRING)) != -1)
+ {
+ switch (argflag) {
+ case 'I':
+ if (intfname) {
+ free(intfname);
+ intfname = NULL;
}
- if (!found) {
- lprintf(LOG_ERR, "Interface %s not supported", intfname);
+ intfname = strdup(optarg);
+ if (intfname == NULL) {
+ lprintf(LOG_ERR, "%s: malloc failure", progname);
goto out_free;
}
- }
- break;
- case 'h':
- ipmi_option_usage(progname, cmdlist, intflist);
- rc = 0;
- goto out_free;
- break;
- case 'V':
- printf("%s version %s\n", progname, VERSION);
- rc = 0;
- goto out_free;
- break;
- case 'd':
- if (str2int(optarg, &devnum) != 0) {
- lprintf(LOG_ERR, "Invalid parameter given or out of range for '-d'.");
- rc = -1;
- goto out_free;
- }
- /* Check if device number is -gt 0; I couldn't find limit for
- * kernels > 2.6, thus right side is unlimited.
- */
- if (devnum < 0) {
- lprintf(LOG_ERR, "Device number %i is out of range.", devnum);
- rc = -1;
- goto out_free;
- }
- break;
- case 'p':
- if (str2int(optarg, &port) != 0) {
- lprintf(LOG_ERR, "Invalid parameter given or out of range for '-p'.");
- rc = -1;
- goto out_free;
- }
- /* Check if port is -gt 0 && port is -lt 65535 */
- if (port < 0 || port > 65535) {
- lprintf(LOG_ERR, "Port number %i is out of range.", port);
- rc = -1;
- goto out_free;
- }
- break;
- case 'C':
- if (str2int(optarg, &cipher_suite_id) != 0) {
- lprintf(LOG_ERR, "Invalid parameter given or out of range for '-C'.");
- rc = -1;
- goto out_free;
- }
- /* add check Cipher is -gt 0 */
- if (cipher_suite_id < 0) {
- lprintf(LOG_ERR, "Cipher suite ID %i is invalid.", cipher_suite_id);
- rc = -1;
+ if (intflist != NULL) {
+ found = 0;
+ for (sup=intflist; sup->name != NULL; sup++) {
+ if (strncmp(sup->name, intfname, strlen(intfname)) == 0 &&
+ strncmp(sup->name, intfname, strlen(sup->name)) == 0 &&
+ sup->supported == 1)
+ found = 1;
+ }
+ if (!found) {
+ lprintf(LOG_ERR, "Interface %s not supported", intfname);
+ goto out_free;
+ }
+ }
+ break;
+ case 'h':
+ ipmi_option_usage(progname, cmdlist, intflist);
+ rc = 0;
goto out_free;
- }
- break;
- case 'v':
- verbose++;
- break;
- case 'c':
- csv_output = 1;
- break;
- case 'H':
- if (hostname) {
- free(hostname);
- hostname = NULL;
- }
- hostname = strdup(optarg);
- if (hostname == NULL) {
- lprintf(LOG_ERR, "%s: malloc failure", progname);
+ break;
+ case 'V':
+ printf("%s version %s\n", progname, VERSION);
+ rc = 0;
goto out_free;
- }
- break;
- case 'f':
- if (password) {
- free(password);
- password = NULL;
- }
- password = ipmi_password_file_read(optarg);
- if (password == NULL)
- lprintf(LOG_ERR, "Unable to read password "
- "from file %s", optarg);
- break;
- case 'a':
-#ifdef HAVE_GETPASSPHRASE
- tmp_pass = getpassphrase("Password: ");
-#else
- tmp_pass = getpass("Password: ");
-#endif
- if (tmp_pass != NULL) {
+ break;
+ case 'd':
+ if (str2int(optarg, &devnum) != 0) {
+ lprintf(LOG_ERR, "Invalid parameter given or out of range for '-d'.");
+ rc = -1;
+ goto out_free;
+ }
+ /* Check if device number is -gt 0; I couldn't find limit for
+ * kernels > 2.6, thus right side is unlimited.
+ */
+ if (devnum < 0) {
+ lprintf(LOG_ERR, "Device number %i is out of range.", devnum);
+ rc = -1;
+ goto out_free;
+ }
+ break;
+ case 'p':
+ if (str2int(optarg, &port) != 0) {
+ lprintf(LOG_ERR, "Invalid parameter given or out of range for '-p'.");
+ rc = -1;
+ goto out_free;
+ }
+ /* Check if port is -gt 0 && port is -lt 65535 */
+ if (port < 0 || port > 65535) {
+ lprintf(LOG_ERR, "Port number %i is out of range.", port);
+ rc = -1;
+ goto out_free;
+ }
+ break;
+ case 'C':
+ if (str2int(optarg, &cipher_suite_id) != 0) {
+ lprintf(LOG_ERR, "Invalid parameter given or out of range for '-C'.");
+ rc = -1;
+ goto out_free;
+ }
+ /* add check Cipher is -gt 0 */
+ if (cipher_suite_id < 0) {
+ lprintf(LOG_ERR, "Cipher suite ID %i is invalid.", cipher_suite_id);
+ rc = -1;
+ goto out_free;
+ }
+ break;
+ case 'v':
+ verbose++;
+ break;
+ case 'c':
+ csv_output = 1;
+ break;
+ case 'H':
+ if (hostname) {
+ free(hostname);
+ hostname = NULL;
+ }
+ hostname = strdup(optarg);
+ if (hostname == NULL) {
+ lprintf(LOG_ERR, "%s: malloc failure", progname);
+ goto out_free;
+ }
+ break;
+ case 'f':
if (password) {
free(password);
password = NULL;
}
- password = strdup(tmp_pass);
- tmp_pass = NULL;
- if (password == NULL) {
- lprintf(LOG_ERR, "%s: malloc failure", progname);
- goto out_free;
+ password = ipmi_password_file_read(optarg);
+ if (password == NULL)
+ lprintf(LOG_ERR, "Unable to read password "
+ "from file %s", optarg);
+ break;
+ case 'a':
+#ifdef HAVE_GETPASSPHRASE
+ tmp_pass = getpassphrase("Password: ");
+#else
+ tmp_pass = getpass("Password: ");
+#endif
+ if (tmp_pass != NULL) {
+ if (password) {
+ free(password);
+ password = NULL;
+ }
+ password = strdup(tmp_pass);
+ tmp_pass = NULL;
+ if (password == NULL) {
+ lprintf(LOG_ERR, "%s: malloc failure", progname);
+ goto out_free;
+ }
}
- }
- break;
- case 'k':
- if (kgkey) {
- free(kgkey);
- kgkey = NULL;
- }
- kgkey = strdup(optarg);
- if (kgkey == NULL) {
- lprintf(LOG_ERR, "%s: malloc failure", progname);
- goto out_free;
- }
- break;
- case 'K':
- if ((tmp_env = getenv("IPMI_KGKEY"))) {
+ break;
+ case 'k':
if (kgkey) {
free(kgkey);
kgkey = NULL;
}
- kgkey = strdup(tmp_env);
+ kgkey = strdup(optarg);
if (kgkey == NULL) {
lprintf(LOG_ERR, "%s: malloc failure", progname);
goto out_free;
}
- } else {
- lprintf(LOG_WARN, "Unable to read kgkey from environment");
- }
- break;
- case 'y':
- if (kgkey) {
- free(kgkey);
- kgkey = NULL;
- }
- kgkey = ipmi_parse_hex(optarg);
- if (kgkey == NULL) {
- goto out_free;
- }
- break;
- case 'Y':
-#ifdef HAVE_GETPASSPHRASE
- tmp_pass = getpassphrase("Key: ");
-#else
- tmp_pass = getpass("Key: ");
-#endif
- if (tmp_pass != NULL) {
+ break;
+ case 'K':
+ if ((tmp_env = getenv("IPMI_KGKEY"))) {
+ if (kgkey) {
+ free(kgkey);
+ kgkey = NULL;
+ }
+ kgkey = strdup(tmp_env);
+ if (kgkey == NULL) {
+ lprintf(LOG_ERR, "%s: malloc failure", progname);
+ goto out_free;
+ }
+ } else {
+ lprintf(LOG_WARN, "Unable to read kgkey from environment");
+ }
+ break;
+ case 'y':
if (kgkey) {
free(kgkey);
kgkey = NULL;
}
- kgkey = strdup(tmp_pass);
- tmp_pass = NULL;
+ kgkey = ipmi_parse_hex(optarg);
if (kgkey == NULL) {
+ goto out_free;
+ }
+ break;
+ case 'Y':
+#ifdef HAVE_GETPASSPHRASE
+ tmp_pass = getpassphrase("Key: ");
+#else
+ tmp_pass = getpass("Key: ");
+#endif
+ if (tmp_pass != NULL) {
+ if (kgkey) {
+ free(kgkey);
+ kgkey = NULL;
+ }
+ kgkey = strdup(tmp_pass);
+ tmp_pass = NULL;
+ if (kgkey == NULL) {
+ lprintf(LOG_ERR, "%s: malloc failure", progname);
+ goto out_free;
+ }
+ }
+ break;
+ case 'U':
+ if (username) {
+ free(username);
+ username = NULL;
+ }
+ if (strlen(optarg) > 16) {
+ lprintf(LOG_ERR, "Username is too long (> 16 bytes)");
+ goto out_free;
+ }
+ username = strdup(optarg);
+ if (username == NULL) {
lprintf(LOG_ERR, "%s: malloc failure", progname);
goto out_free;
}
- }
- break;
- case 'U':
- if (username) {
- free(username);
- username = NULL;
- }
- if (strlen(optarg) > 16) {
- lprintf(LOG_ERR, "Username is too long (> 16 bytes)");
- goto out_free;
- }
- username = strdup(optarg);
- if (username == NULL) {
- lprintf(LOG_ERR, "%s: malloc failure", progname);
- goto out_free;
- }
- break;
- case 'S':
- if (sdrcache) {
- free(sdrcache);
- sdrcache = NULL;
- }
- sdrcache = strdup(optarg);
- if (sdrcache == NULL) {
- lprintf(LOG_ERR, "%s: malloc failure", progname);
- goto out_free;
- }
- break;
- case 'D':
- /* check for subsequent instance of -D */
- if (devfile) {
- /* free memory for previous string */
- free(devfile);
- }
- devfile = strdup(optarg);
- if (devfile == NULL) {
- lprintf(LOG_ERR, "%s: malloc failure", progname);
- goto out_free;
- }
- break;
+ break;
+ case 'S':
+ if (sdrcache) {
+ free(sdrcache);
+ sdrcache = NULL;
+ }
+ sdrcache = strdup(optarg);
+ if (sdrcache == NULL) {
+ lprintf(LOG_ERR, "%s: malloc failure", progname);
+ goto out_free;
+ }
+ break;
+ case 'D':
+ /* check for subsequent instance of -D */
+ if (devfile) {
+ /* free memory for previous string */
+ free(devfile);
+ }
+ devfile = strdup(optarg);
+ if (devfile == NULL) {
+ lprintf(LOG_ERR, "%s: malloc failure", progname);
+ goto out_free;
+ }
+ break;
#ifdef ENABLE_ALL_OPTIONS
- case 'o':
- if (oemtype) {
- free(oemtype);
- oemtype = NULL;
- }
- oemtype = strdup(optarg);
- if (oemtype == NULL) {
- lprintf(LOG_ERR, "%s: malloc failure", progname);
- goto out_free;
- }
- if (strncmp(oemtype, "list", 4) == 0 ||
- strncmp(oemtype, "help", 4) == 0) {
- ipmi_oem_print();
- rc = 0;
- goto out_free;
- }
- break;
- case 'g':
- /* backwards compatible oem hack */
- if (oemtype) {
- free(oemtype);
- oemtype = NULL;
- }
- oemtype = strdup("intelwv2");
- break;
- case 's':
- /* backwards compatible oem hack */
- if (oemtype) {
- free(oemtype);
- oemtype = NULL;
- }
- oemtype = strdup("supermicro");
- break;
- case 'P':
- if (password) {
- free(password);
- password = NULL;
- }
- password = strdup(optarg);
- if (password == NULL) {
- lprintf(LOG_ERR, "%s: malloc failure", progname);
- goto out_free;
- }
-
- /* Prevent password snooping with ps */
- i = strlen(optarg);
- memset(optarg, 'X', i);
- break;
- case 'E':
- if ((tmp_env = getenv("IPMITOOL_PASSWORD"))) {
- if (password) {
- free(password);
- password = NULL;
+ case 'o':
+ if (oemtype) {
+ free(oemtype);
+ oemtype = NULL;
}
- password = strdup(tmp_env);
- if (password == NULL) {
+ oemtype = strdup(optarg);
+ if (oemtype == NULL) {
lprintf(LOG_ERR, "%s: malloc failure", progname);
goto out_free;
}
- }
- else if ((tmp_env = getenv("IPMI_PASSWORD"))) {
+ if (strncmp(oemtype, "list", 4) == 0 ||
+ strncmp(oemtype, "help", 4) == 0) {
+ ipmi_oem_print();
+ rc = 0;
+ goto out_free;
+ }
+ break;
+ case 'g':
+ /* backwards compatible oem hack */
+ if (oemtype) {
+ free(oemtype);
+ oemtype = NULL;
+ }
+ oemtype = strdup("intelwv2");
+ break;
+ case 's':
+ /* backwards compatible oem hack */
+ if (oemtype) {
+ free(oemtype);
+ oemtype = NULL;
+ }
+ oemtype = strdup("supermicro");
+ break;
+ case 'P':
if (password) {
free(password);
password = NULL;
}
- password = strdup(tmp_env);
+ password = strdup(optarg);
if (password == NULL) {
lprintf(LOG_ERR, "%s: malloc failure", progname);
goto out_free;
}
- }
- else {
- lprintf(LOG_WARN, "Unable to read password from environment");
- }
- break;
- case 'L':
- i = strlen(optarg);
- if ((i > 0) && (optarg[i-1] == '+')) {
- lookupbit = 0;
- optarg[i-1] = 0;
- }
- privlvl = str2val(optarg, ipmi_privlvl_vals);
- if (privlvl == 0xFF) {
- lprintf(LOG_WARN, "Invalid privilege level %s", optarg);
- }
- break;
- case 'A':
- authtype = str2val(optarg, ipmi_authtype_session_vals);
- break;
- case 't':
- if (str2uchar(optarg, &target_addr) != 0) {
- lprintf(LOG_ERR, "Invalid parameter given or out of range for '-t'.");
- rc = -1;
- goto out_free;
- }
- break;
- case 'b':
- if (str2uchar(optarg, &target_channel) != 0) {
- lprintf(LOG_ERR, "Invalid parameter given or out of range for '-b'.");
- rc = -1;
- goto out_free;
- }
- break;
- case 'T':
- if (str2uchar(optarg, &transit_addr) != 0) {
- lprintf(LOG_ERR, "Invalid parameter given or out of range for '-T'.");
- rc = -1;
- goto out_free;
- }
- break;
- case 'B':
- if (str2uchar(optarg, &transit_channel) != 0) {
- lprintf(LOG_ERR, "Invalid parameter given or out of range for '-B'.");
- rc = -1;
- goto out_free;
- }
- break;
- case 'l':
- if (str2uchar(optarg, &target_lun) != 0) {
- lprintf(LOG_ERR, "Invalid parameter given or out of range for '-l'.");
- rc = 1;
- goto out_free;
- }
- break;
- case 'm':
- if (str2uchar(optarg, &arg_addr) != 0) {
- lprintf(LOG_ERR, "Invalid parameter given or out of range for '-m'.");
- rc = -1;
- goto out_free;
- }
- break;
- case 'e':
- sol_escape_char = optarg[0];
- break;
- case 'O':
- if (seloem) {
- free(seloem);
- seloem = NULL;
- }
- seloem = strdup(optarg);
- if (seloem == NULL) {
- lprintf(LOG_ERR, "%s: malloc failure", progname);
- goto out_free;
- }
- break;
- case 'z':
- if (str2ushort(optarg, &my_long_packet_size) != 0) {
- lprintf(LOG_ERR, "Invalid parameter given or out of range for '-z'.");
- rc = -1;
- goto out_free;
- }
- break;
- /* Retry and Timeout */
- case 'R':
- if (str2int(optarg, &retry) != 0 || retry < 0) {
- lprintf(LOG_ERR, "Invalid parameter given or out of range for '-R'.");
- rc = -1;
+
+ /* Prevent password snooping with ps */
+ i = strlen(optarg);
+ memset(optarg, 'X', i);
+ break;
+ case 'E':
+ if ((tmp_env = getenv("IPMITOOL_PASSWORD"))) {
+ if (password) {
+ free(password);
+ password = NULL;
+ }
+ password = strdup(tmp_env);
+ if (password == NULL) {
+ lprintf(LOG_ERR, "%s: malloc failure", progname);
+ goto out_free;
+ }
+ }
+ else if ((tmp_env = getenv("IPMI_PASSWORD"))) {
+ if (password) {
+ free(password);
+ password = NULL;
+ }
+ password = strdup(tmp_env);
+ if (password == NULL) {
+ lprintf(LOG_ERR, "%s: malloc failure", progname);
+ goto out_free;
+ }
+ }
+ else {
+ lprintf(LOG_WARN, "Unable to read password from environment");
+ }
+ break;
+ case 'L':
+ i = strlen(optarg);
+ if ((i > 0) && (optarg[i-1] == '+')) {
+ lookupbit = 0;
+ optarg[i-1] = 0;
+ }
+ privlvl = str2val(optarg, ipmi_privlvl_vals);
+ if (privlvl == 0xFF) {
+ lprintf(LOG_WARN, "Invalid privilege level %s", optarg);
+ }
+ break;
+ case 'A':
+ authtype = str2val(optarg, ipmi_authtype_session_vals);
+ break;
+ case 't':
+ if (str2uchar(optarg, &target_addr) != 0) {
+ lprintf(LOG_ERR, "Invalid parameter given or out of range for '-t'.");
+ rc = -1;
+ goto out_free;
+ }
+ break;
+ case 'b':
+ if (str2uchar(optarg, &target_channel) != 0) {
+ lprintf(LOG_ERR, "Invalid parameter given or out of range for '-b'.");
+ rc = -1;
+ goto out_free;
+ }
+ break;
+ case 'T':
+ if (str2uchar(optarg, &transit_addr) != 0) {
+ lprintf(LOG_ERR, "Invalid parameter given or out of range for '-T'.");
+ rc = -1;
+ goto out_free;
+ }
+ break;
+ case 'B':
+ if (str2uchar(optarg, &transit_channel) != 0) {
+ lprintf(LOG_ERR, "Invalid parameter given or out of range for '-B'.");
+ rc = -1;
+ goto out_free;
+ }
+ break;
+ case 'l':
+ if (str2uchar(optarg, &target_lun) != 0) {
+ lprintf(LOG_ERR, "Invalid parameter given or out of range for '-l'.");
+ rc = 1;
+ goto out_free;
+ }
+ break;
+ case 'm':
+ if (str2uchar(optarg, &arg_addr) != 0) {
+ lprintf(LOG_ERR, "Invalid parameter given or out of range for '-m'.");
+ rc = -1;
+ goto out_free;
+ }
+ break;
+ case 'e':
+ sol_escape_char = optarg[0];
+ break;
+ case 'O':
+ if (seloem) {
+ free(seloem);
+ seloem = NULL;
+ }
+ seloem = strdup(optarg);
+ if (seloem == NULL) {
+ lprintf(LOG_ERR, "%s: malloc failure", progname);
+ goto out_free;
+ }
+ break;
+ case 'z':
+ if (str2ushort(optarg, &my_long_packet_size) != 0) {
+ lprintf(LOG_ERR, "Invalid parameter given or out of range for '-z'.");
+ rc = -1;
+ goto out_free;
+ }
+ break;
+ /* Retry and Timeout */
+ case 'R':
+ if (str2int(optarg, &retry) != 0 || retry < 0) {
+ lprintf(LOG_ERR, "Invalid parameter given or out of range for '-R'.");
+ rc = -1;
+ goto out_free;
+ }
+ break;
+ case 'N':
+ if (str2uint(optarg, &timeout) != 0) {
+ lprintf(LOG_ERR, "Invalid parameter given or out of range for '-N'.");
+ rc = -1;
+ goto out_free;
+ }
+ break;
+#endif
+ default:
+ ipmi_option_usage(progname, cmdlist, intflist);
goto out_free;
}
- break;
- case 'N':
- if (str2uint(optarg, &timeout) != 0) {
- lprintf(LOG_ERR, "Invalid parameter given or out of range for '-N'.");
- rc = -1;
- goto out_free;
+ }
+
+ /* support additional arguments from environment */
+ if (argecnt == 0) {
+ argestr = getenv("IPMITOOL_ARGV");
+ if (argestr != NULL) {
+ argecnt = 0;
+ arge = malloc(sizeof(char*)*(argecnt+2));
+ arge[argecnt++] = "ipmitool-env";
+ arge[argecnt] = NULL;
+ while ((arge[argecnt] = strsep(&argestr, " ")) != NULL) {
+ narge = realloc(arge, sizeof(char*)*(argecnt+2));
+ if (narge == NULL) {
+ free(arge);
+ lprintf(LOG_ERR, "Problem while resizing options from environment.\n");
+ rc = -1;
+ goto out_free;
+ } else {
+ arge = narge;
+ }
+ arge[++argecnt] = NULL;
+ }
}
- break;
-#endif
- default:
- ipmi_option_usage(progname, cmdlist, intflist);
- goto out_free;
}
+
+ } while ((argecnt>1) && (arg != arge));
+ if (NULL != arge) {
+ optind = voptind;
}
/* check for command before doing anything */

View File

@ -1,7 +1,7 @@
Name: ipmitool
Summary: Utility for IPMI control
Version: 1.8.15
Release: 6%{?dist}
Version: 1.8.16
Release: 1%{?dist}
License: BSD
Group: System Environment/Base
URL: http://ipmitool.sourceforge.net/
@ -23,16 +23,6 @@ Provides: OpenIPMI-tools = 2.0.14-3
Patch1: ipmitool-1.8.10-ipmievd-init.patch
Patch2: ipmitool-1.8.10-ipmievd-condrestart.patch
Patch3: ipmitool-1.8.11-remove-umask0.patch
# various threads. still pending.
#Patch4: cxoem-jb-cx6.patch
# pending
#Patch5: ipmitool-1.8.12-fips.patch
# pending
#Patch6: ipmitool-1.8.12-fipsman.patch
# pending https://sourceforge.net/p/ipmitool/bugs/280/
#Patch7: ipmitool-1.8.13-dualbridgedoc.patch
# TODO
Patch8: ipmitool-1.8.13-envarg.patch
%description
This package contains a utility for interfacing with devices that support
@ -95,11 +85,6 @@ for the host OS to use.
%patch1 -p1 -b .ipmievd-init
%patch2 -p0 -b .condrestart
%patch3 -p1 -b .umask
#patch4 -p1 -b .cxoem
#patch5 -p0 -b .fips
#patch6 -p0 -b .fipsman
#patch7 -p1 -b .dualbridgedoc
%patch8 -p1 -b .argenv
for f in AUTHORS ChangeLog; do
iconv -f iso-8859-1 -t utf8 < ${f} > ${f}.utf8
@ -194,6 +179,9 @@ install -Dm 755 contrib/bmc-snmp-proxy %{buildroot}%{_libexecdir}/bmc-sn
%{_libexecdir}/bmc-snmp-proxy
%changelog
* Tue Feb 23 2016 Boris Ranto <branto@redhat.com> - 1.8.16-1
- Rebase to version 1.8.16
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.15-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

View File

@ -1,4 +1,4 @@
fcfca92bef56b9e9e57ec71f21636cc8 ipmitool-1.8.15.tar.bz2
7089cc93e59449f4fe2d0c36ce7142e9 ipmitool-1.8.16.tar.bz2
95bd2072031533893cd9d5d9c9603d92 exchange-bmc-os-info
6598ee7c4ba2c8f69ef2ad48e502cada exchange-bmc-os-info.service
3a728964cb3990f3fd6febef36b4e8af exchange-bmc-os-info.sysconf