mirror of
https://github.com/git/git.git
synced 2026-03-13 10:23:30 +01:00
Revert NO_ETC_PASSWD hack.
This hack was introduced to work around missing Unix-like user database. But it turns out that the functionality required can easily be faked, Which happens in a follow-up patch.
This commit is contained in:
3
Makefile
3
Makefile
@@ -500,7 +500,6 @@ ifneq (,$(findstring MINGW,$(uname_S)))
|
||||
NO_CURL=YesPlease
|
||||
NO_SYMLINK_HEAD=YesPlease
|
||||
NO_IPV6=YesPlease
|
||||
NO_ETC_PASSWD=YesPlease
|
||||
NO_SETENV=YesPlease
|
||||
NO_UNSETENV=YesPlease
|
||||
NO_STRCASESTR=YesPlease
|
||||
@@ -513,7 +512,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
|
||||
NO_MKDTEMP = YesPlease
|
||||
NO_SVN_TESTS=YesPlease
|
||||
NO_PERL_MAKEMAKER=YesPlease
|
||||
COMPAT_CFLAGS += -DNO_ETC_PASSWD -DNO_ST_BLOCKS -DSTRIP_EXTENSION=\".exe\" -D__USE_MINGW_ACCESS -DNOGDI -I compat
|
||||
COMPAT_CFLAGS += -DNO_ST_BLOCKS -DSTRIP_EXTENSION=\".exe\" -D__USE_MINGW_ACCESS -DNOGDI -I compat
|
||||
COMPAT_OBJS += compat/mingw.o compat/fnmatch.o compat/regex.o
|
||||
EXTLIBS += -lws2_32
|
||||
X = .exe
|
||||
|
||||
@@ -63,8 +63,6 @@ int mkstemp (char *__template);
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#ifndef NO_ETC_PASSWD
|
||||
#include <netdb.h>
|
||||
#include <pwd.h>
|
||||
#include <inttypes.h>
|
||||
@@ -431,7 +429,6 @@ int symlink(const char *oldpath, const char *newpath);
|
||||
int fchmod(int fildes, mode_t mode);
|
||||
int lstat(const char *file_name, struct stat *buf);
|
||||
|
||||
/* missing: link, mkstemp, fchmod, getuid (?), gettimeofday */
|
||||
int socketpair(int d, int type, int protocol, int sv[2]);
|
||||
#define AF_UNIX 0
|
||||
#define SOCK_STREAM 0
|
||||
|
||||
13
ident.c
13
ident.c
@@ -9,8 +9,6 @@
|
||||
|
||||
static char git_default_date[50];
|
||||
|
||||
#ifndef NO_ETC_PASSWD
|
||||
|
||||
static void copy_gecos(const struct passwd *w, char *name, size_t sz)
|
||||
{
|
||||
char *src, *dst;
|
||||
@@ -72,11 +70,8 @@ static void copy_email(const struct passwd *pw)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void setup_ident(void)
|
||||
{
|
||||
#ifndef NO_ETC_PASSWD
|
||||
struct passwd *pw = NULL;
|
||||
|
||||
/* Get the name ("gecos") */
|
||||
@@ -101,7 +96,6 @@ static void setup_ident(void)
|
||||
copy_email(pw);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* And set the default date */
|
||||
if (!git_default_date[0])
|
||||
@@ -212,9 +206,7 @@ const char *fmt_ident(const char *name, const char *email,
|
||||
email = git_default_email;
|
||||
|
||||
if (!*name) {
|
||||
#ifndef NO_ETC_PASSWD
|
||||
struct passwd *pw;
|
||||
#endif
|
||||
|
||||
if (0 <= error_on_no_name &&
|
||||
name == git_default_name && env_hint) {
|
||||
@@ -223,16 +215,11 @@ const char *fmt_ident(const char *name, const char *email,
|
||||
}
|
||||
if (0 < error_on_no_name)
|
||||
die("empty ident %s <%s> not allowed", name, email);
|
||||
#ifndef NO_ETC_PASSWD
|
||||
pw = getpwuid(getuid());
|
||||
if (!pw)
|
||||
die("You don't exist. Go away!");
|
||||
strlcpy(git_default_name, pw->pw_name,
|
||||
sizeof(git_default_name));
|
||||
#else
|
||||
strlcpy(git_default_name, "unknown",
|
||||
sizeof(git_default_name));
|
||||
#endif
|
||||
name = git_default_name;
|
||||
}
|
||||
|
||||
|
||||
11
path.c
11
path.c
@@ -141,8 +141,6 @@ int validate_headref(const char *path)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifndef NO_ETC_PASSWD
|
||||
|
||||
static char *user_path(char *buf, char *path, int sz)
|
||||
{
|
||||
struct passwd *pw;
|
||||
@@ -182,15 +180,6 @@ static char *user_path(char *buf, char *path, int sz)
|
||||
return buf;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static char *user_path(char *buf, char *path, int sz)
|
||||
{
|
||||
return getenv("HOME");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* First, one directory to try is determined by the following algorithm.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user