osunix / osunix-gate (http://osunix.org/)

fork of onnv-gate

A free and totally open source opensolaris technology gate. We stress high quality and gives developers who don't want to sign the SCA a place to commit their license compatible code.

Clone this repository (size: 224.2 MB): HTTPS / SSH
$ hg clone http://hg.pathscale.com/osunix-gate
commit 11775: 45422b5331d8
parent 11774: 978cd8cfb846
branch: default
6927569 cryptoadm unload doesn't perform as expected on freshly-installed systems
Dan ...@drydog.com
6 months ago

Changed (Δ483 bytes):

Up to file-list usr/src/cmd/cmd-crypto/cryptoadm/adm_kef_util.c:

37
37
#include "cryptoadm.h"
38
38
39
39
static int err; /* To store errno which may be overwritten by gettext() */
40
static int build_entrylist(entry_t *, entrylist_t **);
41
static entry_t *dup_entry(entry_t *);
42
static mechlist_t *dup_mechlist(mechlist_t *);
43
static entry_t *getent(char *, entrylist_t *);
44
static int interpret(char *, entry_t **);
40
static int build_entrylist(entry_t *pent, entrylist_t **pplist);
41
static entry_t *dup_entry(entry_t *pent1);
42
static mechlist_t *dup_mechlist(mechlist_t *plist);
43
static entry_t *getent(char *provname, entrylist_t *entrylist);
44
static int interpret(char *buf, entry_t **ppent);
45
45
static int parse_sup_dis_list(const char *buf, entry_t *pent);
46
46
47
47
@@ -432,9 +432,9 @@ free_entrylist(entrylist_t *entrylist)
432
432
433
433
434
434
/*
435
 * Convert an entry to a string.  This routine builds a string for the entry
436
 * to be inserted in the kcf.conf file.  Based on the content of each entry,
437
 * the result string can be one of these 7 forms:
435
 * Convert an entry_t to a kcf.conf line string.  Build a string to insert
436
 * as a line in file kcf.conf.  Based on the content of an entry_t,
437
 * the result string is one of these 8 forms:
438
438
 *  - name:supportedlist=m1,m2,...,mj
439
439
 *  - name:disabledlist=m1,m2,...,mj
440
440
 *  - name:supportedlist=m1,...,mj;disabledlist=m1,m2,...,mk
@@ -444,6 +444,12 @@ free_entrylist(entrylist_t *entrylist)
444
444
 *  - name:unload;disabledlist=m1,m2,...,mj
445
445
 *  - name:unload;supportedlist=m1,...,mj;disabledlist=m1,m2,...,mk
446
446
 *
447
 *  - (NUL character or 0-length string)
448
 *
449
 * Return a 0-length empty string if no keyword is present (that is,
450
 * supportedlist, disabledlist, or unload).  A kcf.conf line with just the
451
 * provider name with no keyword is invalid.
452
 *
447
453
 * Note that the caller is responsible for freeing the returned string
448
454
 * (with free_entry()).
449
455
 * See interpret() for the reverse of this function: converting a string
@@ -454,8 +460,7 @@ ent2str(entry_t *pent)
454
460
{
455
461
	char		*buf;
456
462
	mechlist_t	*pcur = NULL;
457
	boolean_t	semicolon_separator = B_FALSE;
458
463
	boolean_t	keyword_already_present = B_FALSE;
459
464
460
465
	if (pent == NULL) {
461
466
		return (NULL);
@@ -482,14 +487,14 @@ ent2str(entry_t *pent)
482
487
			return (NULL);
483
488
		}
484
489
485
		semicolon_separator = B_TRUE;
490
		keyword_already_present = B_TRUE;
486
491
	}
487
492
488
493
	/* convert the supported list if any */
489
494
	pcur = pent->suplist;
490
495
	if (pcur != NULL) {
491
496
		if (strlcat(buf,
492
		    semicolon_separator ? SEP_SEMICOLON : SEP_COLON,
497
		    keyword_already_present ? SEP_SEMICOLON : SEP_COLON,
493
498
		    BUFSIZ) >= BUFSIZ) {
494
499
			free(buf);
495
500
			return (NULL);
@@ -515,14 +520,14 @@ ent2str(entry_t *pent)
515
520
				}
516
521
			}
517
522
		}
518
		semicolon_separator = B_TRUE;
523
		keyword_already_present = B_TRUE;
519
524
	}
520
525
521
526
	/* convert the disabled list if any */
522
527
	pcur = pent->dislist;
523
528
	if (pcur != NULL) {
524
529
		if (strlcat(buf,
525
		    semicolon_separator ? SEP_SEMICOLON : SEP_COLON,
530
		    keyword_already_present ? SEP_SEMICOLON : SEP_COLON,
526
531
		    BUFSIZ) >= BUFSIZ) {
527
532
			free(buf);
528
533
			return (NULL);
@@ -548,7 +553,7 @@ ent2str(entry_t *pent)
548
553
				}
549
554
			}
550
555
		}
551
		semicolon_separator = B_TRUE;
556
		keyword_already_present = B_TRUE;
552
557
	}
553
558
554
559
	if (strlcat(buf, "\n", BUFSIZ) >= BUFSIZ) {
@@ -556,6 +561,10 @@ ent2str(entry_t *pent)
556
561
		return (NULL);
557
562
	}
558
563
564
	if (!keyword_already_present) {
565
		/* Only the provider name, without a keyword, is on the line */
566
		buf[0] = '\0';
567
	}
559
568
	return (buf);
560
569
}
561
570
@@ -965,6 +974,10 @@ update_kcfconf(entry_t *pent, int update
965
974
		if ((new_str = ent2str(pent)) == NULL) {
966
975
			return (FAILURE);
967
976
		}
977
		if (strlen(new_str) == 0) {
978
			free(new_str);
979
			delete_it = B_TRUE;
980
		}
968
981
		break;
969
982
	case DELETE_MODE:
970
983
		delete_it = B_TRUE;