Changeset View
Changeset View
Standalone View
Standalone View
pam_kwallet.c
Show First 20 Lines • Show All 717 Lines • ▼ Show 20 Line(s) | |||||
718 | #else | 718 | #else | ||
719 | char *fixpath = "share/apps/kwallet/kdewallet.salt"; | 719 | char *fixpath = "share/apps/kwallet/kdewallet.salt"; | ||
720 | #endif | 720 | #endif | ||
721 | size_t pathSize = strlen(userInfo->pw_dir) + strlen(kdehome) + strlen(fixpath) + 3;//3 == /, / and \0 | 721 | size_t pathSize = strlen(userInfo->pw_dir) + strlen(kdehome) + strlen(fixpath) + 3;//3 == /, / and \0 | ||
722 | char *path = (char*) malloc(pathSize); | 722 | char *path = (char*) malloc(pathSize); | ||
723 | sprintf(path, "%s/%s/%s", userInfo->pw_dir, kdehome, fixpath); | 723 | sprintf(path, "%s/%s/%s", userInfo->pw_dir, kdehome, fixpath); | ||
724 | 724 | | |||
725 | char *salt = NULL; | 725 | char *salt = NULL; | ||
726 | if (stat(path, &info) != 0 || info.st_size == 0) { | 726 | if (stat(path, &info) != 0 || info.st_size == 0 || !S_ISREG(info.st_mode)) { | ||
727 | createNewSalt(pamh, path, userInfo); | 727 | createNewSalt(pamh, path, userInfo); | ||
728 | } | 728 | } | ||
729 | 729 | | |||
730 | if (stat(path, &info) != 0 || info.st_size == 0 || !S_ISREG(info.st_mode)) { | ||||
731 | syslog(LOG_ERR, "%s: Failed to ensure %s looks like a salt file", logPrefix, path); | ||||
732 | free(path); | ||||
fvogt: Missing `free(path);` | |||||
733 | return 1; | ||||
734 | } | ||||
735 | | ||||
730 | FILE *fd = fopen(path, "r"); | 736 | FILE *fd = fopen(path, "r"); | ||
731 | if (fd == NULL) { | 737 | if (fd == NULL) { | ||
732 | syslog(LOG_ERR, "%s: Couldn't open file: %s because: %d-%s", logPrefix, path, errno, strerror(errno)); | 738 | syslog(LOG_ERR, "%s: Couldn't open file: %s because: %d-%s", logPrefix, path, errno, strerror(errno)); | ||
733 | free(path); | 739 | free(path); | ||
734 | return 1; | 740 | return 1; | ||
735 | } | 741 | } | ||
736 | salt = (char*) malloc(KWALLET_PAM_SALTSIZE); | 742 | salt = (char*) malloc(KWALLET_PAM_SALTSIZE); | ||
737 | memset(salt, '\0', KWALLET_PAM_SALTSIZE); | 743 | memset(salt, '\0', KWALLET_PAM_SALTSIZE); | ||
Show All 34 Lines |
Missing free(path);