Репозитории ALT
5.1: | 3.5.10-alt4 |
4.1: | 3.5.10-alt2.M41.1 |
4.0: | 3.5.9-alt0.M40.1 |
3.0: | 3.4.1-alt4 |
+backports: | 3.5.6-alt2.0.M30 |
Группа :: Графические оболочки/KDE
Пакет: kdenetwork
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: kdenetwork-3.5.4-lisa_drop_privileges.patch
Скачать
Скачать
diff -uNr kdenetwork-3.5.4~/lanbrowsing/lisa/main.cpp kdenetwork-3.5.4/lanbrowsing/lisa/main.cpp
--- kdenetwork-3.5.4/lanbrowsing/lisa/main.cpp~ 2006-07-22 12:11:31 +0400
+++ kdenetwork-3.5.4/lanbrowsing/lisa/main.cpp 2006-09-01 18:45:33 +0400
@@ -34,6 +34,7 @@
#include <sys/stat.h>
#include <sys/socket.h>
#include <netinet/in.h>
+#include <pwd.h>
// detect linux/glibc for the gnu style --args
#if defined(__linux__) || defined(__linux) || defined(linux)
@@ -259,15 +260,21 @@ int main(int argc, char** argv)
//now dropping root privileges once and ever
- setuid(getuid());
- if (geteuid() != getuid())
- _exit(255);
+ struct passwd *pwnam = getpwnam("_kdelisa");
+ if (pwnam)
+ {
+ setuid(pwnam->pw_uid);
+ }
+ else
+ {
+ std::cerr << "User _kdelisa not found." << std::endl;
+ exit(1);
+ }
//according to R. Stevens the following three lines
//make daemons feel good :)
setsid();
chdir("/");
- umask(0);
dcerr<<"starting, dropped root privileges"<<std::endl;
dcerr<<"port: "<<portToUse<<" file: "<<configFile<<std::endl;
diff -uNr kdenetwork-3.5.4~/lanbrowsing/lisa/strictmain.cpp kdenetwork-3.5.4/lanbrowsing/lisa/strictmain.cpp
--- kdenetwork-3.5.4/lanbrowsing/lisa/strictmain.cpp~ 2005-09-10 12:20:14 +0400
+++ kdenetwork-3.5.4/lanbrowsing/lisa/strictmain.cpp 2006-09-01 18:42:59 +0400
@@ -23,6 +23,7 @@
#include <sys/stat.h>
#include <sys/socket.h>
#include <netinet/in.h>
+#include <pwd.h>
// detect linux/glibc for the gnu style --args
#if defined(__linux__) || defined(__linux) || defined(linux)
@@ -235,13 +236,21 @@ int main(int argc, char** argv)
//for creating a raw socket
//now dropping root privileges once and ever
- setuid(getuid());
+ struct passwd *pwnam = getpwnam("_kdelisa");
+ if (pwnam)
+ {
+ setuid(pwnam->pw_uid);
+ }
+ else
+ {
+ std::cerr << "User _kdelisa not found." << std::endl;
+ exit(1);
+ }
//according to R. Stevens the following three lines
//make daemons feel good :)
setsid();
chdir("/");
- umask(0);
dcerr<<"starting, dropped root privileges"<<std::endl;
dcerr<<"port: "<<portToUse<<" file: "<<configFile<<std::endl;