ape: add PASS_MAX constant for getpass() to limits.h (from patch/ape-pass_max)

add PASS_MAX to limits.h for ape, and make getpass respect it. also increase the size of
the maximum passwords (we use long ones at work). Needed for native port of SVN (in progress).
This commit is contained in:
cinap_lenrek 2013-02-28 19:21:03 +01:00
parent 8a903895a0
commit 8b72726549
2 changed files with 4 additions and 2 deletions

View file

@ -65,6 +65,7 @@
#define NGROUPS_MAX 10
/*#define OPEN_MAX _POSIX_OPEN_MAX */
/*#define PAGESIZE 1 */
#define PASS_MAX 64
/*#define PATH_MAX _POSIX_PATH_MAX */
/*#define PIPE_BUF _POSIX_PIPE_BUF */
/*#define RTSIG_MAX _POSIX_RTSIG_MAX */

View file

@ -2,6 +2,7 @@
#define _RESEARCH_SOURCE
#include <stdio.h>
#include <signal.h>
#include <limits.h>
#include <libv.h>
char *
@ -10,7 +11,7 @@ getpass(char *prompt)
int c;
char *p;
FILE *fi;
static char pbuf[9];
static char pbuf[PASS_MAX];
void (*sig)(int);
if ((fi = fopen("/dev/cons", "r")) == NULL)
@ -28,7 +29,7 @@ getpass(char *prompt)
else if (c == '\b') {
if (p > pbuf)
p--;
} else if (p < &pbuf[8])
} else if (p < &pbuf[sizeof(pbuf)-1])
*p++ = c;
*p = '\0';