author | kergoth <kergoth> | 2003-08-09 17:14:54 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-08-09 17:14:54 (UTC) |
commit | a7e015198a8c5ad3b6e144a9032b059086253e00 (patch) (side-by-side diff) | |
tree | b712b6f11310d88744fe393a92b3160b741a7efe /noncore/settings/networksettings/ppp/runtests.cpp | |
parent | beba0e73306815337bf04dee39502233595e9739 (diff) | |
download | opie-a7e015198a8c5ad3b6e144a9032b059086253e00.zip opie-a7e015198a8c5ad3b6e144a9032b059086253e00.tar.gz opie-a7e015198a8c5ad3b6e144a9032b059086253e00.tar.bz2 |
Merge from BRANCH_1_0
Diffstat (limited to 'noncore/settings/networksettings/ppp/runtests.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/runtests.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/noncore/settings/networksettings/ppp/runtests.cpp b/noncore/settings/networksettings/ppp/runtests.cpp index 83ef2ea..5548601 100644 --- a/noncore/settings/networksettings/ppp/runtests.cpp +++ b/noncore/settings/networksettings/ppp/runtests.cpp @@ -23,50 +23,48 @@ * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <qdir.h> #include "runtests.h" #include <ctype.h> #include <unistd.h> #include <qmessagebox.h> #include <sys/stat.h> #include <stdlib.h> #include <sys/types.h> #include <pwd.h> #include <netinet/in.h> #ifdef HAVE_RESOLV_H #include <arpa/nameser.h> #include <resolv.h> #endif #ifndef _PATH_RESCONF #define _PATH_RESCONF "/etc/resolv.conf" #endif -//#include <klocale.h> -#define i18n QObject::tr #include "pppdata.h" // initial effective uid (main.cpp) extern uid_t euid; // secure pppd location (opener.cpp) extern const char* pppdPath(); // shamelessly stolen from pppd-2.3.5 /******************************************************************** * * Internal routine to decode the version.modification.patch level */ static void decode_version (const char *_buf, int *version, int *modification, int *patch) { char *buffer = qstrdup(_buf); char *buf = buffer; *version = (int) strtoul (buf, &buf, 10); *modification = 0; *patch = 0; if (*buf == '.') @@ -196,84 +194,84 @@ int runTests() { FILE *f; if((f = fopen("/etc/kppp.allow", "r")) != NULL) { char buf[2048]; // safe while(f != NULL && !feof(f)) { if(fgets(buf, sizeof(buf), f) != NULL) { QString s(buf); s = s.stripWhiteSpace(); if(s[0] == '#' || s.length() == 0) continue; if((uid_t)uidFromName(QFile::encodeName(s)) == getuid()) { access = TRUE; fclose(f); f = NULL; } } } if(f) fclose(f); } if(!access) { QMessageBox::warning(0,"error", - i18n("You're not allowed to dial out with " + QObject::tr("You're not allowed to dial out with " "kppp.\nContact your system administrator.")); return TEST_CRITICAL; } } // Test 1: search the pppd binary const char *f = pppdPath(); if(!f) { QMessageBox::warning(0,"error", - i18n("Cannot find the PPP daemon!\n" + QObject::tr("Cannot find the PPP daemon!\n" "Make sure that pppd is installed.")); warning++; } // Test 2: check access to the pppd binary if(f) { #if 0 if(access(f, X_OK) != 0 /* && geteuid() != 0 */) { KMessageBox::warning(0, - i18n("You do not have the permission " + QObject::tr("You do not have the permission " "to start pppd!\n" "Contact your system administrator " "and ask to get access to pppd.")); return TEST_CRITICAL; } #endif if(geteuid() != 0) { struct stat st; stat(f, &st); if(st.st_uid != 0 || (st.st_mode & S_ISUID) == 0) { QMessageBox::warning(0,"error", - i18n("You don't have sufficient permission to run\n" + QObject::tr("You don't have sufficient permission to run\n" "%1\n" "Please make sure that kppp is owned by root " "and has the SUID bit set.").arg(f)); warning++; } } } // Test 5: check for existence of /etc/resolv.conf if (access(_PATH_RESCONF, R_OK) != 0) { QString file = _PATH_RESCONF" "; - QString msgstr = i18n("%1 is missing or can't be read!\n" + QString msgstr = QObject::tr("%1 is missing or can't be read!\n" "Ask your system administrator to create " "this file (can be empty) with appropriate " "read and write permissions.").arg(file); QMessageBox::warning(0, "errror", msgstr); warning ++; } if(warning == 0) return TEST_OK; else return TEST_WARNING; } |