Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37496101
en ru br
Репозитории ALT
S:9.4p1-alt1
5.1: 5.3p1-alt1
4.1: 5.0p1-alt3
4.0: 5.0p1-alt3
+updates:4.7p1-alt1
3.0: 3.6.1p2-alt6
www.altlinux.org/Changes

Группа :: Сети/Удалённый доступ
Пакет: openssh

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: openssh-3.6.1p1-alt-ssh-add.patch
Скачать


diff -uprk.orig openssh-3.6.1p1.orig/ssh-add.c openssh-3.6.1p1/ssh-add.c
--- openssh-3.6.1p1.orig/ssh-add.c	2003-03-10 03:21:18 +0300
+++ openssh-3.6.1p1/ssh-add.c	2003-04-11 18:53:41 +0400
@@ -131,16 +131,11 @@ delete_all(AuthenticationConnection *ac)
 static int
 add_file(AuthenticationConnection *ac, const char *filename)
 {
-	struct stat st;
 	Key *private;
 	char *comment = NULL;
 	char msg[1024];
 	int ret = -1;
 
-	if (stat(filename, &st) < 0) {
-		perror(filename);
-		return -1;
-	}
 	/* At first, try empty passphrase */
 	private = key_load_private(filename, "", &comment);
 	if (comment == NULL)
@@ -278,8 +273,20 @@ lock_agent(AuthenticationConnection *ac,
 }
 
 static int
+file_not_found(const char *fname)
+{
+	struct stat st;
+	return stat(fname, &st);
+}
+
+static int
 do_file(AuthenticationConnection *ac, int deleting, char *file)
 {
+	if (file_not_found(file)) {
+		perror(file);
+		return -1;
+	}
+
 	if (deleting) {
 		if (delete_file(ac, file) == -1)
 			return -1;
@@ -385,7 +392,6 @@ main(int argc, char **argv)
 	if (argc == 0) {
 		char buf[MAXPATHLEN];
 		struct passwd *pw;
-		struct stat st;
 		int count = 0;
 
 		if ((pw = getpwuid(getuid())) == NULL) {
@@ -398,7 +404,7 @@ main(int argc, char **argv)
 		for(i = 0; default_files[i]; i++) {
 			snprintf(buf, sizeof(buf), "%s/%s", pw->pw_dir,
 			    default_files[i]);
-			if (stat(buf, &st) < 0)
+			if (file_not_found(buf))
 				continue;
 			if (do_file(ac, deleting, buf) == -1)
 				ret = 1;
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin