diff -Nurd ldapvi-1.7.orig/NEWS ldapvi-1.7/NEWS --- ldapvi-1.7.orig/NEWS 2007-05-05 06:17:26.000000000 -0400 +++ ldapvi-1.7/NEWS 2021-05-31 22:42:24.000000000 -0400 @@ -1,3 +1,6 @@ +1.8 2007-mm-dd + - new configuration option `unpaged-help' + 1.7 2007-05-05 - Fixed buffer overrun in home_filename(), thanks to Thomas Friebel. diff -Nurd ldapvi-1.7.orig/arguments.c ldapvi-1.7/arguments.c --- ldapvi-1.7.orig/arguments.c 2007-05-05 06:17:26.000000000 -0400 +++ ldapvi-1.7/arguments.c 2021-05-31 22:42:24.000000000 -0400 @@ -115,7 +115,7 @@ OPTION_NOQUESTIONS, OPTION_LDAPSEARCH, OPTION_LDAPMODIFY, OPTION_LDAPDELETE, OPTION_LDAPMODDN, OPTION_LDAPMODRDN, OPTION_ADD, OPTION_CONFIG, OPTION_READ, OPTION_LDAP_CONF, OPTION_BIND, - OPTION_BIND_DIALOG + OPTION_BIND_DIALOG, OPTION_UNPAGED_HELP }; static struct poptOption options[] = { @@ -170,14 +170,16 @@ {"ldapdelete", 0, 0, 0, OPTION_LDAPDELETE, 0, 0}, {"ldapmoddn", 0, 0, 0, OPTION_LDAPMODDN, 0, 0}, {"ldapmodrdn", 0, 0, 0, OPTION_LDAPMODRDN, 0, 0}, + {"unpaged-help", 0, 0, 0, OPTION_UNPAGED_HELP, 0, 0}, {0, 0, 0, 0, 0} }; +static int usage_pagerp = 1; void usage(int fd, int rc) { - if (fd == -1 && rc == 0 && isatty(1)) { + if (usage_pagerp && fd == -1 && rc == 0 && isatty(1)) { int fd; int pid = pipeview(&fd); write(fd, USAGE, strlen(USAGE)); @@ -479,6 +481,9 @@ case OPTION_LDAP_CONF: result->profileonlyp = 0; break; + case OPTION_UNPAGED_HELP: + usage_pagerp = 0; + break; case 'p': parse_configuration(arg, result, ctrls); break; diff -Nurd ldapvi-1.7.orig/common.h ldapvi-1.7/common.h --- ldapvi-1.7.orig/common.h 2007-05-05 06:17:26.000000000 -0400 +++ ldapvi-1.7/common.h 2021-05-31 23:40:11.000000000 -0400 @@ -273,7 +273,7 @@ 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); @@ -282,6 +282,7 @@ int adjoin_ptr(GPtrArray *, void *); void init_dialog(tdialog *, enum dialog_mode, char *, char *); void dialog(char *header, tdialog *, int, int); +void fdcp(int fdsrc, int fddst); /* * schema.c @@ -344,6 +345,10 @@ int g_string_append_md5(GString *string, char *key); int g_string_append_smd5(GString *string, char *key); +#ifndef HAVE_ON_EXIT +int on_exit(void (*function)(int, void *), void *arg); +#endif + /* * base64.c */ diff -Nurd ldapvi-1.7.orig/config.h.in ldapvi-1.7/config.h.in --- ldapvi-1.7.orig/config.h.in 2007-05-05 06:17:26.000000000 -0400 +++ ldapvi-1.7/config.h.in 2021-05-31 22:42:24.000000000 -0400 @@ -5,5 +5,6 @@ #undef HAVE_OPENSSL #undef HAVE_GNUTLS #undef HAVE_SHA1 +#undef HAVE_MD5 #undef RAND_PSEUDO_BYTES #undef HAVE_SASL diff -Nurd ldapvi-1.7.orig/configure.in ldapvi-1.7/configure.in --- ldapvi-1.7.orig/configure.in 2007-05-05 06:17:26.000000000 -0400 +++ ldapvi-1.7/configure.in 2021-05-31 23:31:44.000000000 -0400 @@ -30,7 +30,7 @@ AC_CHECK_LIB([lber],[main]) AC_CHECK_LIB([ldap],[main],:,AC_MSG_ERROR([libldap not found])) AC_CHECK_LIB([ldap],[ldap_initialize],,AC_MSG_ERROR([libldap present but obsolete])) -AC_CHECK_LIB([ldap],[ldap_bv2dn_x],AC_DEFINE(LIBLDAP22),AC_DEFINE(LIBLDAP21)) +AC_CHECK_LIB([ldap],[ldap_bv2dn],AC_DEFINE(LIBLDAP22),AC_DEFINE(LIBLDAP21)) # sasl AC_CHECK_HEADER([sasl/sasl.h],AC_DEFINE(HAVE_SASL),AC_MSG_WARN([SASL support disabled])) @@ -73,11 +73,14 @@ AC_DEFINE(HAVE_GNUTLS) AC_DEFINE(SHA_DIGEST_LENGTH,20) ;; + none) + ;; *) AC_MSG_ERROR([invalid value --with-libcrypto=$with_libcrypto, expected openssl or gnutls]) ;; esac AC_CHECK_FUNCS([SHA1]) +AC_CHECK_FUNCS([MD5]) AC_CHECK_FUNCS([RAND_pseudo_bytes]) AC_CHECK_LIB([crypt],[main]) diff -Nurd ldapvi-1.7.orig/diff.c ldapvi-1.7/diff.c --- ldapvi-1.7.orig/diff.c 2007-05-05 06:17:26.000000000 -0400 +++ ldapvi-1.7/diff.c 2021-05-31 23:32:25.000000000 -0400 @@ -215,7 +215,7 @@ struct berval bv; bv.bv_val = str; bv.bv_len = strlen(str); - ldap_bv2dn_x(&bv, out, flags); + ldap_bv2dn(&bv, out, flags); } #else #error oops diff -Nurd ldapvi-1.7.orig/error.c ldapvi-1.7/error.c --- ldapvi-1.7.orig/error.c 2007-05-05 06:17:26.000000000 -0400 +++ ldapvi-1.7/error.c 2021-05-31 23:38:48.000000000 -0400 @@ -18,6 +18,7 @@ #include #include #include +#define LDAP_DEPRECATED 1 #include #include #include diff -Nurd ldapvi-1.7.orig/ldapvi.1 ldapvi-1.7/ldapvi.1 --- ldapvi-1.7.orig/ldapvi.1 2007-05-05 06:17:26.000000000 -0400 +++ ldapvi-1.7/ldapvi.1 2021-05-31 22:42:24.000000000 -0400 @@ -41,7 +41,7 @@ .TP \fB\-\-bind\-dialog\fR [never,auto,always] Interactive login dialog. -.SS "SASL options (these parameters set --bind sasl):" +.SS "SASL options (these parameters set \-\-bind sasl):" .HP \fB\-I\fR, \fB\-\-sasl\-interactive\fR Set \fB\-\-bind\-dialog\fR always. .TP @@ -177,10 +177,10 @@ Assuming a suitably configured LDAP library, run ldapvi without arguments to see all entries available. -Otherwise, try `ldapvi -h HOSTNAME --discover' to query the ROOT DSE for +Otherwise, try `ldapvi \-h HOSTNAME \-\-discover' to query the ROOT DSE for available naming contexts. -Once that works, run `ldapvi -h HOSTNAME --discover --config' to +Once that works, run `ldapvi \-h HOSTNAME \-\-discover \-\-config' to generate sample configuration that can be pasted into ~/.ldaprc or /etc/ldap/ldap.conf. diff -Nurd ldapvi-1.7.orig/ldapvi.1.in ldapvi-1.7/ldapvi.1.in --- ldapvi-1.7.orig/ldapvi.1.in 2007-05-05 06:17:26.000000000 -0400 +++ ldapvi-1.7/ldapvi.1.in 2021-05-31 22:42:24.000000000 -0400 @@ -2,10 +2,10 @@ Assuming a suitably configured LDAP library, run ldapvi without arguments to see all entries available. -Otherwise, try `ldapvi -h HOSTNAME --discover' to query the ROOT DSE for +Otherwise, try `ldapvi \-h HOSTNAME \-\-discover' to query the ROOT DSE for available naming contexts. -Once that works, run `ldapvi -h HOSTNAME --discover --config' to +Once that works, run `ldapvi \-h HOSTNAME \-\-discover \-\-config' to generate sample configuration that can be pasted into ~/.ldaprc or /etc/ldap/ldap.conf. diff -Nurd ldapvi-1.7.orig/ldapvi.c ldapvi-1.7/ldapvi.c --- ldapvi-1.7.orig/ldapvi.c 2007-05-05 06:17:26.000000000 -0400 +++ ldapvi-1.7/ldapvi.c 2021-05-31 22:42:24.000000000 -0400 @@ -470,7 +470,7 @@ 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 @@ 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 -*- vim:fileencoding=utf-8:\n", s); nlines++; } if (cmdline->ldif) { diff -Nurd ldapvi-1.7.orig/manual/manual.xml ldapvi-1.7/manual/manual.xml --- ldapvi-1.7.orig/manual/manual.xml 2007-05-05 06:17:26.000000000 -0400 +++ ldapvi-1.7/manual/manual.xml 2021-05-31 22:42:24.000000000 -0400 @@ -718,6 +718,10 @@ suppress-configuration="suppress-configuration"> Print help on command line arguments. + + Disable the use of a pager + for --help. + When changing the relative distinguished name to a new attribute value, delete the old attribute value instead of keeping it. diff -Nurd ldapvi-1.7.orig/misc.c ldapvi-1.7/misc.c --- ldapvi-1.7.orig/misc.c 2007-05-05 06:17:26.000000000 -0400 +++ ldapvi-1.7/misc.c 2021-05-31 22:42:24.000000000 -0400 @@ -163,7 +163,9 @@ vi = getenv("VISUAL"); if (!vi) vi = getenv("EDITOR"); - if (!vi) vi = "vi"; + /* changed from "vi" as fallback to "sensible-editor" which is what + * Debian really uses (closes: #367995) */ + if (!vi) vi = "sensible-editor"; switch ( (childpid = fork())) { case -1: @@ -204,7 +206,9 @@ char *clear = tigetstr("clear"); pg = getenv("PAGER"); - if (!pg) pg = "less"; + /* changed from "less" as fallback to "sensible-pager" which is what + * Debian really uses */ + if (!pg) pg = "sensible-pager"; if (!invalidp(clear)) putp(clear); @@ -231,7 +235,9 @@ int fds[2]; pg = getenv("PAGER"); - if (!pg) pg = "less"; + /* changed from "less" as fallback to "sensible-pager" which is what + * Debian really uses */ + if (!pg) pg = "sensible-pager"; if (!invalidp(clear)) putp(clear); @@ -315,7 +321,7 @@ } char * -getline(char *prompt, char *value) +ldapvi_getline(char *prompt, char *value) { tdialog d; init_dialog(&d, DIALOG_DEFAULT, prompt, value); diff -Nurd ldapvi-1.7.orig/port.c ldapvi-1.7/port.c --- ldapvi-1.7.orig/port.c 2007-05-05 06:17:26.000000000 -0400 +++ ldapvi-1.7/port.c 2021-05-31 22:52:42.000000000 -0400 @@ -31,6 +31,7 @@ #include #include "config.h" +#include "common.h" #if defined(HAVE_OPENSSL) #include @@ -39,7 +40,7 @@ #include #include #else -#error oops +#warning Compiling without cryptographic routines. #endif #ifndef HAVE_RAND_PSEUDO_BYTES @@ -148,15 +149,21 @@ int g_string_append_md5(GString *string, char *key) { +#ifdef HAVE_MD5 unsigned char tmp[MD5_DIGEST_LENGTH]; MD5((unsigned char *) key, strlen(key), tmp); g_string_append_base64(string, tmp, sizeof(tmp)); return 1; +#else + puts("Sorry, MD5 support not linked into ldapvi."); + return 0; +#endif } int g_string_append_smd5(GString *string, char *key) { +#ifdef HAVE_MD5 unsigned char rand[4]; unsigned char tmp[MD5_DIGEST_LENGTH + sizeof(rand)]; MD5_CTX MD5context; @@ -172,4 +179,8 @@ g_string_append_base64(string, tmp, sizeof(tmp)); return 1; +#else + puts("Sorry, SMD5 support not linked into ldapvi."); + return 0; +#endif }