aboutsummaryrefslogtreecommitdiff
path: root/security/pamsfs
diff options
context:
space:
mode:
authorPav Lucistnik <pav@FreeBSD.org>2005-09-18 13:50:07 +0000
committerPav Lucistnik <pav@FreeBSD.org>2005-09-18 13:50:07 +0000
commit10ee43b9c6d2404365cc7febabe93f4893f08865 (patch)
treede936dd834f2b69eefb9903a38ea2f6276d01bc0 /security/pamsfs
parent9541e09b0305d277a3277b853c85b9dbf9eaf58f (diff)
Notes
Diffstat (limited to 'security/pamsfs')
-rw-r--r--security/pamsfs/Makefile35
-rw-r--r--security/pamsfs/distinfo2
-rw-r--r--security/pamsfs/files/patch-pam_sfs.c102
-rw-r--r--security/pamsfs/pkg-descr5
4 files changed, 144 insertions, 0 deletions
diff --git a/security/pamsfs/Makefile b/security/pamsfs/Makefile
new file mode 100644
index 000000000000..79fb0c30e3d4
--- /dev/null
+++ b/security/pamsfs/Makefile
@@ -0,0 +1,35 @@
+# New ports collection Makefile for: pamsfs
+# Date created: 2005-09-13
+# Whom: David Thiel <lx@redundancy.redundancy.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= pamsfs
+PORTVERSION= 0.1b
+CATEGORIES= security
+MASTER_SITES= ftp://ftp.codecobra.com/pamsfs/
+DISTNAME= ${PORTNAME}-${PORTVERSION}-src
+
+MAINTAINER= lx@redundancy.redundancy.org
+COMMENT= A PAM module to mount SFS home directories
+
+BUILD_DEPENDS= sfskey:${PORTSDIR}/security/sfs
+
+USE_REINPLACE= yes
+ALL_TARGET= pam-sfs
+WRKSRC= ${WRKDIR}/${PORTNAME}
+PLIST_FILES= lib/pam_sfs.so
+PORTDOCS= README
+
+pre-build:
+ @${REINPLACE_CMD} -e "s|/usr/local/sfs-0.7.2|${PREFIX}|g" ${WRKSRC}/pam_sfs.c
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/pam_sfs.so ${PREFIX}/lib
+.if !defined(NOPORTDOCS)
+ ${MKDIR} ${DOCSDIR}
+ ${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
+.endif
+
+.include <bsd.port.mk>
diff --git a/security/pamsfs/distinfo b/security/pamsfs/distinfo
new file mode 100644
index 000000000000..35b754ff73e9
--- /dev/null
+++ b/security/pamsfs/distinfo
@@ -0,0 +1,2 @@
+MD5 (pamsfs-0.1b-src.tar.gz) = 8ff6c4b3eac7d06027fb980992907379
+SIZE (pamsfs-0.1b-src.tar.gz) = 9466
diff --git a/security/pamsfs/files/patch-pam_sfs.c b/security/pamsfs/files/patch-pam_sfs.c
new file mode 100644
index 000000000000..d9a9a932397a
--- /dev/null
+++ b/security/pamsfs/files/patch-pam_sfs.c
@@ -0,0 +1,102 @@
+--- pam_sfs.c.orig Tue Feb 15 02:19:36 2005
++++ pam_sfs.c Sun Sep 18 15:43:56 2005
+@@ -38,14 +38,26 @@
+ void safe_strcat(char*,const char*,int);
+
+ PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh,int flags,int argc,const char **argv) {
++ const char *user;
++ const char *pass;
++ struct passwd *pw;
++ char *homedir;
++ char *sfs="/sfs/";
++ char *serverBegin;
++ char *serverEnd;
++ int lenServer;
++ char *server;
++ int pid;
++ int maxCmd=4096;
++ char *cmd;
++ FILE *f;
++ int status;
++
+ openlog("pam_sfs",0,LOG_AUTH);
+
+ syslog(LOG_DEBUG,"%s","pam_sm_authenticate");
+
+ //read the authentication information
+- const char *user;
+- const char *pass;
+-
+ if (pam_get_user(pamh,&user,NULL)!=PAM_SUCCESS)
+ return PAM_SERVICE_ERR;
+
+@@ -53,7 +65,7 @@
+ return PAM_SERVICE_ERR;
+
+ //get the pw entry for the given user
+- struct passwd *pw=getpwnam(user);
++ pw=getpwnam(user);
+ if (pw==NULL)
+ return PAM_USER_UNKNOWN;
+
+@@ -62,26 +74,24 @@
+ //check if user's home-directory matches /sfs/<host>/
+ //if not, exit right away
+ //if it does, extract <host>
+- char *homedir=pw->pw_dir;
+-
+- char *sfs="/sfs/";
++ homedir=pw->pw_dir;
+
+ if (strncmp(homedir,sfs,strlen(sfs))!=0)
+ return PAM_SUCCESS; //home dir not in /sfs
+
+- char *serverBegin=homedir+strlen(sfs);
+- char *serverEnd=strchr(serverBegin,'/');
++ serverBegin=homedir+strlen(sfs);
++ serverEnd=strchr(serverBegin,'/');
+
+ //absolute max of 2048 characters in server name
+- int lenServer=serverEnd-serverBegin+1;
++ lenServer=serverEnd-serverBegin+1;
+ if (lenServer>2048)
+ return PAM_SERVICE_ERR;
+
+- char *server=malloc(lenServer);
++ server=malloc(lenServer);
+ strncpy(server,serverBegin,lenServer-1);
+ server[lenServer-1]='\0';
+
+- int pid=fork();
++ pid=fork();
+ if (pid==0) {
+ //child
+ //change to the desired user
+@@ -93,8 +103,7 @@
+ system("/usr/local/sfs-0.7.2/bin/sfsagent -c 2>/dev/null");
+
+ //use a temporary variable to assemble the command in
+- int maxCmd=4096;
+- char *cmd=malloc(maxCmd);
++ *cmd=malloc(maxCmd);
+
+ strcpy(cmd,"export HOME=/ ; /usr/local/sfs-0.7.2/bin/sfskey -p 0 add ");
+ safe_strcat(cmd,user,maxCmd);
+@@ -104,7 +113,7 @@
+
+ //syslog(LOG_DEBUG,"executing: %s",cmd);
+
+- FILE *f=popen(cmd,"w");
++ f=popen(cmd,"w");
+
+ free(cmd);
+ free(server); //child's copy
+@@ -116,7 +125,7 @@
+
+ fprintf(f,"%s",pass);
+
+- int status=pclose(f);
++ status=pclose(f);
+ if (status!=0) {
+ syslog(LOG_ERR,"Error from sfskey: %d.",status);
+ exit(EXIT_FAILURE);
diff --git a/security/pamsfs/pkg-descr b/security/pamsfs/pkg-descr
new file mode 100644
index 000000000000..97f373951b68
--- /dev/null
+++ b/security/pamsfs/pkg-descr
@@ -0,0 +1,5 @@
+pamsfs is a PAM module that logs a user into a SFS server on
+system login. The primary reason for doing this is to allow users'
+home-directories to be located on a SFS server.
+
+WWW: http://www.codecobra.com/pamsfs/