From ca9627e70852f6b2e835660df870fe3ab405882d Mon Sep 17 00:00:00 2001
From: "Suren A. Chilingaryan" <csa@suren.me>
Date: Sun, 1 Sep 2019 00:00:32 +0200
Subject: Initial import

---
 sys-auth/pam_x509/files/pam_x509-ds-compile.patch  | 103 +++++++++++++++++++++
 sys-auth/pam_x509/files/pam_x509-ds-compile2.patch | 103 +++++++++++++++++++++
 sys-auth/pam_x509/files/pam_x509-ds-obexftp.patch  |  74 +++++++++++++++
 sys-auth/pam_x509/files/pam_x509-ds_syslog.patch   |  45 +++++++++
 sys-auth/pam_x509/files/x509-auth                  |   3 +
 sys-auth/pam_x509/files/x509.config                |   1 +
 6 files changed, 329 insertions(+)
 create mode 100644 sys-auth/pam_x509/files/pam_x509-ds-compile.patch
 create mode 100644 sys-auth/pam_x509/files/pam_x509-ds-compile2.patch
 create mode 100644 sys-auth/pam_x509/files/pam_x509-ds-obexftp.patch
 create mode 100644 sys-auth/pam_x509/files/pam_x509-ds_syslog.patch
 create mode 100644 sys-auth/pam_x509/files/x509-auth
 create mode 100644 sys-auth/pam_x509/files/x509.config

(limited to 'sys-auth/pam_x509/files')

