Render error messages as strings instead of internal codes.
This commit is contained in:
parent
b00ad53e42
commit
03080b9ccd
@ -58,7 +58,7 @@ static MPMasterKey mpw_masterKeyForUser_v0(const char *fullName, const char *mas
|
|||||||
mpw_push_int( &masterKeySalt, &masterKeySaltSize, htonl( mpw_utf8_strlen( fullName ) ) );
|
mpw_push_int( &masterKeySalt, &masterKeySaltSize, htonl( mpw_utf8_strlen( fullName ) ) );
|
||||||
mpw_push_string( &masterKeySalt, &masterKeySaltSize, fullName );
|
mpw_push_string( &masterKeySalt, &masterKeySaltSize, fullName );
|
||||||
if (!masterKeySalt) {
|
if (!masterKeySalt) {
|
||||||
ftl( "Could not allocate master key salt: %d\n", errno );
|
ftl( "Could not allocate master key salt: %s\n", strerror( errno ) );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
trc( "masterKeySalt ID: %s\n", mpw_id_buf( masterKeySalt, masterKeySaltSize ) );
|
trc( "masterKeySalt ID: %s\n", mpw_id_buf( masterKeySalt, masterKeySaltSize ) );
|
||||||
@ -68,7 +68,7 @@ static MPMasterKey mpw_masterKeyForUser_v0(const char *fullName, const char *mas
|
|||||||
const uint8_t *masterKey = mpw_scrypt( MPMasterKeySize, masterPassword, masterKeySalt, masterKeySaltSize, MP_N, MP_r, MP_p );
|
const uint8_t *masterKey = mpw_scrypt( MPMasterKeySize, masterPassword, masterKeySalt, masterKeySaltSize, MP_N, MP_r, MP_p );
|
||||||
mpw_free( masterKeySalt, masterKeySaltSize );
|
mpw_free( masterKeySalt, masterKeySaltSize );
|
||||||
if (!masterKey) {
|
if (!masterKey) {
|
||||||
ftl( "Could not allocate master key: %d\n", errno );
|
ftl( "Could not allocate master key: %s\n", strerror( errno ) );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
trc( "masterKey ID: %s\n", mpw_id_buf( masterKey, MPMasterKeySize ) );
|
trc( "masterKey ID: %s\n", mpw_id_buf( masterKey, MPMasterKeySize ) );
|
||||||
@ -104,7 +104,7 @@ static MPSiteKey mpw_siteKey_v0(
|
|||||||
mpw_push_string( &siteSalt, &siteSaltSize, keyContext );
|
mpw_push_string( &siteSalt, &siteSaltSize, keyContext );
|
||||||
}
|
}
|
||||||
if (!siteSalt || !siteSaltSize) {
|
if (!siteSalt || !siteSaltSize) {
|
||||||
ftl( "Could not allocate site salt: %d\n", errno );
|
ftl( "Could not allocate site salt: %s\n", strerror( errno ) );
|
||||||
mpw_free( siteSalt, siteSaltSize );
|
mpw_free( siteSalt, siteSaltSize );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ static MPSiteKey mpw_siteKey_v0(
|
|||||||
MPSiteKey siteKey = mpw_hmac_sha256( masterKey, MPMasterKeySize, siteSalt, siteSaltSize );
|
MPSiteKey siteKey = mpw_hmac_sha256( masterKey, MPMasterKeySize, siteSalt, siteSaltSize );
|
||||||
mpw_free( siteSalt, siteSaltSize );
|
mpw_free( siteSalt, siteSaltSize );
|
||||||
if (!siteKey) {
|
if (!siteKey) {
|
||||||
ftl( "Could not allocate site key: %d\n", errno );
|
ftl( "Could not allocate site key: %s\n", strerror( errno ) );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
trc( "siteKey ID: %s\n", mpw_id_buf( siteKey, MPSiteKeySize ) );
|
trc( "siteKey ID: %s\n", mpw_id_buf( siteKey, MPSiteKeySize ) );
|
||||||
|
@ -43,7 +43,7 @@ static MPMasterKey mpw_masterKeyForUser_v1(const char *fullName, const char *mas
|
|||||||
mpw_push_int( &masterKeySalt, &masterKeySaltSize, htonl( mpw_utf8_strlen( fullName ) ) );
|
mpw_push_int( &masterKeySalt, &masterKeySaltSize, htonl( mpw_utf8_strlen( fullName ) ) );
|
||||||
mpw_push_string( &masterKeySalt, &masterKeySaltSize, fullName );
|
mpw_push_string( &masterKeySalt, &masterKeySaltSize, fullName );
|
||||||
if (!masterKeySalt) {
|
if (!masterKeySalt) {
|
||||||
ftl( "Could not allocate master key salt: %d\n", errno );
|
ftl( "Could not allocate master key salt: %s\n", strerror( errno ) );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
trc( "masterKeySalt ID: %s\n", mpw_id_buf( masterKeySalt, masterKeySaltSize ) );
|
trc( "masterKeySalt ID: %s\n", mpw_id_buf( masterKeySalt, masterKeySaltSize ) );
|
||||||
@ -53,7 +53,7 @@ static MPMasterKey mpw_masterKeyForUser_v1(const char *fullName, const char *mas
|
|||||||
MPMasterKey masterKey = mpw_scrypt( MPMasterKeySize, masterPassword, masterKeySalt, masterKeySaltSize, MP_N, MP_r, MP_p );
|
MPMasterKey masterKey = mpw_scrypt( MPMasterKeySize, masterPassword, masterKeySalt, masterKeySaltSize, MP_N, MP_r, MP_p );
|
||||||
mpw_free( masterKeySalt, masterKeySaltSize );
|
mpw_free( masterKeySalt, masterKeySaltSize );
|
||||||
if (!masterKey) {
|
if (!masterKey) {
|
||||||
ftl( "Could not allocate master key: %d\n", errno );
|
ftl( "Could not allocate master key: %s\n", strerror( errno ) );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
trc( "masterKey ID: %s\n", mpw_id_buf( masterKey, MPMasterKeySize ) );
|
trc( "masterKey ID: %s\n", mpw_id_buf( masterKey, MPMasterKeySize ) );
|
||||||
@ -89,7 +89,7 @@ static MPSiteKey mpw_siteKey_v1(
|
|||||||
mpw_push_string( &siteSalt, &siteSaltSize, keyContext );
|
mpw_push_string( &siteSalt, &siteSaltSize, keyContext );
|
||||||
}
|
}
|
||||||
if (!siteSalt || !siteSaltSize) {
|
if (!siteSalt || !siteSaltSize) {
|
||||||
ftl( "Could not allocate site salt: %d\n", errno );
|
ftl( "Could not allocate site salt: %s\n", strerror( errno ) );
|
||||||
mpw_free( siteSalt, siteSaltSize );
|
mpw_free( siteSalt, siteSaltSize );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ static MPSiteKey mpw_siteKey_v1(
|
|||||||
MPSiteKey siteKey = mpw_hmac_sha256( masterKey, MPMasterKeySize, siteSalt, siteSaltSize );
|
MPSiteKey siteKey = mpw_hmac_sha256( masterKey, MPMasterKeySize, siteSalt, siteSaltSize );
|
||||||
mpw_free( siteSalt, siteSaltSize );
|
mpw_free( siteSalt, siteSaltSize );
|
||||||
if (!siteKey) {
|
if (!siteKey) {
|
||||||
ftl( "Could not allocate site key: %d\n", errno );
|
ftl( "Could not allocate site key: %s\n", strerror( errno ) );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
trc( "siteKey ID: %s\n", mpw_id_buf( siteKey, MPSiteKeySize ) );
|
trc( "siteKey ID: %s\n", mpw_id_buf( siteKey, MPSiteKeySize ) );
|
||||||
|
@ -43,7 +43,7 @@ static MPMasterKey mpw_masterKeyForUser_v2(const char *fullName, const char *mas
|
|||||||
mpw_push_int( &masterKeySalt, &masterKeySaltSize, htonl( mpw_utf8_strlen( fullName ) ) );
|
mpw_push_int( &masterKeySalt, &masterKeySaltSize, htonl( mpw_utf8_strlen( fullName ) ) );
|
||||||
mpw_push_string( &masterKeySalt, &masterKeySaltSize, fullName );
|
mpw_push_string( &masterKeySalt, &masterKeySaltSize, fullName );
|
||||||
if (!masterKeySalt) {
|
if (!masterKeySalt) {
|
||||||
ftl( "Could not allocate master key salt: %d\n", errno );
|
ftl( "Could not allocate master key salt: %s\n", strerror( errno ) );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
trc( "masterKeySalt ID: %s\n", mpw_id_buf( masterKeySalt, masterKeySaltSize ) );
|
trc( "masterKeySalt ID: %s\n", mpw_id_buf( masterKeySalt, masterKeySaltSize ) );
|
||||||
@ -53,7 +53,7 @@ static MPMasterKey mpw_masterKeyForUser_v2(const char *fullName, const char *mas
|
|||||||
const uint8_t *masterKey = mpw_scrypt( MPMasterKeySize, masterPassword, masterKeySalt, masterKeySaltSize, MP_N, MP_r, MP_p );
|
const uint8_t *masterKey = mpw_scrypt( MPMasterKeySize, masterPassword, masterKeySalt, masterKeySaltSize, MP_N, MP_r, MP_p );
|
||||||
mpw_free( masterKeySalt, masterKeySaltSize );
|
mpw_free( masterKeySalt, masterKeySaltSize );
|
||||||
if (!masterKey) {
|
if (!masterKey) {
|
||||||
ftl( "Could not allocate master key: %d\n", errno );
|
ftl( "Could not allocate master key: %s\n", strerror( errno ) );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
trc( "masterKey ID: %s\n", mpw_id_buf( masterKey, MPMasterKeySize ) );
|
trc( "masterKey ID: %s\n", mpw_id_buf( masterKey, MPMasterKeySize ) );
|
||||||
@ -89,7 +89,7 @@ static MPSiteKey mpw_siteKey_v2(
|
|||||||
mpw_push_string( &siteSalt, &siteSaltSize, keyContext );
|
mpw_push_string( &siteSalt, &siteSaltSize, keyContext );
|
||||||
}
|
}
|
||||||
if (!siteSalt || !siteSaltSize) {
|
if (!siteSalt || !siteSaltSize) {
|
||||||
ftl( "Could not allocate site salt: %d\n", errno );
|
ftl( "Could not allocate site salt: %s\n", strerror( errno ) );
|
||||||
mpw_free( siteSalt, siteSaltSize );
|
mpw_free( siteSalt, siteSaltSize );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ static MPSiteKey mpw_siteKey_v2(
|
|||||||
const uint8_t *siteKey = mpw_hmac_sha256( masterKey, MPMasterKeySize, siteSalt, siteSaltSize );
|
const uint8_t *siteKey = mpw_hmac_sha256( masterKey, MPMasterKeySize, siteSalt, siteSaltSize );
|
||||||
mpw_free( siteSalt, siteSaltSize );
|
mpw_free( siteSalt, siteSaltSize );
|
||||||
if (!siteKey) {
|
if (!siteKey) {
|
||||||
ftl( "Could not allocate site key: %d\n", errno );
|
ftl( "Could not allocate site key: %s\n", strerror( errno ) );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
trc( "siteKey ID: %s\n", mpw_id_buf( siteKey, MPSiteKeySize ) );
|
trc( "siteKey ID: %s\n", mpw_id_buf( siteKey, MPSiteKeySize ) );
|
||||||
|
@ -43,7 +43,7 @@ static MPMasterKey mpw_masterKeyForUser_v3(const char *fullName, const char *mas
|
|||||||
mpw_push_int( &masterKeySalt, &masterKeySaltSize, htonl( strlen( fullName ) ) );
|
mpw_push_int( &masterKeySalt, &masterKeySaltSize, htonl( strlen( fullName ) ) );
|
||||||
mpw_push_string( &masterKeySalt, &masterKeySaltSize, fullName );
|
mpw_push_string( &masterKeySalt, &masterKeySaltSize, fullName );
|
||||||
if (!masterKeySalt) {
|
if (!masterKeySalt) {
|
||||||
ftl( "Could not allocate master key salt: %d\n", errno );
|
ftl( "Could not allocate master key salt: %s\n", strerror( errno ) );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
trc( "masterKeySalt ID: %s\n", mpw_id_buf( masterKeySalt, masterKeySaltSize ) );
|
trc( "masterKeySalt ID: %s\n", mpw_id_buf( masterKeySalt, masterKeySaltSize ) );
|
||||||
@ -53,7 +53,7 @@ static MPMasterKey mpw_masterKeyForUser_v3(const char *fullName, const char *mas
|
|||||||
const uint8_t *masterKey = mpw_scrypt( MPMasterKeySize, masterPassword, masterKeySalt, masterKeySaltSize, MP_N, MP_r, MP_p );
|
const uint8_t *masterKey = mpw_scrypt( MPMasterKeySize, masterPassword, masterKeySalt, masterKeySaltSize, MP_N, MP_r, MP_p );
|
||||||
mpw_free( masterKeySalt, masterKeySaltSize );
|
mpw_free( masterKeySalt, masterKeySaltSize );
|
||||||
if (!masterKey) {
|
if (!masterKey) {
|
||||||
ftl( "Could not allocate master key: %d\n", errno );
|
ftl( "Could not allocate master key: %s\n", strerror( errno ) );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
trc( "masterKey ID: %s\n", mpw_id_buf( masterKey, MPMasterKeySize ) );
|
trc( "masterKey ID: %s\n", mpw_id_buf( masterKey, MPMasterKeySize ) );
|
||||||
@ -89,7 +89,7 @@ static MPSiteKey mpw_siteKey_v3(
|
|||||||
mpw_push_string( &siteSalt, &siteSaltSize, keyContext );
|
mpw_push_string( &siteSalt, &siteSaltSize, keyContext );
|
||||||
}
|
}
|
||||||
if (!siteSalt) {
|
if (!siteSalt) {
|
||||||
ftl( "Could not allocate site salt: %d\n", errno );
|
ftl( "Could not allocate site salt: %s\n", strerror( errno ) );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
trc( "siteSalt ID: %s\n", mpw_id_buf( siteSalt, siteSaltSize ) );
|
trc( "siteSalt ID: %s\n", mpw_id_buf( siteSalt, siteSaltSize ) );
|
||||||
@ -97,7 +97,7 @@ static MPSiteKey mpw_siteKey_v3(
|
|||||||
MPSiteKey siteKey = mpw_hmac_sha256( masterKey, MPMasterKeySize, siteSalt, siteSaltSize );
|
MPSiteKey siteKey = mpw_hmac_sha256( masterKey, MPMasterKeySize, siteSalt, siteSaltSize );
|
||||||
mpw_free( siteSalt, siteSaltSize );
|
mpw_free( siteSalt, siteSaltSize );
|
||||||
if (!siteKey || !siteSaltSize) {
|
if (!siteKey || !siteSaltSize) {
|
||||||
ftl( "Could not allocate site key: %d\n", errno );
|
ftl( "Could not allocate site key: %s\n", strerror( errno ) );
|
||||||
mpw_free( siteSalt, siteSaltSize );
|
mpw_free( siteSalt, siteSaltSize );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -662,3 +662,24 @@ MPMarshalledUser *mpw_marshall_read(
|
|||||||
*error = MPMarshallErrorFormat;
|
*error = MPMarshallErrorFormat;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *mpw_explainMarshallError(const MPMarshallError error) {
|
||||||
|
switch (error) {
|
||||||
|
case MPMarshallSuccess:
|
||||||
|
return "The marshalling operation completed successfully.";
|
||||||
|
case MPMarshallErrorStructure:
|
||||||
|
return "An error in the structure of the marshall file interrupted marshalling.";
|
||||||
|
case MPMarshallErrorFormat:
|
||||||
|
return "The marshall file uses an unsupported format version.";
|
||||||
|
case MPMarshallErrorMissing:
|
||||||
|
return "A required value is missing or not specified.";
|
||||||
|
case MPMarshallErrorMasterPassword:
|
||||||
|
return "The given master password is not valid.";
|
||||||
|
case MPMarshallErrorIllegal:
|
||||||
|
return "An illegal value was specified.";
|
||||||
|
case MPMarshallErrorInternal:
|
||||||
|
return "An internal system error interrupted marshalling.";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "An unrecognized error occurred.";
|
||||||
|
}
|
||||||
|
@ -48,6 +48,7 @@ typedef enum( unsigned int, MPMarshallError ) {
|
|||||||
/** An internal system error interrupted marshalling. */
|
/** An internal system error interrupted marshalling. */
|
||||||
MPMarshallErrorInternal,
|
MPMarshallErrorInternal,
|
||||||
};
|
};
|
||||||
|
const char *mpw_explainMarshallError(const MPMarshallError error);
|
||||||
|
|
||||||
typedef struct MPMarshalledQuestion {
|
typedef struct MPMarshalledQuestion {
|
||||||
const char *keyword;
|
const char *keyword;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
static void mpw_getTime(struct timeval *time) {
|
static void mpw_getTime(struct timeval *time) {
|
||||||
|
|
||||||
if (gettimeofday( time, NULL ) != 0)
|
if (gettimeofday( time, NULL ) != 0)
|
||||||
ftl( "Could not get time: %d\n", errno );
|
ftl( "Could not get time: %s\n", strerror( errno ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
static const double mpw_showSpeed(struct timeval startTime, const unsigned int iterations, const char *operation) {
|
static const double mpw_showSpeed(struct timeval startTime, const unsigned int iterations, const char *operation) {
|
||||||
@ -64,7 +64,7 @@ int main(int argc, char *const argv[]) {
|
|||||||
iterations = 3000000;
|
iterations = 3000000;
|
||||||
masterKey = mpw_masterKey( fullName, masterPassword, MPAlgorithmVersionCurrent );
|
masterKey = mpw_masterKey( fullName, masterPassword, MPAlgorithmVersionCurrent );
|
||||||
if (!masterKey) {
|
if (!masterKey) {
|
||||||
ftl( "Could not allocate master key: %d\n", errno );
|
ftl( "Could not allocate master key: %s\n", strerror( errno ) );
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
mpw_getTime( &startTime );
|
mpw_getTime( &startTime );
|
||||||
@ -109,7 +109,7 @@ int main(int argc, char *const argv[]) {
|
|||||||
for (int i = 1; i <= iterations; ++i) {
|
for (int i = 1; i <= iterations; ++i) {
|
||||||
masterKey = mpw_masterKey( fullName, masterPassword, MPAlgorithmVersionCurrent );
|
masterKey = mpw_masterKey( fullName, masterPassword, MPAlgorithmVersionCurrent );
|
||||||
if (!masterKey) {
|
if (!masterKey) {
|
||||||
ftl( "Could not allocate master key: %d\n", errno );
|
ftl( "Could not allocate master key: %s\n", strerror( errno ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,9 +207,9 @@ int main(int argc, char *const argv[]) {
|
|||||||
mpwSitesFormat = MPMarshallFormatFlat;
|
mpwSitesFormat = MPMarshallFormatFlat;
|
||||||
mpwSitesPath = mpwPath( fullName, "mpsites" );
|
mpwSitesPath = mpwPath( fullName, "mpsites" );
|
||||||
if (!mpwSitesPath || !(mpwSites = fopen( mpwSitesPath, "r" )))
|
if (!mpwSitesPath || !(mpwSites = fopen( mpwSitesPath, "r" )))
|
||||||
dbg( "Couldn't open configuration file: %s: %d\n", mpwSitesPath, errno );
|
dbg( "Couldn't open configuration file:\n %s: %s\n",
|
||||||
|
mpwSitesPath, strerror( errno ) );
|
||||||
}
|
}
|
||||||
free( mpwSitesPath );
|
|
||||||
|
|
||||||
// Read the user's sites file.
|
// Read the user's sites file.
|
||||||
if (mpwSites) {
|
if (mpwSites) {
|
||||||
@ -220,7 +220,8 @@ int main(int argc, char *const argv[]) {
|
|||||||
(bufPointer += (readSize = fread( buf + bufPointer, 1, readAmount, mpwSites ))) &&
|
(bufPointer += (readSize = fread( buf + bufPointer, 1, readAmount, mpwSites ))) &&
|
||||||
(readSize == readAmount));
|
(readSize == readAmount));
|
||||||
if (ferror( mpwSites ))
|
if (ferror( mpwSites ))
|
||||||
wrn( "Error while reading configuration file: %s: %d", mpwSitesPath, ferror( mpwSites ) );
|
wrn( "Error while reading configuration file:\n %s: %d",
|
||||||
|
mpwSitesPath, ferror( mpwSites ) );
|
||||||
fclose( mpwSites );
|
fclose( mpwSites );
|
||||||
|
|
||||||
// Parse file.
|
// Parse file.
|
||||||
@ -228,7 +229,8 @@ int main(int argc, char *const argv[]) {
|
|||||||
MPMarshalledUser *user = mpw_marshall_read( buf, mpwSitesFormat, masterPassword, &marshallError );
|
MPMarshalledUser *user = mpw_marshall_read( buf, mpwSitesFormat, masterPassword, &marshallError );
|
||||||
mpw_free_string( buf );
|
mpw_free_string( buf );
|
||||||
if (!user || marshallError != MPMarshallSuccess)
|
if (!user || marshallError != MPMarshallSuccess)
|
||||||
wrn( "Couldn't parse configuration file: %s: %d\n", mpwSitesPath, marshallError );
|
wrn( "Couldn't parse configuration file:\n %s: %s\n",
|
||||||
|
mpwSitesPath, mpw_explainMarshallError( marshallError ) );
|
||||||
|
|
||||||
else {
|
else {
|
||||||
// Load defaults.
|
// Load defaults.
|
||||||
@ -252,15 +254,18 @@ int main(int argc, char *const argv[]) {
|
|||||||
if (mpwSitesFormat != MPMarshallFormatJSON) {
|
if (mpwSitesFormat != MPMarshallFormatJSON) {
|
||||||
mpwSitesPath = mpwPath( fullName, "mpsites.json" );
|
mpwSitesPath = mpwPath( fullName, "mpsites.json" );
|
||||||
if (!mpwSitesPath || !(mpwSites = fopen( mpwSitesPath, "w" )))
|
if (!mpwSitesPath || !(mpwSites = fopen( mpwSitesPath, "w" )))
|
||||||
wrn( "Couldn't create updated configuration file: %s: %d\n", mpwSitesPath, errno );
|
wrn( "Couldn't create updated configuration file:\n %s: %s\n",
|
||||||
|
mpwSitesPath, strerror( errno ) );
|
||||||
|
|
||||||
else {
|
else {
|
||||||
buf = NULL;
|
buf = NULL;
|
||||||
if (!mpw_marshall_write( &buf, MPMarshallFormatJSON, user, &marshallError ) || marshallError != MPMarshallSuccess)
|
if (!mpw_marshall_write( &buf, MPMarshallFormatJSON, user, &marshallError ) || marshallError != MPMarshallSuccess)
|
||||||
wrn( "Couldn't encode updated configuration file: %s: %d", mpwSitesPath, marshallError );
|
wrn( "Couldn't encode updated configuration file:\n %s: %s",
|
||||||
|
mpwSitesPath, mpw_explainMarshallError( marshallError ) );
|
||||||
|
|
||||||
else if (fwrite( buf, sizeof( char ), strlen( buf ), mpwSites ) != strlen( buf ))
|
else if (fwrite( buf, sizeof( char ), strlen( buf ), mpwSites ) != strlen( buf ))
|
||||||
wrn( "Error while writing updated configuration file: %s: %d\n", mpwSitesPath, ferror( mpwSites ) );
|
wrn( "Error while writing updated configuration file:\n %s: %d\n",
|
||||||
|
mpwSitesPath, ferror( mpwSites ) );
|
||||||
|
|
||||||
mpw_free_string( buf );
|
mpw_free_string( buf );
|
||||||
fclose( mpwSites );
|
fclose( mpwSites );
|
||||||
@ -269,6 +274,7 @@ int main(int argc, char *const argv[]) {
|
|||||||
mpw_marshal_free( user );
|
mpw_marshal_free( user );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
free( mpwSitesPath );
|
||||||
|
|
||||||
// Parse default/config-overriding command-line parameters.
|
// Parse default/config-overriding command-line parameters.
|
||||||
if (algorithmVersionArg) {
|
if (algorithmVersionArg) {
|
||||||
@ -327,7 +333,7 @@ int main(int argc, char *const argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MPSiteKey siteKey = mpw_siteKey( masterKey, siteName, siteCounter, keyPurpose, keyContext, algorithmVersion );
|
MPSiteKey siteKey = mpw_siteKey( masterKey, siteName, siteCounter, keyPurpose, keyContext, algorithmVersion );
|
||||||
const char *sitePassword = mpw_sitePassword(siteKey, passwordType, algorithmVersion );
|
const char *sitePassword = mpw_sitePassword( siteKey, passwordType, algorithmVersion );
|
||||||
mpw_free( masterKey, MPMasterKeySize );
|
mpw_free( masterKey, MPMasterKeySize );
|
||||||
mpw_free( siteKey, MPSiteKeySize );
|
mpw_free( siteKey, MPSiteKeySize );
|
||||||
mpw_free_string( siteName );
|
mpw_free_string( siteName );
|
||||||
|
Loading…
Reference in New Issue
Block a user