Update to ldapvi-1.8.

This commit is contained in:
ajacoutot
2026-02-15 08:30:03 +00:00
parent 8f4bf2c67b
commit cec7ed0966
11 changed files with 51 additions and 302 deletions
+5 -13
View File
@@ -1,8 +1,7 @@
COMMENT= update LDAP entries with a text editor
DISTNAME= ldapvi-1.7
DISTNAME= ldapvi-1.8
CATEGORIES= editors
REVISION= 7
HOMEPAGE= http://www.lichteblau.com/ldapvi.html
@@ -32,18 +31,11 @@ CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
NO_TEST= Yes
pre-build:
pre-configure:
sed -i "s,/etc/ldap,${SYSCONFDIR}/openldap,g" ${WRKSRC}/ldapvi.1
do-install:
cd ${WRKSRC}/manual && ${MAKE_PROGRAM} ${MAKE_FILE} manual.html
${INSTALL_DATA_DIR} ${PREFIX}/bin
${INSTALL_DATA_DIR} ${PREFIX}/man/man1
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/ldapvi
${INSTALL_PROGRAM} ${WRKSRC}/ldapvi ${PREFIX}/bin
${INSTALL_DATA} ${WRKSRC}/ldapvi.1 ${PREFIX}/man/man1
${INSTALL_DATA} ${WRKSRC}/manual/bg.png \
${WRKSRC}/manual/manual.css \
${WRKSRC}/manual/manual.html ${PREFIX}/share/doc/ldapvi
post-install:
# empty dir
rmdir ${PREFIX}/share/doc/ldapvi/
.include <bsd.port.mk>
+2 -2
View File
@@ -1,2 +1,2 @@
SHA256 (ldapvi-1.7.tar.gz) = b2LpLSD/KsDQYSUCSpFLhiLluKCgwtOQvz55kMvS4VM=
SIZE (ldapvi-1.7.tar.gz) = 119503
SHA256 (ldapvi-1.8.tar.gz) = NZyE1hGYxLS2KTDiFnDAd8OApBoSHymTEzMJB5Z5Sds=
SIZE (ldapvi-1.8.tar.gz) = 148823
-79
View File
@@ -1,79 +0,0 @@
add -y / password-file support, from upstream git bda806b0c311
--- arguments.c.orig Sat May 5 11:17:26 2007
+++ arguments.c Thu Mar 1 22:04:17 2012
@@ -40,6 +40,7 @@ static void parse_configuration(char *, cmdline *, GPt
" -D, --user USER Search filter or DN: User to bind as. [1]\n" \
" Sets --bind simple.\n" \
" -w, --password SECRET Password (also valid for SASL).\n" \
+" -y, --password-file FILE Password file (also valid for SASL).\n" \
" --bind [simple,sasl]\n" \
" Disable or enable SASL.\n" \
" --bind-dialog [never,auto,always]\n" \
@@ -131,6 +132,7 @@ static struct poptOption options[] = {
{"sasl-authzid",'X', POPT_ARG_STRING, 0, 'X', 0, 0},
{"sasl-authcid",'U', POPT_ARG_STRING, 0, 'U', 0, 0},
{"password", 'w', POPT_ARG_STRING, 0, 'w', 0, 0},
+ {"password-file",'y',POPT_ARG_STRING, 0, 'y', 0, 0},
{"chase", 'C', POPT_ARG_STRING, 0, 'C', 0, 0},
{"deref", 'a', POPT_ARG_STRING, 0, 'a', 0, 0},
{"sort", 'S', POPT_ARG_STRING, 0, 'S', 0, 0},
@@ -232,6 +234,30 @@ init_cmdline(cmdline *cmdline)
}
static void
+read_password_file(bind_options *bind_options, char *filename)
+{
+ struct stat st;
+ int fd;
+ char *data;
+ char *ptr;
+
+ if (stat(filename, &st) == -1) {
+ fprintf(stderr, "Failed to stat password file: %s\n",
+ filename);
+ exit(1);
+ }
+ data = xalloc(st.st_size + 1);
+ if ( (fd = open(filename, O_RDONLY)) == -1) syserr();
+ if (read(fd, data, st.st_size) != st.st_size) syserr();
+ close(fd);
+ data[st.st_size] = 0;
+ if ( (ptr = strchr(data, '\n')))
+ *ptr = 0;
+
+ bind_options->password = data;
+}
+
+static void
parse_argument(int c, char *arg, cmdline *result, GPtrArray *ctrls)
{
LDAPControl *control;
@@ -264,6 +290,9 @@ parse_argument(int c, char *arg, cmdline *result, GPtr
case 'w':
result->bind_options.password = arg;
break;
+ case 'y':
+ read_password_file(&result->bind_options, arg);
+ break;
case 'd':
result->discover = 1;
break;
@@ -577,7 +606,7 @@ parse_configuration(char *profile_name, cmdline *resul
}
if (!p)
break;
- if (strcmp(entry_dn(p), profile_name))
+ if (strcmp(entry_dn(p), profile_name))
entry_free(p);
else if (profile_found)
duplicate = 1;
@@ -683,7 +712,7 @@ parse_arguments(int argc, const char **argv, cmdline *
break;
default:
abort();
- }
+ }
if (result->profileonlyp)
if (setenv("LDAPNOINIT", "thanks", 1)) syserr();
-11
View File
@@ -1,11 +0,0 @@
--- common.h.orig Fri Mar 16 22:02:48 2012
+++ common.h Fri Mar 16 22:02:54 2012
@@ -273,7 +273,7 @@ void pipeview_wait(int pid);
char *home_filename(char *name);
void read_ldapvi_history(void);
void write_ldapvi_history(void);
-char *getline(char *prompt, char *value);
+char *ldapvi_getline(char *prompt, char *value);
char *get_password();
char *append(char *a, char *b);
void *xalloc(size_t size);
+26 -48
View File
@@ -1,74 +1,52 @@
OpenBSD does NOT require -lcrypt, DES encryption is part of the standard libc.
--- configure.orig Sat May 5 12:17:40 2007
+++ configure Thu Jan 12 14:41:38 2012
@@ -5032,69 +5032,6 @@ done
Index: configure
--- configure.orig
+++ configure
@@ -4240,46 +4240,6 @@ then :
fi
-{ echo "$as_me:$LINENO: checking for main in -lcrypt" >&5
-echo $ECHO_N "checking for main in -lcrypt... $ECHO_C" >&6; }
-if test "${ac_cv_lib_crypt_main+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for main in -lcrypt" >&5
-printf %s "checking for main in -lcrypt... " >&6; }
-if test ${ac_cv_lib_crypt_main+y}
-then :
- printf %s "(cached) " >&6
-else $as_nop
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcrypt $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-main (void)
-{
-return main ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
-if ac_fn_c_try_link "$LINENO"
-then :
- ac_cv_lib_crypt_main=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_lib_crypt_main=no
-else $as_nop
- ac_cv_lib_crypt_main=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-rm -f core conftest.err conftest.$ac_objext conftest.beam \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_crypt_main" >&5
-echo "${ECHO_T}$ac_cv_lib_crypt_main" >&6; }
-if test $ac_cv_lib_crypt_main = yes; then
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBCRYPT 1
-_ACEOF
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypt_main" >&5
-printf "%s\n" "$ac_cv_lib_crypt_main" >&6; }
-if test "x$ac_cv_lib_crypt_main" = xyes
-then :
- printf "%s\n" "#define HAVE_LIBCRYPT 1" >>confdefs.h
-
- LIBS="-lcrypt $LIBS"
-
-fi
-
# Check whether --with-dummy was given.
-47
View File
@@ -1,47 +0,0 @@
preserve order of attribute values, from git upstream 3ae1458bb7
--- diff.c.orig Sat May 5 11:17:26 2007
+++ diff.c Thu Mar 1 22:19:30 2012
@@ -46,22 +46,32 @@ compare_ptr_arrays(GPtrArray *a, GPtrArray *b,
for (; i < a->len; i++) note(g_ptr_array_index(a, i), 0, x);
}
-static void
-note_values(GArray *a, GArray *b, int *changed)
+static int
+ordered_array_equal(GPtrArray *a, GPtrArray *b,
+ int (*cmp)(const void *, const void *))
{
- if (!(a && b)) *changed = 1;
+ int i;
+
+ if (a->len != b->len)
+ return 0;
+
+ for (i = 0; i < a->len; i++) {
+ void *ax = g_ptr_array_index(a, i);
+ void *bx = g_ptr_array_index(b, i);
+ if (cmp(&ax, &bx))
+ return 0;
+ }
+
+ return 1;
}
static void
compare_attributes(tattribute *clean, tattribute *new, GPtrArray *mods)
{
- int changed = 0;
- compare_ptr_arrays(attribute_values(clean),
- attribute_values(new),
- carray_ptr_cmp,
- (note_function) note_values,
- &changed);
- if (changed) {
+ if (!ordered_array_equal(attribute_values(clean),
+ attribute_values(new),
+ carray_ptr_cmp))
+ {
LDAPMod *m = attribute2mods(new);
m->mod_op |= LDAP_MOD_REPLACE;
g_ptr_array_add(mods, m);
-12
View File
@@ -1,12 +0,0 @@
--- ldapvi.1.orig Sat May 5 11:17:26 2007
+++ ldapvi.1 Thu Mar 1 22:04:17 2012
@@ -36,6 +36,9 @@ Sets \fB\-\-bind\fR simple.
\fB\-w\fR, \fB\-\-password\fR SECRET
Password (also valid for SASL).
.TP
+\fB\-y\fR, \fB\-\-password-file\fR FILENAME
+File containing user's password (also valid for SASL).
+.TP
\fB\-\-bind\fR [simple,sasl]
Disable or enable SASL.
.TP
-33
View File
@@ -1,33 +0,0 @@
rename getline to avoid future namespace collision, upstream git 256ced029c
remove pointless header which vim whines about
fix build with clang: 'copy_sasl_output' should return a value [-Wreturn-type]
--- ldapvi.c.orig Sat May 5 12:17:26 2007
+++ ldapvi.c Fri Apr 14 10:20:13 2017
@@ -470,7 +470,7 @@ change_mechanism(bind_options *bo)
bo->authmethod = LDAP_AUTH_SASL;
puts("Switching to SASL authentication.");
}
- bo->sasl_mech = getline("SASL mechanism", bo->sasl_mech);
+ bo->sasl_mech = ldapvi_getline("SASL mechanism", bo->sasl_mech);
}
static int
@@ -1414,7 +1414,7 @@ write_file_header(FILE *s, cmdline *cmdline)
int nlines = 0;
if (print_binary_mode == PRINT_UTF8 && !cmdline->ldif) {
- fputs("# -*- coding: utf-8 -*- vim:encoding=utf-8:\n", s);
+ fputs("# -*- coding: utf-8 -*-\n", s);
nlines++;
}
if (cmdline->ldif) {
@@ -1465,7 +1465,7 @@ copy_sasl_output(FILE *out, char *sasl)
int line = 0;
int c;
- if (lstat(sasl, &st) == -1) return;
+ if (lstat(sasl, &st) == -1) return 0;
if ( !(in = fopen(sasl, "r"))) syserr();
if (st.st_size > 0) {
-48
View File
@@ -1,48 +0,0 @@
fix possible LP64 issue (improper sentinel)
allow editors/pagers with arguments
getline namespace collision, upstream git 256ced029c
--- misc.c.orig Sat May 5 11:17:26 2007
+++ misc.c Thu Mar 1 22:04:17 2012
@@ -172,9 +172,11 @@ edit(char *pathname, long line)
if (line > 0) {
char buf[20];
snprintf(buf, 20, "+%ld", line);
- execlp(vi, vi, buf, pathname, 0);
+ execl("/bin/sh", "sh", "-c", "exec $0 \"$@\"", vi,
+ buf, pathname, (char *) NULL);
} else
- execlp(vi, vi, pathname, 0);
+ execl("/bin/sh", "sh", "-c", "exec $0 \"$@\"", vi,
+ pathname, (char *) NULL);
syserr();
}
@@ -213,7 +215,8 @@ view(char *pathname)
case -1:
syserr();
case 0:
- execlp(pg, pg, pathname, 0);
+ execl("/bin/sh", "sh", "-c", "exec $0 \"$@\"", pg,
+ pathname, (char *) NULL);
syserr();
}
@@ -245,7 +248,7 @@ pipeview(int *fd)
close(fds[1]);
dup2(fds[0], 0);
close(fds[0]);
- execlp(pg, pg, 0);
+ execl("/bin/sh", "sh", "-c", "exec $0", pg, (char *) NULL);
syserr();
}
@@ -315,7 +318,7 @@ write_ldapvi_history()
}
char *
-getline(char *prompt, char *value)
+ldapvi_getline(char *prompt, char *value)
{
tdialog d;
init_dialog(&d, DIALOG_DEFAULT, prompt, value);
+18 -5
View File
@@ -1,9 +1,22 @@
OpenBSD does NOT require -lcrypt, DES encryption is part of the standard libc.
unbreak hash generation
http://lists.askja.de/pipermail/ldapvi/2007-October/000041.html
--- parse.c.orig Thu Mar 1 22:16:15 2012
+++ parse.c Thu Mar 1 22:16:24 2012
@@ -144,7 +144,7 @@ static char *
Index: parse.c
--- parse.c.orig
+++ parse.c
@@ -16,7 +16,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <unistd.h>
+#ifndef __OpenBSD__
#include <crypt.h>
+#endif
#include "common.h"
#define fast_g_string_append_c(gstring, c) \
@@ -144,7 +146,7 @@ static char *
cryptdes(char *key)
{
unsigned char salt[2];
@@ -12,7 +25,7 @@ http://lists.askja.de/pipermail/ldapvi/2007-October/000041.html
if (fd == -1) {
puts("Sorry, crypt not available: Cannot open /dev/random.");
return 0;
@@ -162,7 +162,7 @@ cryptmd5(char *key)
@@ -162,7 +164,7 @@ cryptmd5(char *key)
char *result;
unsigned char salt[11];
int i;
@@ -21,7 +34,7 @@ http://lists.askja.de/pipermail/ldapvi/2007-October/000041.html
if (fd == -1) {
puts("Sorry, MD5 not available: Cannot open /dev/random.");
return 0;
@@ -261,21 +261,29 @@ read_line1(FILE *s, GString *name, GString *value)
@@ -261,21 +263,29 @@ read_line1(FILE *s, GString *name, GString *value)
g_string_assign(value, "{CRYPT}");
g_string_append(value, hash);
} else if (!strcasecmp(encoding, "sha")) {
-4
View File
@@ -1,6 +1,2 @@
@bin bin/ldapvi
@man man/man1/ldapvi.1
share/doc/ldapvi/
share/doc/ldapvi/bg.png
share/doc/ldapvi/manual.css
share/doc/ldapvi/manual.html