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();
|
port_id get_registrar_authentication_port();
|
||||||
|
void set_registrar_authentication_port(port_id port);
|
||||||
status_t send_authentication_request_to_registrar(KMessage& request,
|
status_t send_authentication_request_to_registrar(KMessage& request,
|
||||||
KMessage& reply);
|
KMessage& reply);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
SubDir HAIKU_TOP src servers launch ;
|
SubDir HAIKU_TOP src servers launch ;
|
||||||
|
|
||||||
UsePrivateHeaders app package shared storage support ;
|
UsePrivateHeaders app libroot shared storage support ;
|
||||||
UsePrivateSystemHeaders ;
|
UsePrivateSystemHeaders ;
|
||||||
|
|
||||||
UseHeaders [ FDirName $(HAIKU_TOP) src bin multiuser ] ;
|
UseHeaders [ FDirName $(HAIKU_TOP) src bin multiuser ] ;
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
|
|
||||||
|
#include <user_group.h>
|
||||||
|
|
||||||
#include "Target.h"
|
#include "Target.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -241,6 +243,11 @@ Job::Init(const Finder& finder, std::set<BString>& dependencies)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
iterator->second.SetInt32("port", port);
|
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) {
|
if (fInitStatus == B_OK && fCreateDefaultPort && !defaultPort) {
|
||||||
|
|||||||
@@ -702,7 +702,7 @@ LaunchDaemon::_StartSession(const char* login)
|
|||||||
{
|
{
|
||||||
// TODO: enable user/group code
|
// TODO: enable user/group code
|
||||||
// The launch_daemon currently cannot talk to the registrar, though
|
// The launch_daemon currently cannot talk to the registrar, though
|
||||||
/*
|
|
||||||
struct passwd* passwd = getpwnam(login);
|
struct passwd* passwd = getpwnam(login);
|
||||||
if (passwd == NULL)
|
if (passwd == NULL)
|
||||||
return B_NAME_NOT_FOUND;
|
return B_NAME_NOT_FOUND;
|
||||||
@@ -712,7 +712,6 @@ LaunchDaemon::_StartSession(const char* login)
|
|||||||
// Check if there is a user session running already
|
// Check if there is a user session running already
|
||||||
uid_t user = passwd->pw_uid;
|
uid_t user = passwd->pw_uid;
|
||||||
gid_t group = passwd->pw_gid;
|
gid_t group = passwd->pw_gid;
|
||||||
*/
|
|
||||||
|
|
||||||
Unlock();
|
Unlock();
|
||||||
|
|
||||||
@@ -720,22 +719,12 @@ LaunchDaemon::_StartSession(const char* login)
|
|||||||
if (setsid() < 0)
|
if (setsid() < 0)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
||||||
/*
|
if (initgroups(login, group) == -1)
|
||||||
debug_printf("session leader...\n");
|
|
||||||
if (initgroups(login, group) == -1) {
|
|
||||||
debug_printf("1.ouch: %s\n", strerror(errno));
|
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
if (setgid(group) != 0)
|
||||||
//endgrent();
|
|
||||||
if (setgid(group) != 0) {
|
|
||||||
debug_printf("2.ouch: %s\n", strerror(errno));
|
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
if (setuid(user) != 0)
|
||||||
if (setuid(user) != 0) {
|
|
||||||
debug_printf("3.ouch: %s\n", strerror(errno));
|
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// TODO: This leaks the parent application
|
// TODO: This leaks the parent application
|
||||||
be_app = NULL;
|
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
|
status_t
|
||||||
BPrivate::send_authentication_request_to_registrar(KMessage& request,
|
BPrivate::send_authentication_request_to_registrar(KMessage& request,
|
||||||
KMessage& reply)
|
KMessage& reply)
|
||||||
|
|||||||
Reference in New Issue
Block a user