Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37884943
en ru br
Репозитории 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
www.altlinux.org/Changes

Группа :: Графические оболочки/KDE
Пакет: kdenetwork

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: kdenetwork-3.1.4-lisa_drop_privileges.patch
Скачать


diff -uNr kdenetwork-3.1.4~/lanbrowsing/lisa/main.cpp kdenetwork-3.1.4/lanbrowsing/lisa/main.cpp
--- kdenetwork-3.1.4~/lanbrowsing/lisa/main.cpp	2003-05-21 16:24:22 +0400
+++ kdenetwork-3.1.4/lanbrowsing/lisa/main.cpp	2003-11-04 14:00:54 +0300
@@ -24,6 +24,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)
@@ -248,13 +249,21 @@
    //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);
    
    getDebug()<<"main starting, dropped root privileges"<<std::endl;
    getDebug()<<"main(): port: "<<portToUse<<" file: "<<configFile<<std::endl;
diff -uNr kdenetwork-3.1.4~/lanbrowsing/lisa/strictmain.cpp kdenetwork-3.1.4/lanbrowsing/lisa/strictmain.cpp
--- kdenetwork-3.1.4~/lanbrowsing/lisa/strictmain.cpp	2003-05-21 16:27:37 +0400
+++ kdenetwork-3.1.4/lanbrowsing/lisa/strictmain.cpp	2003-11-04 14:01:54 +0300
@@ -25,6 +25,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)
@@ -228,13 +229,21 @@
    //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);
    
    getDebug()<<"main starting, dropped root privileges"<<std::endl;
    getDebug()<<"main(): port: "<<portToUse<<" file: "<<configFile<<std::endl;
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin