Created
July 7, 2015 19:29
-
-
Save moguriso/9c1c39bc97a4d299608f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 33c9fab31b9427de02aad92dd1bbcda332b9d129 Mon Sep 17 00:00:00 2001 | |
From: Yuya Adachi <moguriso@tizen.moe> | |
Date: Wed, 8 Jul 2015 03:53:41 +0900 | |
Subject: [PATCH] tentative | |
--- | |
src/acls.c | 2 +- | |
src/attacher.c | 9 +++++---- | |
src/process.c | 4 ++-- | |
src/screen.h | 1 + | |
src/socket.c | 4 ++-- | |
src/utmp.c | 11 +++++++++++ | |
src/winmsg.c | 2 ++ | |
7 files changed, 24 insertions(+), 9 deletions(-) | |
diff --git a/src/acls.c b/src/acls.c | |
index eccdf88..95f9cdc 100644 | |
--- a/src/acls.c | |
+++ b/src/acls.c | |
@@ -384,7 +384,7 @@ const char *pw, *password; | |
{ | |
if (!*password) | |
return 0; | |
- char *buf = crypt((char *)pw, (char *)password); | |
+ char *buf = DES_crypt((char *)pw, (char *)password); | |
return (buf && !strcmp(buf, password)); | |
} | |
diff --git a/src/attacher.c b/src/attacher.c | |
index 2a80f64..0cae2d2 100644 | |
--- a/src/attacher.c | |
+++ b/src/attacher.c | |
@@ -46,6 +46,8 @@ | |
#include "socket.h" | |
#include "tty.h" | |
+#define _NSIG 65 | |
+ | |
static int WriteMessage(int, struct msg *); | |
static void AttacherSigInt(int); | |
static void AttacherWinch(int); | |
@@ -547,8 +549,7 @@ static void screen_builtin_lck() | |
} | |
} | |
} | |
- if (pass == 0) { | |
- fprintf(stderr, "Getpass error.\007\n"); | |
+ if (pass == 0) { fprintf(stderr, "Getpass error.\007\n"); | |
sleep(2); | |
return; | |
} | |
@@ -556,7 +557,7 @@ static void screen_builtin_lck() | |
salt[0] = 'A' + (int)(time(0) % 26); | |
salt[1] = 'A' + (int)((time(0) >> 6) % 26); | |
salt[2] = 0; | |
- pass = crypt(mypass, salt); | |
+ pass = DES_crypt(mypass, salt); | |
if (!pass) { | |
fprintf(stderr, "crypt() error.\007\n"); | |
sleep(2); | |
@@ -612,7 +613,7 @@ static void screen_builtin_lck() | |
break; | |
#endif | |
} else { | |
- char *buf = crypt(cp1, pass); | |
+ char *buf = DES_crypt(cp1, pass); | |
if (buf && !strncmp(buf, pass, strlen(pass))) | |
break; | |
} | |
diff --git a/src/process.c b/src/process.c | |
index 69f1e33..a4fd41b 100644 | |
--- a/src/process.c | |
+++ b/src/process.c | |
@@ -5282,11 +5282,11 @@ static void pass2(char *buf, size_t len, void *data) | |
for (st = 0; st < 2; st++) | |
salt[st] = 'A' + (int)((time(0) >> 6 * st) % 26); | |
salt[2] = 0; | |
- buf = crypt(u->u_password, salt); | |
+ buf = DES_crypt(u->u_password, salt); | |
memset(u->u_password, 0, strlen(u->u_password)); | |
free((char *)u->u_password); | |
if (!buf) { | |
- Msg(0, "[ crypt() error - no secure ]"); | |
+ Msg(0, "[ DES_crypt() error - no secure ]"); | |
u->u_password = NullStr; | |
return; | |
} | |
diff --git a/src/screen.h b/src/screen.h | |
index 01d996b..61fd380 100644 | |
--- a/src/screen.h | |
+++ b/src/screen.h | |
@@ -31,6 +31,7 @@ | |
#define SCREEN_SCREEN_H | |
#include <stdbool.h> | |
+#include <openssl/des.h> | |
#include "os.h" | |
diff --git a/src/socket.c b/src/socket.c | |
index 7538df2..0456495 100644 | |
--- a/src/socket.c | |
+++ b/src/socket.c | |
@@ -1085,12 +1085,12 @@ static void PasswordProcessInput(char *ibuf, int ilen) | |
char *buf = NULL; | |
up = D_user->u_password; | |
pwdata->buf[l] = 0; | |
- buf = crypt(pwdata->buf, up); | |
+ buf = DES_crypt(pwdata->buf, up); | |
if (!buf || strncmp(buf, up, strlen(up))) { | |
/* uh oh, user failed */ | |
memset(pwdata->buf, 0, sizeof(pwdata->buf)); | |
if (!buf) | |
- AddStr("\r\ncrypt() failed.\r\n"); | |
+ AddStr("\r\nDES_crypt() failed.\r\n"); | |
else | |
AddStr("\r\nPassword incorrect.\r\n"); | |
D_processinputdata = 0; /* otherwise freed by FreeDis */ | |
diff --git a/src/utmp.c b/src/utmp.c | |
index 8f84a11..a969aea 100644 | |
--- a/src/utmp.c | |
+++ b/src/utmp.c | |
@@ -459,8 +459,10 @@ static int pututslot(slot_t slot, struct utmp *u, char *host, Window *win) | |
static void makedead(struct utmp *u) | |
{ | |
u->ut_type = DEAD_PROCESS; | |
+#if 0 /* mog test */ | |
u->ut_exit.e_termination = 0; | |
u->ut_exit.e_exit = 0; | |
+#endif /* mog test */ | |
u->ut_user[0] = 0; /* for Digital UNIX, kilbi@rad.rwth-aachen.de */ | |
} | |
@@ -476,7 +478,11 @@ static void makeuser(struct utmp *u, char *line, char *user, int pid) | |
/* must use temp variable because of NetBSD/sparc64, where | |
* ut_xtime is long(64) but time_t is int(32) */ | |
(void)time(&now); | |
+#if 1 /* mog test */ | |
+ u->ut_time = now; | |
+#else /* mog test */ | |
u->ut_tv.tv_sec = now; | |
+#endif /* mog test */ | |
} | |
static slot_t TtyNameSlot(char *nam) | |
@@ -562,7 +568,11 @@ static void makeuser(struct utmp *u, char *line, char *user, int pid) | |
strncpy(u->ut_line, line, sizeof(u->ut_line)); | |
strncpy(u->ut_name, user, sizeof(u->ut_name)); | |
(void)time(&now); | |
+#if 1 /* mog test */ | |
+ u->ut_time = now; | |
+#else /* mog test */ | |
u->ut_tv.tv_sec = now; | |
+#endif /* mog test */ | |
} | |
static slot_t TtyNameSlot(char *nam) | |
@@ -646,6 +656,7 @@ static struct ttyent *getttyent() | |
*/ | |
#if defined(BUGGYGETLOGIN) && defined(UTMP_FILE) | |
+z | |
char *getlogin() | |
{ | |
char *tty = NULL; | |
diff --git a/src/winmsg.c b/src/winmsg.c | |
index d0a1551..db50b16 100644 | |
--- a/src/winmsg.c | |
+++ b/src/winmsg.c | |
@@ -29,6 +29,8 @@ | |
**************************************************************** | |
*/ | |
+#include <alloca.h> | |
+ | |
#include "config.h" | |
#include "screen.h" | |
-- | |
2.4.5 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment