rpmku.c | rpmku.c | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
*/ | */ | |||
#include "system.h" | #include "system.h" | |||
#define _RPMIOB_INTERNAL | #define _RPMIOB_INTERNAL | |||
#include <rpmiotypes.h> | #include <rpmiotypes.h> | |||
#include <rpmio.h> | #include <rpmio.h> | |||
#if defined(HAVE_KEYUTILS_H) | #if defined(HAVE_KEYUTILS_H) | |||
#include <rpmmacro.h> | #include <rpmmacro.h> | |||
#include <argv.h> | #include <argv.h> | |||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
#include <keyutils.h> | #include <keyutils.h> | |||
#ifdef __cplusplus | ||||
} | ||||
#endif | ||||
#define _RPMPGP_INTERNAL | #define _RPMPGP_INTERNAL | |||
#include <rpmpgp.h> | #include <rpmpgp.h> | |||
#endif | #endif | |||
#include <rpmku.h> | #include <rpmku.h> | |||
#include "debug.h" | #include "debug.h" | |||
/*@access pgpDigParams@ */ | /*@access pgpDigParams@ */ | |||
/*@access rpmiob @*/ | /*@access rpmiob @*/ | |||
skipping to change at line 68 | skipping to change at line 76 | |||
return strcmp(((_kuItem)a)->name, ((_kuItem)b)->name); | return strcmp(((_kuItem)a)->name, ((_kuItem)b)->name); | |||
} | } | |||
static key_serial_t | static key_serial_t | |||
kuValue(const char * name) | kuValue(const char * name) | |||
/*@*/ | /*@*/ | |||
{ | { | |||
_kuItem k = NULL; | _kuItem k = NULL; | |||
if (name != NULL && *name != '\0') { | if (name != NULL && *name != '\0') { | |||
_kuItem tmp = memset(alloca(sizeof(*tmp)), 0, sizeof(*tmp)); | _kuItem tmp = (_kuItem) memset(alloca(sizeof(*tmp)), 0, sizeof(*tmp) ); | |||
/*@-temptrans@*/ | /*@-temptrans@*/ | |||
tmp->name = name; | tmp->name = name; | |||
/*@=temptrans@*/ | /*@=temptrans@*/ | |||
k = (_kuItem)bsearch(tmp, kuTable, nkuTable, sizeof(kuTable[0]), kuC mp); | k = (_kuItem)bsearch(tmp, kuTable, nkuTable, sizeof(kuTable[0]), kuC mp); | |||
} | } | |||
return (k != NULL ? k->val : 0); | return (k != NULL ? k->val : 0); | |||
} | } | |||
#endif | #endif | |||
/*@-globs -internalglobs -mods @*/ | /*@-globs -internalglobs -mods @*/ | |||
skipping to change at line 102 | skipping to change at line 110 | |||
if (_kuKeyring == 0) | if (_kuKeyring == 0) | |||
_kuKeyring = KEY_SPEC_PROCESS_KEYRING; | _kuKeyring = KEY_SPEC_PROCESS_KEYRING; | |||
_keyutils_keyring = _free(_keyutils_keyring); | _keyutils_keyring = _free(_keyutils_keyring); | |||
} | } | |||
if (pw && *pw) { | if (pw && *pw) { | |||
key_serial_t keyring = (key_serial_t) _kuKeyring; | key_serial_t keyring = (key_serial_t) _kuKeyring; | |||
size_t npw = strlen(pw); | size_t npw = strlen(pw); | |||
(void) add_key("user", "rpm:passwd", pw, npw, keyring); | (void) add_key("user", "rpm:passwd", pw, npw, keyring); | |||
(void) memset(pw, 0, npw); /* burn the password */ | (void) memset(pw, 0, npw); /* burn the password */ | |||
pw = "@u user rpm:passwd"; | pw = (char *) "@u user rpm:passwd"; | |||
} | } | |||
#endif | #endif | |||
assert(pw != NULL); | assert(pw != NULL); | |||
/*@-observertrans -statictrans@*/ | /*@-observertrans -statictrans@*/ | |||
return pw; | return pw; | |||
/*@=observertrans =statictrans@*/ | /*@=observertrans =statictrans@*/ | |||
} | } | |||
/*@=globs =internalglobs =mods @*/ | /*@=globs =internalglobs =mods @*/ | |||
skipping to change at line 135 | skipping to change at line 143 | |||
free(password); | free(password); | |||
password = NULL; | password = NULL; | |||
} | } | |||
assert(av != NULL); | assert(av != NULL); | |||
assert(av[0] != NULL); | assert(av[0] != NULL); | |||
assert(av[1] != NULL); | assert(av[1] != NULL); | |||
assert(av[2] != NULL); | assert(av[2] != NULL); | |||
key = request_key(av[0], av[1], av[2], dest); | key = request_key(av[0], av[1], av[2], dest); | |||
/*@-nullstate@*/ /* XXX *password may be null. */ | /*@-nullstate@*/ /* XXX *password may be null. */ | |||
xx = keyctl_read_alloc(key, (void *)&password); | xx = keyctl_read_alloc(key, (void **)&password); | |||
/*@=nullstate@*/ | /*@=nullstate@*/ | |||
if (password == NULL) | if (password == NULL) | |||
password = ""; | password = (char *) ""; | |||
#endif | #endif | |||
/*@-statictrans@*/ | /*@-statictrans@*/ | |||
return password; | return password; | |||
/*@=statictrans@*/ | /*@=statictrans@*/ | |||
} | } | |||
/*@-redecl@*/ | /*@-redecl@*/ | |||
char * (*Getpass) (const char * prompt) = _GetPass; | char * (*Getpass) (const char * prompt) = _GetPass; | |||
/*@=redecl@*/ | /*@=redecl@*/ | |||
skipping to change at line 161 | skipping to change at line 169 | |||
{ | { | |||
if (iobp != NULL) | if (iobp != NULL) | |||
*iobp = NULL; | *iobp = NULL; | |||
#if defined(HAVE_KEYUTILS_H) | #if defined(HAVE_KEYUTILS_H) | |||
if (_kuCache) { | if (_kuCache) { | |||
/*@observer@*/ | /*@observer@*/ | |||
static const char krprefix[] = "rpm:gpg:pubkey:"; | static const char krprefix[] = "rpm:gpg:pubkey:"; | |||
key_serial_t keyring = (key_serial_t) _kuKeyring; | key_serial_t keyring = (key_serial_t) _kuKeyring; | |||
char krfp[32]; | char krfp[32]; | |||
char * krn = alloca(strlen(krprefix) + sizeof("12345678")); | char * krn = (char *) alloca(strlen(krprefix) + sizeof("12345678")); | |||
long key; | long key; | |||
int xx; | int xx; | |||
(void) snprintf(krfp, sizeof(krfp), "%08X", pgpGrab(sigp->signid+4, 4)); | (void) snprintf(krfp, sizeof(krfp), "%08X", pgpGrab(sigp->signid+4, 4)); | |||
krfp[sizeof(krfp)-1] = '\0'; | krfp[sizeof(krfp)-1] = '\0'; | |||
*krn = '\0'; | *krn = '\0'; | |||
(void) stpcpy( stpcpy(krn, krprefix), krfp); | (void) stpcpy( stpcpy(krn, krprefix), krfp); | |||
key = keyctl_search(keyring, "user", krn, 0); | key = keyctl_search(keyring, "user", krn, 0); | |||
xx = keyctl_read(key, NULL, 0); | xx = keyctl_read(key, NULL, 0); | |||
skipping to change at line 205 | skipping to change at line 213 | |||
} | } | |||
rpmRC rpmkuStorePubkey(pgpDigParams sigp, /*@only@*/ rpmiob iob) | rpmRC rpmkuStorePubkey(pgpDigParams sigp, /*@only@*/ rpmiob iob) | |||
{ | { | |||
#if defined(HAVE_KEYUTILS_H) | #if defined(HAVE_KEYUTILS_H) | |||
if (_kuCache) { | if (_kuCache) { | |||
/*@observer@*/ | /*@observer@*/ | |||
static const char krprefix[] = "rpm:gpg:pubkey:"; | static const char krprefix[] = "rpm:gpg:pubkey:"; | |||
key_serial_t keyring = (key_serial_t) _kuKeyring; | key_serial_t keyring = (key_serial_t) _kuKeyring; | |||
char krfp[32]; | char krfp[32]; | |||
char * krn = alloca(strlen(krprefix) + sizeof("12345678")); | char * krn = (char *) alloca(strlen(krprefix) + sizeof("12345678")); | |||
(void) snprintf(krfp, sizeof(krfp), "%08X", pgpGrab(sigp->signid+4, 4)); | (void) snprintf(krfp, sizeof(krfp), "%08X", pgpGrab(sigp->signid+4, 4)); | |||
krfp[sizeof(krfp)-1] = '\0'; | krfp[sizeof(krfp)-1] = '\0'; | |||
*krn = '\0'; | *krn = '\0'; | |||
(void) stpcpy( stpcpy(krn, krprefix), krfp); | (void) stpcpy( stpcpy(krn, krprefix), krfp); | |||
/*@-moduncon -noeffectuncon @*/ | /*@-moduncon -noeffectuncon @*/ | |||
(void) add_key("user", krn, iob->b, iob->blen, keyring); | (void) add_key("user", krn, iob->b, iob->blen, keyring); | |||
/*@=moduncon =noeffectuncon @*/ | /*@=moduncon =noeffectuncon @*/ | |||
} | } | |||
#endif | #endif | |||
skipping to change at line 233 | skipping to change at line 241 | |||
#if defined(HAVE_KEYUTILS_H) | #if defined(HAVE_KEYUTILS_H) | |||
if (passPhrase && !strcmp(passPhrase, "@u user rpm:passwd")) { | if (passPhrase && !strcmp(passPhrase, "@u user rpm:passwd")) { | |||
key_serial_t keyring = (key_serial_t) _kuKeyring; | key_serial_t keyring = (key_serial_t) _kuKeyring; | |||
long key; | long key; | |||
int xx; | int xx; | |||
/*@-moduncon@*/ | /*@-moduncon@*/ | |||
key = keyctl_search(keyring, "user", "rpm:passwd", 0); | key = keyctl_search(keyring, "user", "rpm:passwd", 0); | |||
pw = NULL; | pw = NULL; | |||
xx = keyctl_read_alloc(key, (void *)&pw); | xx = keyctl_read_alloc(key, (void **)&pw); | |||
/*@=moduncon@*/ | /*@=moduncon@*/ | |||
if (xx < 0) | if (xx < 0) | |||
pw = NULL; | pw = NULL; | |||
} else | } else | |||
#endif | #endif | |||
pw = xstrdup(passPhrase); | pw = xstrdup(passPhrase); | |||
return pw; | return pw; | |||
} | } | |||
End of changes. 9 change blocks. | ||||
7 lines changed or deleted | 15 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |