launch_daemon: We can now talk to the authentication manager.
* When creating the port of the registrar's authentication manager, we now set it manually, so that the user/group functions work. * This allows LaunchDaemon::_StartSession() to set up the user, and groups as needed.
This commit is contained in:
@@ -89,6 +89,7 @@ public:
|
||||
|
||||
|
||||
port_id get_registrar_authentication_port();
|
||||
void set_registrar_authentication_port(port_id port);
|
||||
status_t send_authentication_request_to_registrar(KMessage& request,
|
||||
KMessage& reply);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
SubDir HAIKU_TOP src servers launch ;
|
||||
|
||||
UsePrivateHeaders app package shared storage support ;
|
||||
UsePrivateHeaders app libroot shared storage support ;
|
||||
UsePrivateSystemHeaders ;
|
||||
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src bin multiuser ] ;
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <Message.h>
|
||||
#include <Roster.h>
|
||||
|
||||
#include <user_group.h>
|
||||
|
||||
#include "Target.h"
|
||||
|
||||
|
||||
@@ -241,6 +243,11 @@ Job::Init(const Finder& finder, std::set<BString>& dependencies)
|
||||
break;
|
||||
}
|
||||
iterator->second.SetInt32("port", port);
|
||||
|
||||
if (name == "x-vnd.haiku-registrar:auth") {
|
||||
// Allow the launch_daemon to access the registrar authentication
|
||||
BPrivate::set_registrar_authentication_port(port);
|
||||
}
|
||||
}
|
||||
|
||||
if (fInitStatus == B_OK && fCreateDefaultPort && !defaultPort) {
|
||||
|
||||
@@ -702,7 +702,7 @@ LaunchDaemon::_StartSession(const char* login)
|
||||
{
|
||||
// TODO: enable user/group code
|
||||
// The launch_daemon currently cannot talk to the registrar, though
|
||||
/*
|
||||
|
||||
struct passwd* passwd = getpwnam(login);
|
||||
if (passwd == NULL)
|
||||
return B_NAME_NOT_FOUND;
|
||||
@@ -712,7 +712,6 @@ LaunchDaemon::_StartSession(const char* login)
|
||||
// Check if there is a user session running already
|
||||
uid_t user = passwd->pw_uid;
|
||||
gid_t group = passwd->pw_gid;
|
||||
*/
|
||||
|
||||
Unlock();
|
||||
|
||||
@@ -720,22 +719,12 @@ LaunchDaemon::_StartSession(const char* login)
|
||||
if (setsid() < 0)
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
/*
|
||||
debug_printf("session leader...\n");
|
||||
if (initgroups(login, group) == -1) {
|
||||
debug_printf("1.ouch: %s\n", strerror(errno));
|
||||
if (initgroups(login, group) == -1)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
//endgrent();
|
||||
if (setgid(group) != 0) {
|
||||
debug_printf("2.ouch: %s\n", strerror(errno));
|
||||
if (setgid(group) != 0)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (setuid(user) != 0) {
|
||||
debug_printf("3.ouch: %s\n", strerror(errno));
|
||||
if (setuid(user) != 0)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
*/
|
||||
|
||||
// TODO: This leaks the parent application
|
||||
be_app = NULL;
|
||||
|
||||
@@ -67,6 +67,13 @@ BPrivate::get_registrar_authentication_port()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BPrivate::set_registrar_authentication_port(port_id port)
|
||||
{
|
||||
sRegistrarPort = port;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BPrivate::send_authentication_request_to_registrar(KMessage& request,
|
||||
KMessage& reply)
|
||||
|
||||
Reference in New Issue
Block a user