summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-23 17:05:41 (UTC)
committer zautrix <zautrix>2004-10-23 17:05:41 (UTC)
commit13d274c37baaae48a1c93081077cf3035459c6a8 (patch) (unidiff)
treecf49d1c5bec1fb4cd8bbd7fc9a007304634676a8
parentfbdad188bd7048148cc60c90325efcccb0417060 (diff)
downloadkdepimpi-13d274c37baaae48a1c93081077cf3035459c6a8.zip
kdepimpi-13d274c37baaae48a1c93081077cf3035459c6a8.tar.gz
kdepimpi-13d274c37baaae48a1c93081077cf3035459c6a8.tar.bz2
made pwm compile on windows. now the cryptolibs are still missing
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/blowfish.h11
-rw-r--r--pwmanager/pwmanager/gpasmanfile.cpp16
-rw-r--r--pwmanager/pwmanager/htmlgen.cpp2
-rw-r--r--pwmanager/pwmanager/ipc.cpp7
-rw-r--r--pwmanager/pwmanager/ipc.h5
-rw-r--r--pwmanager/pwmanager/libgcryptif.h7
-rw-r--r--pwmanager/pwmanager/pwm.cpp1
-rw-r--r--pwmanager/pwmanager/pwmanager.pro2
-rw-r--r--pwmanager/pwmanager/pwmdoc.cpp9
-rw-r--r--pwmanager/pwmanager/spinforsignal.h2
10 files changed, 50 insertions, 12 deletions
diff --git a/pwmanager/pwmanager/blowfish.h b/pwmanager/pwmanager/blowfish.h
index c05de77..5129eab 100644
--- a/pwmanager/pwmanager/blowfish.h
+++ b/pwmanager/pwmanager/blowfish.h
@@ -21,22 +21,31 @@
21 **************************************************************************/ 21 **************************************************************************/
22 22
23#ifndef BLOWFISH_H 23#ifndef BLOWFISH_H
24#define BLOWFISH_H 24#define BLOWFISH_H
25 25
26#include "pwmexception.h" 26#include "pwmexception.h"
27 27#ifndef _WIN32_
28#include <stdint.h> 28#include <stdint.h>
29#else
30
31#endif
29#include <string> 32#include <string>
30using std::string; 33using std::string;
31 34
32 #define BLOWFISH_BLOCKSIZE8 35 #define BLOWFISH_BLOCKSIZE8
33 #define BLOWFISH_ROUNDS 16 36 #define BLOWFISH_ROUNDS 16
34 #define CIPHER_ALGO_BLOWFISH 4/* blowfish 128 bit key */ 37 #define CIPHER_ALGO_BLOWFISH 4/* blowfish 128 bit key */
35 38
39#ifndef _WIN32_
36 typedef uint8_t byte; 40 typedef uint8_t byte;
41#else
42#define uint8_t Q_UINT8
43#define byte Q_UINT8
44#define uint32_t Q_UINT32
45#endif
37 46
38/** blowfish encryption algorithm. 47/** blowfish encryption algorithm.
39 * Derived from libgcrypt-1.1.12 48 * Derived from libgcrypt-1.1.12
40 */ 49 */
41class Blowfish 50class Blowfish
42{ 51{
diff --git a/pwmanager/pwmanager/gpasmanfile.cpp b/pwmanager/pwmanager/gpasmanfile.cpp
index f80bc13..ae34c83 100644
--- a/pwmanager/pwmanager/gpasmanfile.cpp
+++ b/pwmanager/pwmanager/gpasmanfile.cpp
@@ -41,13 +41,20 @@
41 41
42#include <sys/types.h> 42#include <sys/types.h>
43#include <sys/stat.h> 43#include <sys/stat.h>
44#include <stdio.h> 44#include <stdio.h>
45#include <fcntl.h> 45#include <fcntl.h>
46#include <stdlib.h> 46#include <stdlib.h>
47#ifndef _WIN32_
47#include <unistd.h> 48#include <unistd.h>
49#else
50#include <io.h>
51#define S_IRUSR _S_IREAD
52#define S_IWUSR _S_IWRITE
53#define creat _creat
54#endif
48#include <string.h> 55#include <string.h>
49#include <errno.h> 56#include <errno.h>
50 57
51#include "gpasmanfile.h" 58#include "gpasmanfile.h"
52#include "globalstuff.h" 59#include "globalstuff.h"
53 60
@@ -59,18 +66,21 @@
59#endif 66#endif
60 67
61// enable/disable debug output 68// enable/disable debug output
62//#define GPASMANFILE_DEBUG 69//#define GPASMANFILE_DEBUG
63#undef GPASMANFILE_DEBUG 70#undef GPASMANFILE_DEBUG
64 71
65 72#ifndef _WIN32_
66#if defined(PWM_DEBUG) && defined(GPASMANFILE_DEBUG) 73#if defined(PWM_DEBUG) && defined(GPASMANFILE_DEBUG)
67 # define DBG(msg,x...)do { fprintf(stderr, msg "\n" , ##x); } while (0) 74 # define DBG(msg,x...)do { fprintf(stderr, msg "\n" , ##x); } while (0)
68#else 75#else
69 # define DBG(msg,x...)do { } while (0) 76 # define DBG(msg,x...)do { } while (0)
70#endif 77#endif
78#else
79# define DBG
80#endif
71 81
72#ifdef BIG_ENDIAN_HOST 82#ifdef BIG_ENDIAN_HOST
73# define WORDS_BIGENDIAN 83# define WORDS_BIGENDIAN
74#else 84#else
75# undef WORDS_BIGENDIAN 85# undef WORDS_BIGENDIAN
76#endif 86#endif
@@ -407,21 +417,21 @@ int GpasmanFile::check_file(const char *filename)
407 if (((naamstat.st_mode & S_IAMB) | (S_IRUSR | S_IWUSR)) != (S_IRUSR | 417 if (((naamstat.st_mode & S_IAMB) | (S_IRUSR | S_IWUSR)) != (S_IRUSR |
408 S_IWUSR)) { 418 S_IWUSR)) {
409 DBG("%s perms are bad, they are: %ld, should be -rw------", 419 DBG("%s perms are bad, they are: %ld, should be -rw------",
410 filename, (naamstat.st_mode & (S_IREAD | S_IWRITE))); 420 filename, (naamstat.st_mode & (S_IREAD | S_IWRITE)));
411 return (-1); 421 return (-1);
412 } 422 }
413 423#ifndef _WIN32_
414 if (!S_ISREG(naamstat.st_mode)) { 424 if (!S_ISREG(naamstat.st_mode)) {
415 lstat(filename, &naamstat); 425 lstat(filename, &naamstat);
416 if (S_ISLNK(naamstat.st_mode)) { 426 if (S_ISLNK(naamstat.st_mode)) {
417 DBG("%s is a symlink", filename); 427 DBG("%s is a symlink", filename);
418 return (-2); 428 return (-2);
419 } 429 }
420 } 430 }
421 431#endif
422 return (1); 432 return (1);
423} 433}
424 434
425int GpasmanFile::file_exists(const char *tfile) 435int GpasmanFile::file_exists(const char *tfile)
426{ 436{
427 struct stat naamstat; 437 struct stat naamstat;
diff --git a/pwmanager/pwmanager/htmlgen.cpp b/pwmanager/pwmanager/htmlgen.cpp
index 166b987..bee8198 100644
--- a/pwmanager/pwmanager/htmlgen.cpp
+++ b/pwmanager/pwmanager/htmlgen.cpp
@@ -57,13 +57,13 @@ HtmlGen::~HtmlGen()
57QString HtmlGen::escapeHtmlText(const QString &str) 57QString HtmlGen::escapeHtmlText(const QString &str)
58{ 58{
59 QString ret; 59 QString ret;
60 unsigned int len = str.length(), i; 60 unsigned int len = str.length(), i;
61 char c; 61 char c;
62 for (i = 0; i < len; ++i) { 62 for (i = 0; i < len; ++i) {
63 c = str[i]; 63 c = str.at(i);
64 switch (c) { 64 switch (c) {
65 case '<': 65 case '<':
66 ret.append("&lt;"); 66 ret.append("&lt;");
67 break; 67 break;
68 case '>': 68 case '>':
69 ret.append("&gt;"); 69 ret.append("&gt;");
diff --git a/pwmanager/pwmanager/ipc.cpp b/pwmanager/pwmanager/ipc.cpp
index b1d2c68..643b022 100644
--- a/pwmanager/pwmanager/ipc.cpp
+++ b/pwmanager/pwmanager/ipc.cpp
@@ -18,15 +18,15 @@
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#include "ipc.h" 20#include "ipc.h"
21#include "pwmexception.h" 21#include "pwmexception.h"
22 22
23#include <qsocketnotifier.h> 23#include <qsocketnotifier.h>
24 24#ifndef _WIN32_
25#include <sys/socket.h> 25#include <sys/socket.h>
26 26#endif
27#ifndef PWM_EMBEDDED 27#ifndef PWM_EMBEDDED
28#include <sys/types.h> 28#include <sys/types.h>
29#include <stdio.h> 29#include <stdio.h>
30#else 30#else
31#include <qsocket.h> 31#include <qsocket.h>
32#endif 32#endif
@@ -69,16 +69,17 @@ Ipc::Ipc()
69} 69}
70#else 70#else
71Ipc::Ipc() 71Ipc::Ipc()
72 : notifier (0) 72 : notifier (0)
73 , rdBuf (0) 73 , rdBuf (0)
74{ 74{
75#ifndef _WIN32_
75 if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sock)) { 76 if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sock)) {
76 qDebug("Ipc: socketpair() failed"); 77 qDebug("Ipc: socketpair() failed");
77 } 78 }
78 79#endif
79 QSocket* qsock = new QSocket(); 80 QSocket* qsock = new QSocket();
80 qsock->setSocket(sock[0]); 81 qsock->setSocket(sock[0]);
81 82
82 rdBufSize = INIT_LINEBUF_LEN; 83 rdBufSize = INIT_LINEBUF_LEN;
83 rdBuf = (char *)(malloc(rdBufSize)); 84 rdBuf = (char *)(malloc(rdBufSize));
84 if (!rdBuf) { 85 if (!rdBuf) {
diff --git a/pwmanager/pwmanager/ipc.h b/pwmanager/pwmanager/ipc.h
index e5a496d..7bfca02 100644
--- a/pwmanager/pwmanager/ipc.h
+++ b/pwmanager/pwmanager/ipc.h
@@ -18,14 +18,17 @@
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#ifndef __PWM_IPC_H 20#ifndef __PWM_IPC_H
21#define __PWM_IPC_H 21#define __PWM_IPC_H
22 22
23#include <qobject.h> 23#include <qobject.h>
24#ifndef _WIN32_
24#include <unistd.h> 25#include <unistd.h>
25 26#else
27#include <io.h>
28#endif
26#ifndef PWM_EMBEDDED 29#ifndef PWM_EMBEDDED
27#include <stdio.h> 30#include <stdio.h>
28#else 31#else
29#include <qsocket.h> 32#include <qsocket.h>
30#endif 33#endif
31 34
diff --git a/pwmanager/pwmanager/libgcryptif.h b/pwmanager/pwmanager/libgcryptif.h
index dffd55b..1a7b658 100644
--- a/pwmanager/pwmanager/libgcryptif.h
+++ b/pwmanager/pwmanager/libgcryptif.h
@@ -28,14 +28,19 @@
28 28
29//#undef CONFIG_PWMANAGER_GCRY // for debugging only. 29//#undef CONFIG_PWMANAGER_GCRY // for debugging only.
30#ifdef CONFIG_PWMANAGER_GCRY 30#ifdef CONFIG_PWMANAGER_GCRY
31 31
32#include <stddef.h> 32#include <stddef.h>
33#include <sys/types.h> 33#include <sys/types.h>
34#ifndef _WIN32_
34#include <stdint.h> 35#include <stdint.h>
35 36#else
37#define uint8_t Q_UINT8
38#define byte Q_UINT8
39#define uint32_t Q_UINT32
40#endif
36 #define STRING2KEY_SALTLEN8 41 #define STRING2KEY_SALTLEN8
37 42
38/** interface class for the libgcrypt cipher and hash algorithms 43/** interface class for the libgcrypt cipher and hash algorithms
39 * NOTE: Always allocate 1024 extra bytes for the inBuf (for padding) 44 * NOTE: Always allocate 1024 extra bytes for the inBuf (for padding)
40 */ 45 */
41class LibGCryptIf 46class LibGCryptIf
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp
index d92c90d..1ab2b71 100644
--- a/pwmanager/pwmanager/pwm.cpp
+++ b/pwmanager/pwmanager/pwm.cpp
@@ -1407,12 +1407,13 @@ void PwM::syncHowTo_slot()
1407 1407
1408 1408
1409void PwM::createAboutData_slot() 1409void PwM::createAboutData_slot()
1410{ 1410{
1411 QString version; 1411 QString version;
1412#include <../version> 1412#include <../version>
1413;
1413 QMessageBox::about( this, "About PwManager/Pi", 1414 QMessageBox::about( this, "About PwManager/Pi",
1414 "PwManager/Platform-independent\n" 1415 "PwManager/Platform-independent\n"
1415 "(PWM/Pi) " +version + " - " + 1416 "(PWM/Pi) " +version + " - " +
1416#ifdef DESKTOP_VERSION 1417#ifdef DESKTOP_VERSION
1417 "Desktop Edition\n" 1418 "Desktop Edition\n"
1418#else 1419#else
diff --git a/pwmanager/pwmanager/pwmanager.pro b/pwmanager/pwmanager/pwmanager.pro
index 80b2519..fbc0554 100644
--- a/pwmanager/pwmanager/pwmanager.pro
+++ b/pwmanager/pwmanager/pwmanager.pro
@@ -1,13 +1,13 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG += qt warn_off 2 CONFIG += qt warn_off
3DESTDIR= ../../bin 3DESTDIR= ../../bin
4 TARGET = pwmpi 4 TARGET = pwmpi
5include( ../../variables.pri ) 5include( ../../variables.pri )
6 6
7INCLUDEPATH += . ../../ ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils 7INCLUDEPATH += . ../../ ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils ../libcrypt/crypt ../libcrypt/error ../libcrypt/zlib
8DEFINES += PWM_EMBEDDED CONFIG_PWMANAGER_GCRY DESKTOP_VERSION 8DEFINES += PWM_EMBEDDED CONFIG_PWMANAGER_GCRY DESKTOP_VERSION
9 9
10#enable this setting if you want debugoutput for pwmanager 10#enable this setting if you want debugoutput for pwmanager
11#DEFINES += CONFIG_DEBUG 11#DEFINES += CONFIG_DEBUG
12LIBS += -L../libcrypt/ 12LIBS += -L../libcrypt/
13LIBS += -L../../bin/ 13LIBS += -L../../bin/
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp
index 86b6273..129bf7b 100644
--- a/pwmanager/pwmanager/pwmdoc.cpp
+++ b/pwmanager/pwmanager/pwmdoc.cpp
@@ -52,15 +52,16 @@
52#include <errno.h> 52#include <errno.h>
53#include <string.h> 53#include <string.h>
54//US#include <iostream> 54//US#include <iostream>
55#include <algorithm> 55#include <algorithm>
56#include <sys/types.h> 56#include <sys/types.h>
57#include <sys/stat.h> 57#include <sys/stat.h>
58#ifndef _WIN32_
58#include <unistd.h> 59#include <unistd.h>
59#include <stdint.h> 60#include <stdint.h>
60 61#endif
61 62
62#ifdef PWM_EMBEDDED 63#ifdef PWM_EMBEDDED
63#ifndef Q_LONG 64#ifndef Q_LONG
64#define Q_LONG long 65#define Q_LONG long
65#endif 66#endif
66 67
@@ -502,16 +503,18 @@ PwMerror PwMDoc::saveDoc(char compress, const QString *file)
502 f.close(); 503 f.close();
503 ret = e_enc; 504 ret = e_enc;
504 goto out_moveback; 505 goto out_moveback;
505 } 506 }
506 unsetDocStatFlag(DOC_STAT_DISK_DIRTY); 507 unsetDocStatFlag(DOC_STAT_DISK_DIRTY);
507 f.close(); 508 f.close();
509#ifndef _WIN32_
508 if (chmod(filename.latin1(), 510 if (chmod(filename.latin1(),
509 conf()->confGlobFilePermissions())) { 511 conf()->confGlobFilePermissions())) {
510 printWarn(string("chmod failed: ") + strerror(errno)); 512 printWarn(string("chmod failed: ") + strerror(errno));
511 } 513 }
514#endif
512 openDocList.edit(this, getTitle().latin1()); 515 openDocList.edit(this, getTitle().latin1());
513 if (wasDeepLocked) { 516 if (wasDeepLocked) {
514 /* Do _not_ save the data with the deepLock() 517 /* Do _not_ save the data with the deepLock()
515 * call, because this will recurse 518 * call, because this will recurse
516 * into saveDoc() 519 * into saveDoc()
517 */ 520 */
@@ -2215,16 +2218,18 @@ bool PwMDoc::execLauncher(const QString &category, unsigned int entryIndex)
2215 2218
2216 return execLauncher(cat, entryIndex); 2219 return execLauncher(cat, entryIndex);
2217} 2220}
2218 2221
2219bool PwMDoc::execLauncher(unsigned int category, unsigned int entryIndex) 2222bool PwMDoc::execLauncher(unsigned int category, unsigned int entryIndex)
2220{ 2223{
2224#ifndef _WIN32_
2221 if (geteuid() == 0) { 2225 if (geteuid() == 0) {
2222 rootAlertMsgBox(); 2226 rootAlertMsgBox();
2223 return false; 2227 return false;
2224 } 2228 }
2229#endif
2225 QString command(dti.dta[category].d[entryIndex].launcher.c_str()); 2230 QString command(dti.dta[category].d[entryIndex].launcher.c_str());
2226 bool wasLocked = isLocked(category, entryIndex); 2231 bool wasLocked = isLocked(category, entryIndex);
2227 2232
2228 if (command.find("$p") != -1) { 2233 if (command.find("$p") != -1) {
2229 /* the user requested the password to be included 2234 /* the user requested the password to be included
2230 * into the command. We have to ask for the password, 2235 * into the command. We have to ask for the password,
@@ -2267,16 +2272,18 @@ bool PwMDoc::goToURL(const QString &category, unsigned int entryIndex)
2267 2272
2268 return goToURL(cat, entryIndex); 2273 return goToURL(cat, entryIndex);
2269} 2274}
2270 2275
2271bool PwMDoc::goToURL(unsigned int category, unsigned int entryIndex) 2276bool PwMDoc::goToURL(unsigned int category, unsigned int entryIndex)
2272{ 2277{
2278#ifndef _WIN32_
2273 if (geteuid() == 0) { 2279 if (geteuid() == 0) {
2274 rootAlertMsgBox(); 2280 rootAlertMsgBox();
2275 return false; 2281 return false;
2276 } 2282 }
2283#endif
2277 QString url(dti.dta[category].d[entryIndex].url.c_str()); 2284 QString url(dti.dta[category].d[entryIndex].url.c_str());
2278 if (url.isEmpty()) 2285 if (url.isEmpty())
2279 return false; 2286 return false;
2280 2287
2281 QString customBrowser(conf()->confGlobBrowserCommand()); 2288 QString customBrowser(conf()->confGlobBrowserCommand());
2282 if (!customBrowser.isEmpty()) { 2289 if (!customBrowser.isEmpty()) {
diff --git a/pwmanager/pwmanager/spinforsignal.h b/pwmanager/pwmanager/spinforsignal.h
index ec6103b..f3cabee 100644
--- a/pwmanager/pwmanager/spinforsignal.h
+++ b/pwmanager/pwmanager/spinforsignal.h
@@ -19,13 +19,15 @@
19 19
20#ifndef SPINFORSIGNAL_H 20#ifndef SPINFORSIGNAL_H
21#define SPINFORSIGNAL_H 21#define SPINFORSIGNAL_H
22 22
23#include <qobject.h> 23#include <qobject.h>
24 24
25#ifndef _WIN32_
25#include <stdint.h> 26#include <stdint.h>
27#endif
26#include <string> 28#include <string>
27using std::string; 29using std::string;
28 30
29/** non-ui-blocking spin for a QT-signal */ 31/** non-ui-blocking spin for a QT-signal */
30class SpinForSignal : public QObject 32class SpinForSignal : public QObject
31{ 33{