diff --git a/sys-auth/pam_x509/files/pam_x509-ds-compile.patch b/sys-auth/pam_x509/files/pam_x509-ds-compile.patch
new file mode 100644
index 0000000..59f6e89
--- /dev/null
+++ b/sys-auth/pam_x509/files/pam_x509-ds-compile.patch
@@ -0,0 +1,103 @@
+diff -dPNur pam_x509-1.0.2/Makefile pam_x509-1.0.2-new/Makefile
+--- pam_x509-1.0.2/Makefile	2007-04-22 12:31:55.000000000 +0200
++++ pam_x509-1.0.2-new/Makefile	2007-04-22 12:51:15.000000000 +0200
+@@ -6,8 +6,10 @@
+ 
+ ifeq ($(BT),yes) 
+     OBJECTS += rfcomm.o
+-    LIBS += -lbluetooth -lobexftp -lcobexbfb -lbfb `openobex-config --libs`
+-    CFLAGS += -D_BLUETOOTH `openobex-config --cflags`
++#    LIBS += -lbluetooth -lobexftp -lcobexbfb -lbfb `openobex-config --libs`
++#    CFLAGS += -D_BLUETOOTH `openobex-config --cflags`
++    CFLAGS += -D_BLUETOOTH
++    LIBS += -lbluetooth -lobexftp -lmulticobex -lbfb -lopenobex
+ endif
+ 
+ pam_x509: $(OBJECTS)
+diff -dPNur pam_x509-1.0.2/pam_x509.c pam_x509-1.0.2-new/pam_x509.c
+--- pam_x509-1.0.2/pam_x509.c	2006-06-12 13:55:19.000000000 +0200
++++ pam_x509-1.0.2-new/pam_x509.c	2007-04-22 12:52:42.000000000 +0200
+@@ -1,7 +1,9 @@
+ #define PAM_SM_AUTH
+ #include <stdio.h>
+ #include <unistd.h>
++#include <string.h>
+ #include <stdarg.h>
++#include <alloca.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ 
+diff -dPNur pam_x509-1.0.2/pass.c pam_x509-1.0.2-new/pass.c
+--- pam_x509-1.0.2/pass.c	2003-10-17 00:51:55.000000000 +0200
++++ pam_x509-1.0.2-new/pass.c	2007-04-22 12:51:51.000000000 +0200
+@@ -1,4 +1,5 @@
+ #include <stdio.h>
++#include <string.h>
+ 
+ #include "sslauth.h"
+ 
+diff -dPNur pam_x509-1.0.2/rfcomm.c pam_x509-1.0.2-new/rfcomm.c
+--- pam_x509-1.0.2/rfcomm.c	2006-06-12 14:24:23.000000000 +0200
++++ pam_x509-1.0.2-new/rfcomm.c	2007-04-22 13:14:20.000000000 +0200
+@@ -17,16 +17,28 @@
+ #include <bluetooth/rfcomm.h>
+ 
+ #include <obexftp/client.h>
+-#include <cobexbfb/cobex_bfb.h>
+ 
+-#ifdef obexftp_cli_connect
++#if defined(obexftp_cli_connect)
++# include <cobexbfb/cobex_bfb.h>
+ # define obexftp_cli_connect_wrapper(cli) obexftp_cli_connect(cli, NULL, 0)
+ # define obexftp_cli_open_wrapper(cb, ctrans, param) obexftp_cli_open(OBEX_TRANS_BLUETOOTH, ctrans, cb, param)
+ # define obexftp_setpath_wrapper(cli, path) obexftp_setpath(cli, path, 1)
++# define obexftp_cli_close_wrapper obexftp_cli_close
++# define obexftp_cli_disconnect_wrapper obexftp_cli_disconnect
++#elif defined(obexftp_connect)
++# include <multicobex/multi_cobex.h>
++# define obexftp_cli_connect_wrapper(cli) obexftp_connect(cli, NULL, 0)
++# define obexftp_cli_open_wrapper(cb, ctrans, param) obexftp_open(OBEX_TRANS_BLUETOOTH, ctrans, cb, param)
++# define obexftp_setpath_wrapper(cli, path) obexftp_setpath(cli, path, 1)
++# define obexftp_cli_close_wrapper obexftp_close
++# define obexftp_cli_disconnect_wrapper obexftp_disconnect
+ #else
++# include <cobexbfb/cobex_bfb.h>
+ # define obexftp_cli_connect_wrapper(cli) obexftp_cli_connect(cli)
+ # define obexftp_cli_open_wrapper(cb, ctrans, param) obexftp_cli_open(cb, ctrans, param)
+ # define obexftp_setpath_wrapper(cli, path) obexftp_setpath(cli, path)
++# define obexftp_cli_close_wrapper obexftp_cli_close
++# define obexftp_cli_disconnect_wrapper obexftp_cli_disconnect
+ #endif
+ 
+ /*
+@@ -75,7 +87,7 @@
+ #ifdef _DEBUG
+ 	_pam_log(LOG_NOTICE,"Error connecting client over %s!",tty);
+ #endif
+-	obexftp_cli_close(cli);
++	obexftp_cli_close_wrapper(cli);
+ 	if (ctrans) cobex_free(ctrans);	
+ 	return 0;
+     }
+@@ -87,8 +99,8 @@
+ #ifdef _DEBUG
+ 	_pam_log(LOG_NOTICE,"Can't get list file over %s!",tty);
+ #endif
+-	obexftp_cli_disconnect (cli);
+-	obexftp_cli_close(cli);
++	obexftp_cli_disconnect_wrapper (cli);
++	obexftp_cli_close_wrapper(cli);
+         if (ctrans) cobex_free(ctrans);	
+ 	return 0;
+     }
+@@ -121,8 +133,8 @@
+     }
+     fclose(f);
+ 
+-    obexftp_cli_disconnect (cli);
+-    obexftp_cli_close(cli);
++    obexftp_cli_disconnect_wrapper (cli);
++    obexftp_cli_close_wrapper(cli);
+     if (ctrans) cobex_free(ctrans);	
+     return res;
+ }
diff --git a/sys-auth/pam_x509/files/pam_x509-ds-compile2.patch b/sys-auth/pam_x509/files/pam_x509-ds-compile2.patch
new file mode 100644
index 0000000..5c0fa70
--- /dev/null
+++ b/sys-auth/pam_x509/files/pam_x509-ds-compile2.patch
@@ -0,0 +1,103 @@
+diff -dPNur pam_x509-1.0.2/Makefile pam_x509-1.0.2-new/Makefile
+--- pam_x509-1.0.2/Makefile	2007-04-22 12:31:55.000000000 +0200
++++ pam_x509-1.0.2-new/Makefile	2007-04-22 12:51:15.000000000 +0200
+@@ -6,8 +6,10 @@
+ 
+ ifeq ($(BT),yes) 
+     OBJECTS += rfcomm.o
+-    LIBS += -lbluetooth -lobexftp -lcobexbfb -lbfb `openobex-config --libs`
+-    CFLAGS += -D_BLUETOOTH `openobex-config --cflags`
++#    LIBS += -lbluetooth -lobexftp -lcobexbfb -lbfb `openobex-config --libs`
++#    CFLAGS += -D_BLUETOOTH `openobex-config --cflags`
++    CFLAGS += -D_BLUETOOTH
++    LIBS += -lbluetooth -lobexftp -lcobexbfb -lbfb -lopenobex
+ endif
+ 
+ pam_x509: $(OBJECTS)
+diff -dPNur pam_x509-1.0.2/pam_x509.c pam_x509-1.0.2-new/pam_x509.c
+--- pam_x509-1.0.2/pam_x509.c	2006-06-12 13:55:19.000000000 +0200
++++ pam_x509-1.0.2-new/pam_x509.c	2007-04-22 12:52:42.000000000 +0200
+@@ -1,7 +1,9 @@
+ #define PAM_SM_AUTH
+ #include <stdio.h>
+ #include <unistd.h>
++#include <string.h>
+ #include <stdarg.h>
++#include <alloca.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ 
+diff -dPNur pam_x509-1.0.2/pass.c pam_x509-1.0.2-new/pass.c
+--- pam_x509-1.0.2/pass.c	2003-10-17 00:51:55.000000000 +0200
++++ pam_x509-1.0.2-new/pass.c	2007-04-22 12:51:51.000000000 +0200
+@@ -1,4 +1,5 @@
+ #include <stdio.h>
++#include <string.h>
+ 
+ #include "sslauth.h"
+ 
+diff -dPNur pam_x509-1.0.2/rfcomm.c pam_x509-1.0.2-new/rfcomm.c
+--- pam_x509-1.0.2/rfcomm.c	2006-06-12 14:24:23.000000000 +0200
++++ pam_x509-1.0.2-new/rfcomm.c	2007-04-22 13:14:20.000000000 +0200
+@@ -17,16 +17,28 @@
+ #include <bluetooth/rfcomm.h>
+ 
+ #include <obexftp/client.h>
+-#include <cobexbfb/cobex_bfb.h>
+ 
+-#ifdef obexftp_cli_connect
++#if defined(obexftp_cli_connect)
++# include <cobexbfb/cobex_bfb.h>
+ # define obexftp_cli_connect_wrapper(cli) obexftp_cli_connect(cli, NULL, 0)
+ # define obexftp_cli_open_wrapper(cb, ctrans, param) obexftp_cli_open(OBEX_TRANS_BLUETOOTH, ctrans, cb, param)
+ # define obexftp_setpath_wrapper(cli, path) obexftp_setpath(cli, path, 1)
++# define obexftp_cli_close_wrapper obexftp_cli_close
++# define obexftp_cli_disconnect_wrapper obexftp_cli_disconnect
++#elif defined(obexftp_connect)
++# include <multicobex/multi_cobex.h>
++# define obexftp_cli_connect_wrapper(cli) obexftp_connect(cli, NULL, 0)
++# define obexftp_cli_open_wrapper(cb, ctrans, param) obexftp_open(OBEX_TRANS_BLUETOOTH, ctrans, cb, param)
++# define obexftp_setpath_wrapper(cli, path) obexftp_setpath(cli, path, 1)
++# define obexftp_cli_close_wrapper obexftp_close
++# define obexftp_cli_disconnect_wrapper obexftp_disconnect
+ #else
++# include <cobexbfb/cobex_bfb.h>
+ # define obexftp_cli_connect_wrapper(cli) obexftp_cli_connect(cli)
+ # define obexftp_cli_open_wrapper(cb, ctrans, param) obexftp_cli_open(cb, ctrans, param)
+ # define obexftp_setpath_wrapper(cli, path) obexftp_setpath(cli, path)
++# define obexftp_cli_close_wrapper obexftp_cli_close
++# define obexftp_cli_disconnect_wrapper obexftp_cli_disconnect
+ #endif
+ 
+ /*
+@@ -75,7 +87,7 @@
+ #ifdef _DEBUG
+ 	_pam_log(LOG_NOTICE,"Error connecting client over %s!",tty);
+ #endif
+-	obexftp_cli_close(cli);
++	obexftp_cli_close_wrapper(cli);
+ 	if (ctrans) cobex_free(ctrans);	
+ 	return 0;
+     }
+@@ -87,8 +99,8 @@
+ #ifdef _DEBUG
+ 	_pam_log(LOG_NOTICE,"Can't get list file over %s!",tty);
+ #endif
+-	obexftp_cli_disconnect (cli);
+-	obexftp_cli_close(cli);
++	obexftp_cli_disconnect_wrapper (cli);
++	obexftp_cli_close_wrapper(cli);
+         if (ctrans) cobex_free(ctrans);	
+ 	return 0;
+     }
+@@ -121,8 +133,8 @@
+     }
+     fclose(f);
+ 
+-    obexftp_cli_disconnect (cli);
+-    obexftp_cli_close(cli);
++    obexftp_cli_disconnect_wrapper (cli);
++    obexftp_cli_close_wrapper(cli);
+     if (ctrans) cobex_free(ctrans);	
+     return res;
+ }
diff --git a/sys-auth/pam_x509/files/pam_x509-ds-obexftp.patch b/sys-auth/pam_x509/files/pam_x509-ds-obexftp.patch
new file mode 100644
index 0000000..eca5658
--- /dev/null
+++ b/sys-auth/pam_x509/files/pam_x509-ds-obexftp.patch
@@ -0,0 +1,74 @@
+diff -dPNur pam_x509-1.0.1/Makefile pam_x509-1.0.1-new/Makefile
+--- pam_x509-1.0.1/Makefile	2006-01-04 12:56:14.000000000 +0000
++++ pam_x509-1.0.1-new/Makefile	2006-01-04 13:35:20.000000000 +0000
+@@ -2,13 +2,13 @@
+ 
+ all: pam_x509
+ 
+-
++CFLAGS += -fPIC
+ OBJECTS=sslapp.o sslauth.o pam_x509.o pass.o 
+ 
+ ifeq ($(BT),yes) 
+     OBJECTS += rfcomm.o
+     LIBS += -lbluetooth -lobexftp -lcobexbfb -lbfb `openobex-config --libs`
+-    CFLAGS += -D_BLUETOOTH
++    CFLAGS += -D_BLUETOOTH `openobex-config --cflags`
+ endif
+ 
+ pam_x509: $(OBJECTS)
+@@ -23,7 +23,7 @@
+ pass.o: pass.c sslauth.h
+ 
+ rfcomm.o: rfcomm.c sslauth.h
+-	gcc -c `openobex-config --cflags` rfcomm.c
++	gcc -c $(CFLAGS) rfcomm.c
+ 
+ 
+ clean:
+diff -dPNur pam_x509-1.0.1/rfcomm.c pam_x509-1.0.1-new/rfcomm.c
+--- pam_x509-1.0.1/rfcomm.c	2003-10-18 15:28:13.000000000 +0000
++++ pam_x509-1.0.1-new/rfcomm.c	2006-01-04 13:32:17.000000000 +0000
+@@ -19,6 +19,15 @@
+ #include <obexftp/client.h>
+ #include <cobexbfb/cobex_bfb.h>
+ 
++#ifdef obexftp_cli_connect
++# define obexftp_cli_connect_wrapper(cli) obexftp_cli_connect(cli, NULL, 0)
++# define obexftp_cli_open_wrapper(cb, ctrans, param) obexftp_cli_open(OBEX_TRANS_BLUETOOTH, ctrans, cb, param)
++# define obexftp_setpath_wrapper(cli, path) obexftp_setpath(cli, path, 1)
++#else
++# define obexftp_cli_connect_wrapper(cli) obexftp_cli_connect(cli)
++# define obexftp_cli_open_wrapper(cb, ctrans, param) obexftp_cli_open(cb, ctrans, param)
++# define obexftp_setpath_wrapper(cli, path) obexftp_setpath(cli, path)
++#endif
+ 
+ /*
+ static void print_dev_info(struct rfcomm_dev_info *di)
+@@ -53,7 +62,7 @@
+     strcpy(lfile,tmp_dir); lpos=lfile+strlen(lfile); *lpos='/'; lpos++; *lpos=0;
+         
+     ctrans = cobex_ctrans (tty);
+-    cli = obexftp_cli_open (info_cb, ctrans, NULL);
++    cli = obexftp_cli_open_wrapper (info_cb, ctrans, NULL);
+     if (!cli) {
+ #ifdef _DEBUG
+ 	_pam_log(LOG_NOTICE,"Error opening obexftp-client connection over %s!",tty);
+@@ -62,7 +71,7 @@
+ 	return 0;
+     }
+ 
+-    if (obexftp_cli_connect (cli) < 0) {
++    if (obexftp_cli_connect_wrapper (cli) < 0) {
+ #ifdef _DEBUG
+ 	_pam_log(LOG_NOTICE,"Error connecting client over %s!",tty);
+ #endif
+@@ -84,7 +93,7 @@
+ 	return 0;
+     }
+ 
+-    if (obexftp_setpath(cli, bt_path)>=0) {
++    if (obexftp_setpath_wrapper(cli, bt_path)>=0) {
+ 	while(!feof(f)) {
+ 	    fgets(stmp,MAX_LINE_SIZE-1,f);
+ 	    for(spos=stmp;((*spos==' ')||(*spos=='\t'));spos++);
diff --git a/sys-auth/pam_x509/files/pam_x509-ds_syslog.patch b/sys-auth/pam_x509/files/pam_x509-ds_syslog.patch
new file mode 100644
index 0000000..f49142c
--- /dev/null
+++ b/sys-auth/pam_x509/files/pam_x509-ds_syslog.patch
@@ -0,0 +1,45 @@
+diff -dPNur pam_x509-1.0.2/pam_x509.c pam_x509-1.0.2-new/pam_x509.c
+--- pam_x509-1.0.2/pam_x509.c	2006-06-12 13:55:19.000000000 +0200
++++ pam_x509-1.0.2-new/pam_x509.c	2009-03-19 21:58:35.000000000 +0100
+@@ -4,6 +4,7 @@
+ #include <stdarg.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#include <syslog.h>
+ 
+ #include "sslauth.h"
+ 
+diff -dPNur pam_x509-1.0.2/pass.c pam_x509-1.0.2-new/pass.c
+--- pam_x509-1.0.2/pass.c	2003-10-17 00:51:55.000000000 +0200
++++ pam_x509-1.0.2-new/pass.c	2009-03-19 22:39:51.000000000 +0100
+@@ -24,6 +24,8 @@
+ 	free(reply);                              \
+ } while (0)
+ 
++#include <syslog.h>
++
+ static int return_null_password(char *buf) {
+     if (buf) buf[0]=0;
+     return 0;
+diff -dPNur pam_x509-1.0.2/rfcomm.c pam_x509-1.0.2-new/rfcomm.c
+--- pam_x509-1.0.2/rfcomm.c	2006-06-12 14:24:23.000000000 +0200
++++ pam_x509-1.0.2-new/rfcomm.c	2009-03-19 21:58:26.000000000 +0100
+@@ -8,6 +8,7 @@
+ #include <sys/socket.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#include <syslog.h>
+ 
+ #include "sslauth.h"
+ 
+diff -dPNur pam_x509-1.0.2/sslauth.c pam_x509-1.0.2-new/sslauth.c
+--- pam_x509-1.0.2/sslauth.c	2006-06-12 13:56:51.000000000 +0200
++++ pam_x509-1.0.2-new/sslauth.c	2009-03-19 21:58:13.000000000 +0100
+@@ -5,6 +5,7 @@
+ #include <dirent.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#include <syslog.h>
+ 
+ #include <openssl/ssl.h>
+ #include <openssl/safestack.h>
diff --git a/sys-auth/pam_x509/files/x509-auth b/sys-auth/pam_x509/files/x509-auth
new file mode 100644
index 0000000..8ae8eda
--- /dev/null
+++ b/sys-auth/pam_x509/files/x509-auth
@@ -0,0 +1,3 @@
+auth        required      /lib/security/pam_env.so
+auth	    sufficient	  /lib/security/pam_x509.so
+auth        required      /lib/security/pam_deny.so
diff --git a/sys-auth/pam_x509/files/x509.config b/sys-auth/pam_x509/files/x509.config
new file mode 100644
index 0000000..6256418
--- /dev/null
+++ b/sys-auth/pam_x509/files/x509.config
@@ -0,0 +1 @@
+/CN:-r
-- 
cgit v1.2.3