summaryrefslogtreecommitdiff
path: root/noncore/apps/zsafe/zsafe.cpp
Unidiff
Diffstat (limited to 'noncore/apps/zsafe/zsafe.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/zsafe/zsafe.cpp45
1 files changed, 23 insertions, 22 deletions
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index f70f863..9c0c6ce 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -1774,4 +1774,6 @@ int ZSafe::loadInit(const char* _filename, const char *password)
1774 1774
1775 if (fd == NULL) 1775 if (fd == NULL) {
1776 delete krc2;
1776 return PWERR_OPEN; 1777 return PWERR_OPEN;
1778 }
1777 1779
@@ -1790,4 +1792,6 @@ int ZSafe::loadInit(const char* _filename, const char *password)
1790 1792
1791 if (size < 8) 1793 if (size < 8) {
1794 delete krc2;
1792 return PWERR_DATA; 1795 return PWERR_DATA;
1796 }
1793 1797
@@ -1811,2 +1815,3 @@ int ZSafe::loadInit(const char* _filename, const char *password)
1811 if (count2 == 0) { 1815 if (count2 == 0) {
1816 delete krc2;
1812 return PWERR_DATA; 1817 return PWERR_DATA;
@@ -1831,2 +1836,3 @@ int ZSafe::loadInit(const char* _filename, const char *password)
1831 } /* while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) */ 1836 } /* while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) */
1837 delete krc2;
1832 size -= buffer[size - 1]; 1838 size -= buffer[size - 1];
@@ -2101,17 +2107,2 @@ int ZSafe::saveInit(const char *_filename, const char *password)
2101 2107
2102 /* first we should check the permissions of the filename */
2103/*
2104 if (QFile::exists(_filename)) {
2105 val = checkFile(_filename);
2106 if (val != PWERR_GOOD)
2107 return val;
2108 } else
2109 {
2110 val = creat (_filename, (S_IRUSR | S_IWUSR));
2111 if (val == -1)
2112 return PWERR_OPEN;
2113 else
2114 close(val);
2115 }
2116*/
2117 QFileInfo f (_filename); 2108 QFileInfo f (_filename);
@@ -2121,4 +2112,6 @@ int ZSafe::saveInit(const char *_filename, const char *password)
2121 fd = fopen (_filename, "wb"); 2112 fd = fopen (_filename, "wb");
2122 if (fd == NULL) 2113 if (fd == NULL) {
2114 delete krc2;
2123 return PWERR_OPEN; 2115 return PWERR_OPEN;
2116 }
2124 2117
@@ -2132,2 +2125,3 @@ int ZSafe::saveInit(const char *_filename, const char *password)
2132 krc2->rc2_expandkey (key, keylength, 128); 2125 krc2->rc2_expandkey (key, keylength, 128);
2126 delete krc2;
2133 2127
@@ -2190,4 +2184,10 @@ int ZSafe::saveEntry(char *entry[FIELD_SIZE])
2190 bufferIndex = 0; 2184 bufferIndex = 0;
2191 if (putc ((unsigned char) (ciphertext[count3] >> 8), fd) == EOF) return PWERR_DATA; 2185 if (putc ((unsigned char) (ciphertext[count3] >> 8), fd) == EOF) {
2192 if (putc ((unsigned char) (ciphertext[count3] & 0xff), fd) == EOF) return PWERR_DATA; 2186 delete krc2;
2187 return PWERR_DATA;
2188 }
2189 if (putc ((unsigned char) (ciphertext[count3] & 0xff), fd) == EOF) {
2190 delete krc2;
2191 return PWERR_DATA;
2192 }
2193 } /*for (count3 = 0; count3 < 5; count3++)*/ 2193 } /*for (count3 = 0; count3 < 5; count3++)*/
@@ -2197,4 +2197,4 @@ int ZSafe::saveEntry(char *entry[FIELD_SIZE])
2197 } /*while (count2 < strlen (buffer))*/ 2197 } /*while (count2 < strlen (buffer))*/
2198 int ret = PWERR_GOOD; 2198 delete krc2;
2199 return ret; 2199 return PWERR_GOOD;
2200} 2200}
@@ -2230,2 +2230,3 @@ int ZSafe::saveFinalize(void)
2230 free(buffer); 2230 free(buffer);
2231 delete krc2;
2231 return retval; 2232 return retval;