Re: Potential Patch for consolekit?
Samuel Thibault wrote: Hello, Barry deFreese, le Sat 23 May 2009 00:01:17 -0400, a écrit : @@ -235,7 +235,7 @@ const char *s; uid_t uid; charbuf[256]; -charttybuf[PATH_MAX]; +char*ttybuf; DBusError error; dbus_bool_t is_local; @@ -286,8 +286,14 @@ x11_display = display_device; display_device = ; } else if (strncmp (_PATH_DEV, display_device, 5) != 0) { +int tmp_buf = strlen(_PATH_DEV) + strlen(display_device) + 1; + if (( ttybuf = malloc(tmp_buf) ) == NULL ) { +printf(Unable to allocate TTY buffer\n); + goto out; + } snprintf (ttybuf, sizeof (ttybuf), _PATH_DEV %s, display_device); display_device = ttybuf; + free(ttybuf); } You can also move the ttybuf declaration inside the if branch, so that you can keep it as an array, whose size will be strlen(_PATH_DEV) + strlen(display_device) + 1; That will fix the now-erroneous sizeof(ttybuf) (when ttybuf is a pointer, that would return the size of the pointer, not the size of what is allocated). +/* adapted from procps */ +/* Load /proc/tty/drivers for device name mapping use. */ We don't have that, and I don't think we should have it anyway, so you can drop that part of the code. Samuel Here is an updated patch. Duck has done some testing. I still haven't ripped out the procps stuff yet. And I will post to Alioth once I get my account stuff straightened out. Thanks, Barry diff -urN repo/consolekit-0.3.0/configure.ac consolekit-0.3.0/configure.ac --- repo/consolekit-0.3.0/configure.ac 2009-05-22 23:56:38.29000 -0400 +++ consolekit-0.3.0/configure.ac 2009-05-16 14:59:07.0 -0400 @@ -189,12 +189,16 @@ ;; *-*-solaris*) CK_BACKEND=solaris + ;; + *-*-gnu*) + CK_BACKEND=gnu ;; esac AC_SUBST(KVM_LIBS) AM_CONDITIONAL(CK_COMPILE_LINUX, test x$CK_BACKEND = xlinux, [Compiling for Linux]) +AM_CONDITIONAL(CK_COMPILE_GNU, test x$CK_BACKEND = xgnu, [Compiling for GNU]) AM_CONDITIONAL(CK_COMPILE_FREEBSD, test x$CK_BACKEND = xfreebsd, [Compiling for FreeBSD]) AM_CONDITIONAL(CK_COMPILE_SOLARIS, test x$CK_BACKEND = xsolaris, [Compiling for Solaris]) AC_SUBST(CK_BACKEND) @@ -441,4 +445,4 @@ echo a huge SECURITY HOLE. I repeat: YOU NEED TO EDIT THE FILE echo ConsoleKit.conf to match your distro/site to avoid NASTY SECURITY HOLES. echo -fi \ No newline at end of file +fi diff -urN repo/consolekit-0.3.0/pam-ck-connector/pam-ck-connector.c consolekit-0.3.0/pam-ck-connector/pam-ck-connector.c --- repo/consolekit-0.3.0/pam-ck-connector/pam-ck-connector.c 2009-05-22 23:56:37.11000 -0400 +++ consolekit-0.3.0/pam-ck-connector/pam-ck-connector.c2009-05-23 16:31:13.54000 -0400 @@ -235,7 +235,6 @@ const char *s; uid_t uid; charbuf[256]; -charttybuf[PATH_MAX]; DBusError error; dbus_bool_t is_local; @@ -286,6 +285,7 @@ x11_display = display_device; display_device = ; } else if (strncmp (_PATH_DEV, display_device, 5) != 0) { +char ttybuf[(strlen(_PATH_DEV) + strlen(display_device) + 1)]; snprintf (ttybuf, sizeof (ttybuf), _PATH_DEV %s, display_device); display_device = ttybuf; } diff -urN repo/consolekit-0.3.0/src/Makefile.am consolekit-0.3.0/src/Makefile.am --- repo/consolekit-0.3.0/src/Makefile.am 2008-07-25 14:38:56.01000 -0400 +++ consolekit-0.3.0/src/Makefile.am2009-05-16 15:00:11.0 -0400 @@ -45,6 +45,13 @@ ck-sysdeps-linux.c \ $(NULL) endif + +if CK_COMPILE_GNU +libck_la_SOURCES +=\ + ck-sysdeps-gnu.c\ + $(NULL) +endif + if CK_COMPILE_SOLARIS libck_la_SOURCES +=\ ck-sysdeps-solaris.c\ @@ -61,6 +68,7 @@ ck-sysdeps-linux.c \ ck-sysdeps-solaris.c\ ck-sysdeps-freebsd.c\ + ck-sysdeps-gnu.c\ $(NULL) sbin_PROGRAMS =\ diff -urN repo/consolekit-0.3.0/src/ck-sysdeps-gnu.c consolekit-0.3.0/src/ck-sysdeps-gnu.c --- repo/consolekit-0.3.0/src/ck-sysdeps-gnu.c 1969-12-31 19:00:00.0 -0500 +++ consolekit-0.3.0/src/ck-sysdeps-gnu.c 2009-05-22 15:02:29.0 -0400 @@ -0,0 +1,776 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2006 William Jon McCann mcc...@jhu.edu + * + * 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
Re: Potential Patch for consolekit?
Hello, Barry deFreese, le Sat 23 May 2009 00:01:17 -0400, a écrit : @@ -235,7 +235,7 @@ const char *s; uid_t uid; charbuf[256]; -charttybuf[PATH_MAX]; +char*ttybuf; DBusError error; dbus_bool_t is_local; @@ -286,8 +286,14 @@ x11_display = display_device; display_device = ; } else if (strncmp (_PATH_DEV, display_device, 5) != 0) { +int tmp_buf = strlen(_PATH_DEV) + strlen(display_device) + 1; + if (( ttybuf = malloc(tmp_buf) ) == NULL ) { +printf(Unable to allocate TTY buffer\n); + goto out; + } snprintf (ttybuf, sizeof (ttybuf), _PATH_DEV %s, display_device); display_device = ttybuf; + free(ttybuf); } You can also move the ttybuf declaration inside the if branch, so that you can keep it as an array, whose size will be strlen(_PATH_DEV) + strlen(display_device) + 1; That will fix the now-erroneous sizeof(ttybuf) (when ttybuf is a pointer, that would return the size of the pointer, not the size of what is allocated). +/* adapted from procps */ +/* Load /proc/tty/drivers for device name mapping use. */ We don't have that, and I don't think we should have it anyway, so you can drop that part of the code. Samuel -- To UNSUBSCRIBE, email to debian-hurd-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Potential Patch for consolekit?
Hi folks, Here is a potential patch for consolekit. It does build but most likely needs review and testing. I will try to test it once I figure out why I cannot run console on goober. Thanks, Barry deFreese diff -urN repo/consolekit-0.3.0/configure.ac consolekit-0.3.0/configure.ac --- repo/consolekit-0.3.0/configure.ac 2009-05-22 23:56:38.29000 -0400 +++ consolekit-0.3.0/configure.ac 2009-05-16 14:59:07.0 -0400 @@ -189,12 +189,16 @@ ;; *-*-solaris*) CK_BACKEND=solaris + ;; + *-*-gnu*) + CK_BACKEND=gnu ;; esac AC_SUBST(KVM_LIBS) AM_CONDITIONAL(CK_COMPILE_LINUX, test x$CK_BACKEND = xlinux, [Compiling for Linux]) +AM_CONDITIONAL(CK_COMPILE_GNU, test x$CK_BACKEND = xgnu, [Compiling for GNU]) AM_CONDITIONAL(CK_COMPILE_FREEBSD, test x$CK_BACKEND = xfreebsd, [Compiling for FreeBSD]) AM_CONDITIONAL(CK_COMPILE_SOLARIS, test x$CK_BACKEND = xsolaris, [Compiling for Solaris]) AC_SUBST(CK_BACKEND) @@ -441,4 +445,4 @@ echo a huge SECURITY HOLE. I repeat: YOU NEED TO EDIT THE FILE echo ConsoleKit.conf to match your distro/site to avoid NASTY SECURITY HOLES. echo -fi \ No newline at end of file +fi diff -urN repo/consolekit-0.3.0/pam-ck-connector/pam-ck-connector.c consolekit-0.3.0/pam-ck-connector/pam-ck-connector.c --- repo/consolekit-0.3.0/pam-ck-connector/pam-ck-connector.c 2009-05-22 23:56:37.11000 -0400 +++ consolekit-0.3.0/pam-ck-connector/pam-ck-connector.c2009-05-22 23:45:01.84000 -0400 @@ -235,7 +235,7 @@ const char *s; uid_t uid; charbuf[256]; -charttybuf[PATH_MAX]; +char*ttybuf; DBusError error; dbus_bool_t is_local; @@ -286,8 +286,14 @@ x11_display = display_device; display_device = ; } else if (strncmp (_PATH_DEV, display_device, 5) != 0) { +int tmp_buf = strlen(_PATH_DEV) + strlen(display_device) + 1; + if (( ttybuf = malloc(tmp_buf) ) == NULL ) { +printf(Unable to allocate TTY buffer\n); + goto out; + } snprintf (ttybuf, sizeof (ttybuf), _PATH_DEV %s, display_device); display_device = ttybuf; + free(ttybuf); } remote_host_name = NULL; diff -urN repo/consolekit-0.3.0/src/Makefile.am consolekit-0.3.0/src/Makefile.am --- repo/consolekit-0.3.0/src/Makefile.am 2008-07-25 14:38:56.01000 -0400 +++ consolekit-0.3.0/src/Makefile.am2009-05-16 15:00:11.0 -0400 @@ -45,6 +45,13 @@ ck-sysdeps-linux.c \ $(NULL) endif + +if CK_COMPILE_GNU +libck_la_SOURCES +=\ + ck-sysdeps-gnu.c\ + $(NULL) +endif + if CK_COMPILE_SOLARIS libck_la_SOURCES +=\ ck-sysdeps-solaris.c\ @@ -61,6 +68,7 @@ ck-sysdeps-linux.c \ ck-sysdeps-solaris.c\ ck-sysdeps-freebsd.c\ + ck-sysdeps-gnu.c\ $(NULL) sbin_PROGRAMS =\ diff -urN repo/consolekit-0.3.0/src/ck-sysdeps-gnu.c consolekit-0.3.0/src/ck-sysdeps-gnu.c --- repo/consolekit-0.3.0/src/ck-sysdeps-gnu.c 1969-12-31 19:00:00.0 -0500 +++ consolekit-0.3.0/src/ck-sysdeps-gnu.c 2009-05-22 15:02:29.0 -0400 @@ -0,0 +1,776 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2006 William Jon McCann mcc...@jhu.edu + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#include config.h + +#include stdlib.h +#include stdio.h +#include fcntl.h +#include unistd.h +#include string.h +#include errno.h +#include sys/types.h +#include sys/stat.h +#include sys/ioctl.h + +#include hurd/console.h +#include dirent.h +/* #include linux/tty.h */ +/* #include linux/kd.h */ + +#ifdef HAVE_PATHS_H +#include paths.h +#endif /* HAVE_PATHS_H */ + +#include ck-sysdeps.h + +#ifndef ERROR +#define ERROR -1 +#endif + +/* adapted from procps */ +struct _CkProcessStat +{ +int pid; +int ppid; /* stat,status pid of parent process */ +char state; /* stat,status single