Import ktsuss-1.4:

ktsuss stands for "keep the su simple, stupid", and as the name says,
is a graphical version of su written in C and GTK+ 2.
With some tweaks by and ok jasper@
This commit is contained in:
landry 2009-06-18 19:45:14 +00:00
parent d67051ca70
commit 668bfe96b9
6 changed files with 150 additions and 0 deletions

28
sysutils/ktsuss/Makefile Normal file
View File

@ -0,0 +1,28 @@
# $OpenBSD: Makefile,v 1.1.1.1 2009/06/18 19:45:14 landry Exp $
COMMENT = graphical su wrapper
DISTNAME = ktsuss-1.4
CATEGORIES = sysutils
MAINTAINER = Landry Breuil <gaston@gcu.info>
# BSD
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
HOMEPAGE = http://developer.berlios.de/projects/ktsuss
MASTER_SITES = ${MASTER_SITE_BERLIOS:=ktsuss/}
CONFIGURE_STYLE = gnu
MODULES= devel/gettext
LIB_DEPENDS = gtk-x11-2.0,gdk-x11-2.0,gdk_pixbuf-2.0::x11/gtk+2,-main
WANTLIB = X11 Xau Xcomposite Xcursor Xdamage Xdmcp Xext Xfixes \
Xi Xinerama Xrandr Xrender atk-1.0 c cairo expat fontconfig \
freetype gio-2.0 glib-2.0 glitz gmodule-2.0 gobject-2.0 \
m pango-1.0 pangocairo-1.0 pangoft2-1.0 pixman-1 png z
.include <bsd.port.mk>

5
sysutils/ktsuss/distinfo Normal file
View File

@ -0,0 +1,5 @@
MD5 (ktsuss-1.4.tar.gz) = utYnzF9d4IJi+k5giBrDCg==
RMD160 (ktsuss-1.4.tar.gz) = uSfwQtdZygOTcyvCeG6x5x2Zg9o=
SHA1 (ktsuss-1.4.tar.gz) = S1ZR4aYuHCUczJ8SofnCG3y/3uA=
SHA256 (ktsuss-1.4.tar.gz) = xlcWAqYKxFKgMwTY/0m/d4Qn0n8/sU3KPoY51XQ1EQQ=
SIZE (ktsuss-1.4.tar.gz) = 279072

View File

@ -0,0 +1,24 @@
$OpenBSD: patch-src_Makefile_in,v 1.1.1.1 2009/06/18 19:45:14 landry Exp $
no lcrypt, and PLIST takes care of setuid'ing ktuss binary
--- src/Makefile.in.orig Tue Jul 1 04:23:01 2008
+++ src/Makefile.in Thu Jun 18 21:27:59 2009
@@ -152,9 +152,9 @@ sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
ktsuss_SOURCES = ktsuss.c auth.c
-ktsuss_LDADD = -lcrypt
+ktsuss_LDADD =
re_su_SOURCES = auth.c re_su.c
-re_su_LDADD = $(DEPS_LIBS) -lcrypt
+re_su_LDADD = $(DEPS_LIBS)
AM_CPPFLAGS = $(DEPS_CFLAGS) \
-DRE_SU_PLACE=\""$(libexecdir)"\" -DPIXMAPS=\""$(datadir)/pixmaps"\"
@@ -400,7 +400,6 @@ install-data-am:
install-exec-am: install-binPROGRAMS install-libexecPROGRAMS
@$(NORMAL_INSTALL)
- $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
install-info: install-info-am

View File

@ -0,0 +1,80 @@
$OpenBSD: patch-src_auth_c,v 1.1.1.1 2009/06/18 19:45:14 landry Exp $
replace linux-only funcs by their posix equivalents
--- src/auth.c.orig Sun Jun 29 23:45:05 2008
+++ src/auth.c Wed Jun 17 22:07:23 2009
@@ -45,10 +45,6 @@
#include <grp.h>
#include "errors.h"
-struct group *fgetgrent(FILE * stream);
-struct passwd *fgetpwent(FILE * stream);
-int setgroups(size_t size, const gid_t * list);
-
char *get_real_name(const char *command)
{
char *real_PATH, *path, *subtoken, *PATH;
@@ -106,13 +102,10 @@ inline int *fixed_realloc(int *ptr, int actual, int si
int set_additional_g(const char *username)
{
int i, x = 0;
- int *groups = NULL;
+ gid_t *groups = NULL;
struct group *ag;
- FILE *file;
- if ((file = fopen("/etc/group", "r")) == NULL)
- return ERR_OPEN_FILE_GROUP;
- while ((ag = fgetgrent(file)) != NULL) {
+ while ((ag = getgrent()) != NULL) {
for (i = 0; ag->gr_mem[i]; i++) {
if (!strcmp(ag->gr_mem[i], username)) {
x += 1;
@@ -122,7 +115,7 @@ int set_additional_g(const char *username)
}
}
}
- fclose(file);
+ endgrent();
if (x) {
if (setgroups(x, groups))
return ERR_FAILED_ADDITIONAL_GIDS;
@@ -134,18 +127,17 @@ int set_additional_g(const char *username)
int make_me_new(const char *username, const char *password, int chk_passwd)
{
struct passwd *pw;
+#ifdef __linux__
struct spwd *sp;
+#endif
const char *correct;
- FILE *file;
char *encrypted;
int error;
- if ((file = fopen("/etc/passwd", "r")) == NULL)
- return ERR_OPEN_FILE_PASSWD;
- while ((pw = fgetpwent(file)) != NULL)
+ while ((pw = getpwent()) != NULL)
if (!strcmp(pw->pw_name, username))
break;
- fclose(file);
+ endpwent();
if (pw == NULL)
return ERR_INVALID_USERNAME;
if (chk_passwd) {
@@ -188,14 +180,11 @@ int try(const char *username, const char *password, in
int check_user(const char *username)
{
struct passwd *pw;
- FILE *file;
- if ((file = fopen("/etc/passwd", "r")) == NULL)
- return ERR_OPEN_FILE_PASSWD;
- while ((pw = fgetpwent(file)) != NULL)
+ while ((pw = getpwent()) != NULL)
if (!strcmp(pw->pw_name, username))
break;
- fclose(file);
+ endpwent();
if (pw == NULL)
return ERR_INVALID_USERNAME;
return ERR_SUCCESS;

View File

@ -0,0 +1,6 @@
ktsuss stands for "keep the su simple, stupid", and as the name says,
is a graphical version of su written in C and GTK+ 2. The idea of the
project is to remain simple and bug free... The ktsuss binary is
installed set-uid, takes care of authentication and fiddles with
uid/gids, while re_su is the graphical user interface asking for the
desired username and password.

View File

@ -0,0 +1,7 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2009/06/18 19:45:14 landry Exp $
@mode 4555
@bin bin/ktsuss
@mode
@bin libexec/re_su
share/pixmaps/
share/pixmaps/ktsuss.png