Changeset View
Changeset View
Standalone View
Standalone View
pam_kwallet.c
Show First 20 Lines • Show All 701 Lines • ▼ Show 20 Line(s) | |||||
702 | 702 | | |||
703 | int kwallet_hash(pam_handle_t *pamh, const char *passphrase, struct passwd *userInfo, char *key) | 703 | int kwallet_hash(pam_handle_t *pamh, const char *passphrase, struct passwd *userInfo, char *key) | ||
704 | { | 704 | { | ||
705 | if (!gcry_check_version("1.5.0")) { | 705 | if (!gcry_check_version("1.5.0")) { | ||
706 | syslog(LOG_ERR, "%s-kwalletd: libcrypt version is too old", logPrefix); | 706 | syslog(LOG_ERR, "%s-kwalletd: libcrypt version is too old", logPrefix); | ||
707 | return 1; | 707 | return 1; | ||
708 | } | 708 | } | ||
709 | 709 | | |||
710 | struct stat info; | ||||
711 | if (stat(userInfo->pw_dir, &info) != 0 || !S_ISDIR(info.st_mode)) { | ||||
712 | syslog(LOG_ERR, "%s-kwalletd: user home folder does not exist", logPrefix); | ||||
713 | return 1; | ||||
fvogt: Missing return? | |||||
714 | } | ||||
715 | | ||||
710 | #ifdef KWALLET5 | 716 | #ifdef KWALLET5 | ||
711 | char *fixpath = "kwalletd/kdewallet.salt"; | 717 | char *fixpath = "kwalletd/kdewallet.salt"; | ||
712 | #else | 718 | #else | ||
713 | char *fixpath = "share/apps/kwallet/kdewallet.salt"; | 719 | char *fixpath = "share/apps/kwallet/kdewallet.salt"; | ||
714 | #endif | 720 | #endif | ||
715 | 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 | ||
716 | char *path = (char*) malloc(pathSize); | 722 | char *path = (char*) malloc(pathSize); | ||
717 | sprintf(path, "%s/%s/%s", userInfo->pw_dir, kdehome, fixpath); | 723 | sprintf(path, "%s/%s/%s", userInfo->pw_dir, kdehome, fixpath); | ||
718 | 724 | | |||
719 | struct stat info; | | |||
720 | char *salt = NULL; | 725 | char *salt = NULL; | ||
721 | if (stat(path, &info) != 0 || info.st_size == 0) { | 726 | if (stat(path, &info) != 0 || info.st_size == 0) { | ||
722 | createNewSalt(pamh, path, userInfo); | 727 | createNewSalt(pamh, path, userInfo); | ||
723 | } | 728 | } | ||
724 | 729 | | |||
725 | FILE *fd = fopen(path, "r"); | 730 | FILE *fd = fopen(path, "r"); | ||
726 | if (fd == NULL) { | 731 | if (fd == NULL) { | ||
727 | syslog(LOG_ERR, "%s: Couldn't open file: %s because: %d-%s", logPrefix, path, errno, strerror(errno)); | 732 | syslog(LOG_ERR, "%s: Couldn't open file: %s because: %d-%s", logPrefix, path, errno, strerror(errno)); | ||
Show All 39 Lines |
Missing return?