forked from knu/netatalk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix PAM config installation. make distcheck was failing on Solaris in uninstall, because the uninstall target ran some `rm -f PAMFILE` where PAMFILE is hardcoded to /etc/pam.d. The resulting EPERM causes the make target to fail.
- Loading branch information
1 parent
01e4f40
commit 22ad101
Showing
29 changed files
with
648 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE busconfig PUBLIC | ||
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" | ||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> | ||
<busconfig> | ||
|
||
<!-- Only root can own AFP stats service --> | ||
<policy user="root"> | ||
<allow own="org.netatalk.AFPStats"/> | ||
</policy> | ||
|
||
<!-- Allow anyone to invoke methods on time-sliderd --> | ||
<policy context="default"> | ||
<allow send_destination="org.netatalk.AFPStats"/> | ||
<allow receive_sender="org.netatalk.AFPStats"/> | ||
</policy> | ||
|
||
</busconfig> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Makefile | ||
Makefile.in | ||
netatalk.pam | ||
.gitignore | ||
netatalk | ||
*.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env python | ||
|
||
usage = """Usage: | ||
python afpstats.py | ||
""" | ||
|
||
import sys | ||
from traceback import print_exc | ||
import dbus | ||
|
||
def main(): | ||
bus = dbus.SystemBus() | ||
|
||
try: | ||
remote_object = bus.get_object("org.netatalk.AFPStats", | ||
"/org/netatalk/AFPStats") | ||
|
||
except dbus.DBusException: | ||
print_exc() | ||
sys.exit(1) | ||
|
||
iface = dbus.Interface(remote_object, "org.netatalk.AFPStats") | ||
|
||
reply = iface.GetUsers() | ||
for name in reply: | ||
print name | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<node name="/org/netatalk/AFPStats"> | ||
<interface name="org.netatalk.AFPStats"> | ||
<method name="GetUsers"> | ||
<arg name="ret" type="as" direction="out"/> | ||
</method> | ||
</interface> | ||
</node> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
/* | ||
* Copyright (c) 2013 Frank Lahm <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
*/ | ||
|
||
#ifdef HAVE_CONFIG_H | ||
#include "config.h" | ||
#endif /* HAVE_CONFIG_H */ | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <errno.h> | ||
#include <pthread.h> | ||
#include <glib.h> | ||
#include <gio/gio.h> | ||
#include <dbus/dbus-glib.h> | ||
|
||
#include <atalk/logger.h> | ||
#include <atalk/compat.h> | ||
#include <atalk/errchk.h> | ||
#include <atalk/server_child.h> | ||
|
||
#include "afpstats_obj.h" | ||
#include "afpstats_service_glue.h" | ||
|
||
/* | ||
* Beware: this struct is accessed and modified from the main thread | ||
* and from this thread, thus be careful to lock and unlock the mutex. | ||
*/ | ||
static server_child_t *childs; | ||
|
||
static gpointer afpstats_thread(gpointer _data) | ||
{ | ||
DBusGConnection *bus; | ||
DBusGProxy *bus_proxy; | ||
GError *error = NULL; | ||
GMainLoop *thread_loop; | ||
guint request_name_result; | ||
sigset_t sigs; | ||
|
||
/* Block all signals in this thread */ | ||
sigfillset(&sigs); | ||
pthread_sigmask(SIG_BLOCK, &sigs, NULL); | ||
|
||
dbus_g_object_type_install_info(AFPSTATS_TYPE_OBJECT, &dbus_glib_afpstats_obj_object_info); | ||
|
||
thread_loop = g_main_loop_new(NULL, FALSE); | ||
|
||
if (!(bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error))) { | ||
LOG(log_error, logtype_afpd,"Couldn't connect to system bus: %s", error->message); | ||
return NULL; | ||
} | ||
|
||
if (!(bus_proxy = dbus_g_proxy_new_for_name(bus, "org.freedesktop.DBus", | ||
"/org/freedesktop/DBus", | ||
"org.freedesktop.DBus"))) { | ||
LOG(log_error, logtype_afpd,"Couldn't create bus proxy"); | ||
return NULL; | ||
} | ||
|
||
if (!dbus_g_proxy_call(bus_proxy, "RequestName", &error, | ||
G_TYPE_STRING, "org.netatalk.AFPStats", | ||
G_TYPE_UINT, 0, | ||
G_TYPE_INVALID, | ||
G_TYPE_UINT, &request_name_result, | ||
G_TYPE_INVALID)) { | ||
LOG(log_error, logtype_afpd, "Failed to acquire DBUS name: %s", error->message); | ||
return NULL; | ||
} | ||
|
||
AFPStatsObj *obj = g_object_new(AFPSTATS_TYPE_OBJECT, NULL); | ||
dbus_g_connection_register_g_object(bus, "/org/netatalk/AFPStats", G_OBJECT(obj)); | ||
|
||
g_main_loop_run(thread_loop); | ||
return thread_loop; | ||
} | ||
|
||
static void my_glib_log(const gchar *log_domain, | ||
GLogLevelFlags log_level, | ||
const gchar *message, | ||
gpointer user_data) | ||
{ | ||
LOG(log_error, logtype_afpd, "%s: %s", log_domain, message); | ||
} | ||
|
||
server_child_t *afpstats_get_and_lock_childs(void) | ||
{ | ||
pthread_mutex_lock(&childs->servch_lock); | ||
return childs; | ||
} | ||
|
||
void afpstats_unlock_childs(void) | ||
{ | ||
pthread_mutex_unlock(&childs->servch_lock); | ||
} | ||
|
||
int afpstats_init(server_child_t *childs_in) | ||
{ | ||
GThread *thread; | ||
|
||
childs = childs_in; | ||
g_type_init(); | ||
(void)g_log_set_default_handler(my_glib_log, NULL); | ||
g_thread_init(NULL); | ||
thread = g_thread_create(afpstats_thread, NULL, TRUE, NULL); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright (c) 2013 Frank Lahm <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
*/ | ||
|
||
#ifndef AFPD_AFPSTATS_H | ||
#define AFPD_AFPSTATS_H | ||
|
||
#include <atalk/server_child.h> | ||
|
||
extern int afpstats_init(server_child_t *); | ||
extern server_child_t *afpstats_get_and_lock_childs(void); | ||
extern void afpstats_unlock_childs(void); | ||
#endif |
Oops, something went wrong.