vishalmishra434 / rpms / openssh

Forked from rpms/openssh a month ago
Clone
Jakub Jelen bbf61d
diff -up openssh/pam_ssh_agent_auth-0.10.3/get_command_line.c.psaa-compat openssh/pam_ssh_agent_auth-0.10.3/get_command_line.c
Jakub Jelen bbf61d
--- openssh/pam_ssh_agent_auth-0.10.3/get_command_line.c.psaa-compat	2016-11-13 04:24:32.000000000 +0100
Jakub Jelen 51f5c1
+++ openssh/pam_ssh_agent_auth-0.10.3/get_command_line.c	2020-02-07 10:43:05.011757956 +0100
Jakub Jelen bbf61d
@@ -27,6 +27,7 @@
Jakub Jelen bbf61d
  * or implied, of Jamie Beverly.
Jakub Jelen bbf61d
  */
Jakub Jelen bbf61d
 
Jakub Jelen bbf61d
+#include <stdlib.h>
Jakub Jelen bbf61d
 #include <stdio.h>
Jakub Jelen bbf61d
 #include <errno.h>
Jakub Jelen bbf61d
 #include <string.h>
Jakub Jelen bbf61d
@@ -65,8 +66,8 @@ proc_pid_cmdline(char *** inargv)
Jakub Jelen bdb932
                 case EOF:
Jakub Jelen bdb932
                 case '\0':
Jakub Jelen bdb932
                     if (len > 0) { 
Jakub Jelen bdb932
-                        argv = pamsshagentauth_xrealloc(argv, count + 1, sizeof(*argv));
Jakub Jelen bdb932
-                        argv[count] = pamsshagentauth_xcalloc(len + 1, sizeof(*argv[count]));
Jakub Jelen bdb932
+                        argv = xreallocarray(argv, count + 1, sizeof(*argv));
Jakub Jelen bdb932
+                        argv[count] = xcalloc(len + 1, sizeof(*argv[count]));
Jakub Jelen bdb932
                         strncpy(argv[count++], argbuf, len);
Jakub Jelen bdb932
                         memset(argbuf, '\0', MAX_LEN_PER_CMDLINE_ARG + 1);
Jakub Jelen bdb932
                         len = 0;
Jakub Jelen bbf61d
@@ -105,9 +106,9 @@ pamsshagentauth_free_command_line(char *
Jakub Jelen bdb932
 {
Jakub Jelen bdb932
     size_t i;
Jakub Jelen bdb932
     for (i = 0; i < n_args; i++)
Jakub Jelen bdb932
-        pamsshagentauth_xfree(argv[i]);
Jakub Jelen bdb932
+        free(argv[i]);
Jakub Jelen bdb932
 
Jakub Jelen bdb932
-    pamsshagentauth_xfree(argv);
Jakub Jelen bdb932
+    free(argv);
Jakub Jelen bdb932
     return;
Jakub Jelen bdb932
 }
Jakub Jelen bdb932
 
Jakub Jelen bbf61d
diff -up openssh/pam_ssh_agent_auth-0.10.3/identity.h.psaa-compat openssh/pam_ssh_agent_auth-0.10.3/identity.h
Jakub Jelen bbf61d
--- openssh/pam_ssh_agent_auth-0.10.3/identity.h.psaa-compat	2016-11-13 04:24:32.000000000 +0100
Jakub Jelen 51f5c1
+++ openssh/pam_ssh_agent_auth-0.10.3/identity.h	2020-02-07 10:43:05.011757956 +0100
Jakub Jelen bbf61d
@@ -30,8 +30,8 @@
Jakub Jelen bbf61d
 #include "openbsd-compat/sys-queue.h"
Jakub Jelen bbf61d
 #include "xmalloc.h"
Jakub Jelen bbf61d
 #include "log.h"
Jakub Jelen bbf61d
-#include "buffer.h"
Jakub Jelen bbf61d
-#include "key.h"
Jakub Jelen bbf61d
+#include "sshbuf.h"
Jakub Jelen bbf61d
+#include "sshkey.h"
Jakub Jelen bbf61d
 #include "authfd.h"
Jakub Jelen bbf61d
 #include <stdio.h>
Jakub Jelen bbf61d
 
Jakub Jelen bbf61d
@@ -41,7 +41,7 @@ typedef struct idlist Idlist;
Jakub Jelen bbf61d
 struct identity {
Jakub Jelen bbf61d
     TAILQ_ENTRY(identity) next;
Jakub Jelen bbf61d
     AuthenticationConnection *ac;   /* set if agent supports key */
Jakub Jelen bbf61d
-    Key *key;           /* public/private key */
Jakub Jelen bbf61d
+    struct sshkey *key;           /* public/private key */
Jakub Jelen bbf61d
     char    *filename;      /* comment for agent-only keys */
Jakub Jelen bbf61d
     int tried;
Jakub Jelen bbf61d
     int isprivate;      /* key points to the private key */
Jakub Jelen bbf61d
diff -up openssh/pam_ssh_agent_auth-0.10.3/iterate_ssh_agent_keys.c.psaa-compat openssh/pam_ssh_agent_auth-0.10.3/iterate_ssh_agent_keys.c
Jakub Jelen 51f5c1
--- openssh/pam_ssh_agent_auth-0.10.3/iterate_ssh_agent_keys.c.psaa-compat	2020-02-07 10:43:05.009757925 +0100
Jakub Jelen 51f5c1
+++ openssh/pam_ssh_agent_auth-0.10.3/iterate_ssh_agent_keys.c	2020-02-07 10:43:05.012757972 +0100
Jakub Jelen bbf61d
@@ -36,8 +36,8 @@
Jakub Jelen bbf61d
 #include "openbsd-compat/sys-queue.h"
Jakub Jelen bbf61d
 #include "xmalloc.h"
Jakub Jelen bbf61d
 #include "log.h"
Jakub Jelen bbf61d
-#include "buffer.h"
Jakub Jelen bbf61d
-#include "key.h"
Jakub Jelen bbf61d
+#include "sshbuf.h"
Jakub Jelen bbf61d
+#include "sshkey.h"
Jakub Jelen bbf61d
 #include "authfd.h"
Jakub Jelen bbf61d
 #include <stdio.h>
Jakub Jelen bbf61d
 #include <openssl/evp.h>
Jakub Jelen bdb932
@@ -58,6 +58,8 @@
Jakub Jelen 87ab5f
 #include "get_command_line.h"
Jakub Jelen 87ab5f
 extern char **environ;
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
+#define PAM_SSH_AGENT_AUTH_REQUESTv1 101
Jakub Jelen 87ab5f
+
Jakub Jelen 87ab5f
 /* 
Jakub Jelen 87ab5f
  * Added by Jamie Beverly, ensure socket fd points to a socket owned by the user 
Jakub Jelen 87ab5f
  * A cursory check is done, but to avoid race conditions, it is necessary 
Jakub Jelen bdb932
@@ -77,7 +79,7 @@ log_action(char ** action, size_t count)
Jakub Jelen 87ab5f
     if (count == 0)
Jakub Jelen 87ab5f
         return NULL;
Jakub Jelen 87ab5f
    
Jakub Jelen 87ab5f
-    buf = pamsshagentauth_xcalloc((count * MAX_LEN_PER_CMDLINE_ARG) + (count * 3), sizeof(*buf));
Jakub Jelen 87ab5f
+    buf = xcalloc((count * MAX_LEN_PER_CMDLINE_ARG) + (count * 3), sizeof(*buf));
Jakub Jelen 87ab5f
     for (i = 0; i < count; i++) {
Jakub Jelen 87ab5f
         strcat(buf, (i > 0) ? " '" : "'");
Jakub Jelen 87ab5f
         strncat(buf, action[i], MAX_LEN_PER_CMDLINE_ARG);
Jakub Jelen bbf61d
@@ -87,21 +89,25 @@ log_action(char ** action, size_t count)
Jakub Jelen bbf61d
 }
Jakub Jelen bbf61d
 
Jakub Jelen bbf61d
 void
Jakub Jelen bbf61d
-agent_action(Buffer *buf, char ** action, size_t count)
Jakub Jelen c60b55
+agent_action(struct sshbuf **buf, char ** action, size_t count)
Jakub Jelen 87ab5f
 {
Jakub Jelen 87ab5f
     size_t i;
Jakub Jelen 87ab5f
-    pamsshagentauth_buffer_init(buf);
Jakub Jelen bbf61d
+    int r;
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
-    pamsshagentauth_buffer_put_int(buf, count);
Jakub Jelen c60b55
+    if ((*buf = sshbuf_new()) == NULL)
Jakub Jelen bbf61d
+        fatal("%s: sshbuf_new failed", __func__);
Jakub Jelen c60b55
+    if ((r = sshbuf_put_u32(*buf, count)) != 0)
Jakub Jelen bbf61d
+        fatal("%s: buffer error: %s", __func__, ssh_err(r));
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
     for (i = 0; i < count; i++) {
Jakub Jelen 87ab5f
-        pamsshagentauth_buffer_put_cstring(buf, action[i]);
Jakub Jelen c60b55
+        if ((r = sshbuf_put_cstring(*buf, action[i])) != 0)
Jakub Jelen bbf61d
+            fatal("%s: buffer error: %s", __func__, ssh_err(r));
Jakub Jelen 87ab5f
     }
Jakub Jelen 87ab5f
 }
Jakub Jelen 87ab5f
 
Jakub Jelen bbf61d
 
Jakub Jelen bbf61d
-void
Jakub Jelen bbf61d
-pamsshagentauth_session_id2_gen(Buffer * session_id2, const char * user,
Jakub Jelen bbf61d
+static void
Jakub Jelen bbf61d
+pamsshagentauth_session_id2_gen(struct sshbuf ** session_id2, const char * user,
Jakub Jelen bbf61d
                                 const char * ruser, const char * servicename)
Jakub Jelen bbf61d
 {
Jakub Jelen bbf61d
     u_char *cookie = NULL;
Jakub Jelen 51f5c1
@@ -114,22 +120,23 @@ pamsshagentauth_session_id2_gen(Buffer *
Jakub Jelen bbf61d
     char ** reported_argv = NULL;
Jakub Jelen bbf61d
     size_t count = 0;
Jakub Jelen bbf61d
     char * action_logbuf = NULL;
Jakub Jelen bbf61d
-    Buffer action_agentbuf;
Jakub Jelen bbf61d
+    struct sshbuf *action_agentbuf = NULL;
Jakub Jelen bbf61d
     uint8_t free_logbuf = 0;
Jakub Jelen 87ab5f
     char * retc;
Jakub Jelen 87ab5f
     int32_t reti;
Jakub Jelen bbf61d
+    int r;
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
-    rnd = pamsshagentauth_arc4random();
Jakub Jelen 87ab5f
+    rnd = arc4random();
Jakub Jelen 87ab5f
     cookie_len = ((uint8_t) rnd);
Jakub Jelen 87ab5f
     while (cookie_len < 16) { 
Jakub Jelen 87ab5f
         cookie_len += 16;                                          /* Add 16 bytes to the size to ensure that while the length is random, the length is always reasonable; ticket #18 */
Jakub Jelen 87ab5f
     }
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
-    cookie = pamsshagentauth_xcalloc(1,cookie_len);
Jakub Jelen bbf61d
+    cookie = xcalloc(1, cookie_len);
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
     for (i = 0; i < cookie_len; i++) {
Jakub Jelen 87ab5f
         if (i % 4 == 0) {
Jakub Jelen 87ab5f
-            rnd = pamsshagentauth_arc4random();
Jakub Jelen 87ab5f
+            rnd = arc4random();
Jakub Jelen 87ab5f
         }
Jakub Jelen 87ab5f
         cookie[i] = (u_char) rnd;
Jakub Jelen 87ab5f
         rnd >>= 8;
Jakub Jelen 51f5c1
@@ -144,7 +151,8 @@ pamsshagentauth_session_id2_gen(Buffer *
Jakub Jelen 87ab5f
     }
Jakub Jelen 87ab5f
     else {
Jakub Jelen 87ab5f
         action_logbuf = "unknown on this platform";
Jakub Jelen 87ab5f
-        pamsshagentauth_buffer_init(&action_agentbuf); /* stays empty, means unavailable */
Jakub Jelen bbf61d
+        if ((action_agentbuf = sshbuf_new()) == NULL) /* stays empty, means unavailable */
Jakub Jelen bbf61d
+            fatal("%s: sshbuf_new failed", __func__);
Jakub Jelen 87ab5f
     }
Jakub Jelen 87ab5f
     
Jakub Jelen 87ab5f
     /*
Jakub Jelen 51f5c1
@@ -161,35 +169,39 @@ pamsshagentauth_session_id2_gen(Buffer *
Jakub Jelen 87ab5f
     retc = getcwd(pwd, sizeof(pwd) - 1);
Jakub Jelen 87ab5f
     time(&ts);
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
-    pamsshagentauth_buffer_init(session_id2);
Jakub Jelen bbf61d
+    if ((*session_id2 = sshbuf_new()) == NULL)
Jakub Jelen bbf61d
+        fatal("%s: sshbuf_new failed", __func__);
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
-    pamsshagentauth_buffer_put_int(session_id2, PAM_SSH_AGENT_AUTH_REQUESTv1);
Jakub Jelen 87ab5f
-    /* pamsshagentauth_debug3("cookie: %s", pamsshagentauth_tohex(cookie, cookie_len)); */
Jakub Jelen 87ab5f
-    pamsshagentauth_buffer_put_string(session_id2, cookie, cookie_len);
Jakub Jelen 87ab5f
-    /* pamsshagentauth_debug3("user: %s", user); */
Jakub Jelen 87ab5f
-    pamsshagentauth_buffer_put_cstring(session_id2, user);
Jakub Jelen 87ab5f
-    /* pamsshagentauth_debug3("ruser: %s", ruser); */
Jakub Jelen 87ab5f
-    pamsshagentauth_buffer_put_cstring(session_id2, ruser);
Jakub Jelen 87ab5f
-    /* pamsshagentauth_debug3("servicename: %s", servicename); */
Jakub Jelen 87ab5f
-    pamsshagentauth_buffer_put_cstring(session_id2, servicename);
Jakub Jelen 87ab5f
-    /* pamsshagentauth_debug3("pwd: %s", pwd); */
Jakub Jelen bbf61d
-    if(retc)
Jakub Jelen 87ab5f
-        pamsshagentauth_buffer_put_cstring(session_id2, pwd);
Jakub Jelen bbf61d
-    else
Jakub Jelen 87ab5f
-        pamsshagentauth_buffer_put_cstring(session_id2, "");
Jakub Jelen 87ab5f
-    /* pamsshagentauth_debug3("action: %s", action_logbuf); */
Jakub Jelen 87ab5f
-    pamsshagentauth_buffer_put_string(session_id2, action_agentbuf.buf + action_agentbuf.offset, action_agentbuf.end - action_agentbuf.offset);
Jakub Jelen bbf61d
+    if ((r = sshbuf_put_u32(*session_id2, PAM_SSH_AGENT_AUTH_REQUESTv1)) != 0 ||
Jakub Jelen bbf61d
+        (r = sshbuf_put_string(*session_id2, cookie, cookie_len)) != 0 ||
Jakub Jelen bbf61d
+        (r = sshbuf_put_cstring(*session_id2, user)) != 0 ||
Jakub Jelen bbf61d
+        (r = sshbuf_put_cstring(*session_id2, ruser)) != 0 ||
Jakub Jelen bbf61d
+        (r = sshbuf_put_cstring(*session_id2, servicename)) != 0)
Jakub Jelen bbf61d
+        fatal("%s: buffer error: %s", __func__, ssh_err(r));
Jakub Jelen bbf61d
+    if (retc) {
Jakub Jelen bbf61d
+        if ((r = sshbuf_put_cstring(*session_id2, pwd)) != 0)
Jakub Jelen bbf61d
+            fatal("%s: buffer error: %s", __func__, ssh_err(r));
Jakub Jelen bbf61d
+    } else {
Jakub Jelen bbf61d
+        if ((r = sshbuf_put_cstring(*session_id2, "")) != 0)
Jakub Jelen bbf61d
+            fatal("%s: buffer error: %s", __func__, ssh_err(r));
Jakub Jelen bbf61d
+    }
Jakub Jelen bbf61d
+    if ((r = sshbuf_put_stringb(*session_id2, action_agentbuf)) != 0)
Jakub Jelen bbf61d
+        fatal("%s: buffer error: %s", __func__, ssh_err(r));
Jakub Jelen 87ab5f
     if (free_logbuf) { 
Jakub Jelen 87ab5f
-        pamsshagentauth_xfree(action_logbuf);
Jakub Jelen 87ab5f
-        pamsshagentauth_buffer_free(&action_agentbuf);
Jakub Jelen 87ab5f
+        free(action_logbuf);
Jakub Jelen bbf61d
+        sshbuf_free(action_agentbuf);
Jakub Jelen 51f5c1
+    }
Jakub Jelen 51f5c1
+    /* debug3("hostname: %s", hostname); */
Jakub Jelen 51f5c1
+    if (reti >= 0) {
Jakub Jelen 51f5c1
+        if ((r = sshbuf_put_cstring(*session_id2, hostname)) != 0)
Jakub Jelen 51f5c1
+            fatal("%s: buffer error: %s", __func__, ssh_err(r));
Jakub Jelen 51f5c1
+    } else {
Jakub Jelen 51f5c1
+        if ((r = sshbuf_put_cstring(*session_id2, "")) != 0)
Jakub Jelen 51f5c1
+            fatal("%s: buffer error: %s", __func__, ssh_err(r));
Jakub Jelen 87ab5f
     }
Jakub Jelen 87ab5f
-    /* pamsshagentauth_debug3("hostname: %s", hostname); */
Jakub Jelen bbf61d
-    if(reti >= 0)
Jakub Jelen 87ab5f
-        pamsshagentauth_buffer_put_cstring(session_id2, hostname);
Jakub Jelen bbf61d
-    else
Jakub Jelen 87ab5f
-        pamsshagentauth_buffer_put_cstring(session_id2, "");
Jakub Jelen 87ab5f
-    /* pamsshagentauth_debug3("ts: %ld", ts); */
Jakub Jelen 87ab5f
-    pamsshagentauth_buffer_put_int64(session_id2, (uint64_t) ts);
Jakub Jelen 87ab5f
+    /* debug3("ts: %ld", ts); */
Jakub Jelen bbf61d
+    if ((r = sshbuf_put_u64(*session_id2, (uint64_t) ts)) != 0)
Jakub Jelen bbf61d
+        fatal("%s: buffer error: %s", __func__, ssh_err(r));
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
     free(cookie);
Jakub Jelen 87ab5f
     return;
Jakub Jelen 51f5c1
@@ -278,7 +290,8 @@ ssh_get_authentication_connection_for_ui
Jakub Jelen bbf61d
 
Jakub Jelen bbf61d
 	auth = xmalloc(sizeof(*auth));
Jakub Jelen bbf61d
 	auth->fd = sock;
Jakub Jelen bbf61d
-	buffer_init(&auth->identities);
Jakub Jelen bbf61d
+	if ((auth->identities = sshbuf_new()) == NULL)
Jakub Jelen bbf61d
+           fatal("%s: sshbuf_new failed", __func__);
Jakub Jelen bbf61d
 	auth->howmany = 0;
Jakub Jelen bbf61d
 
Jakub Jelen bbf61d
 	return auth;
Jakub Jelen 51f5c1
@@ -287,9 +300,9 @@ ssh_get_authentication_connection_for_ui
Jakub Jelen bbf61d
 int
Jakub Jelen bbf61d
 pamsshagentauth_find_authorized_keys(const char * user, const char * ruser, const char * servicename)
Jakub Jelen bbf61d
 {
Jakub Jelen bbf61d
-    Buffer session_id2 = { 0 };
Jakub Jelen bbf61d
+    struct sshbuf *session_id2 = NULL;
Jakub Jelen bbf61d
     Identity *id;
Jakub Jelen bbf61d
-    Key *key;
Jakub Jelen bbf61d
+    struct sshkey *key;
Jakub Jelen bbf61d
     AuthenticationConnection *ac;
Jakub Jelen bbf61d
     char *comment;
Jakub Jelen bbf61d
     uint8_t retval = 0;
Jakub Jelen 51f5c1
@@ -299,31 +312,30 @@ pamsshagentauth_find_authorized_keys(con
Jakub Jelen 51f5c1
     pamsshagentauth_session_id2_gen(&session_id2, user, ruser, servicename);
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
     if ((ac = ssh_get_authentication_connection_for_uid(uid))) {
Jakub Jelen 87ab5f
-        pamsshagentauth_verbose("Contacted ssh-agent of user %s (%u)", ruser, uid);
Jakub Jelen 87ab5f
+        verbose("Contacted ssh-agent of user %s (%u)", ruser, uid);
Jakub Jelen 87ab5f
         for (key = ssh_get_first_identity(ac, &comment, 2); key != NULL; key = ssh_get_next_identity(ac, &comment, 2)) 
Jakub Jelen 87ab5f
         {
Jakub Jelen 87ab5f
             if(key != NULL) {
Jakub Jelen 87ab5f
-                id = pamsshagentauth_xcalloc(1, sizeof(*id));
Jakub Jelen 87ab5f
+                id = xcalloc(1, sizeof(*id));
Jakub Jelen 87ab5f
                 id->key = key;
Jakub Jelen 87ab5f
                 id->filename = comment;
Jakub Jelen 87ab5f
                 id->ac = ac;
Jakub Jelen bbf61d
-                if(userauth_pubkey_from_id(ruser, id, &session_id2)) {
Jakub Jelen bbf61d
+                if(userauth_pubkey_from_id(ruser, id, session_id2)) {
Jakub Jelen 87ab5f
                     retval = 1;
Jakub Jelen 87ab5f
                 }
Jakub Jelen 87ab5f
-                pamsshagentauth_xfree(id->filename);
Jakub Jelen 87ab5f
-                pamsshagentauth_key_free(id->key);
Jakub Jelen 87ab5f
-                pamsshagentauth_xfree(id);
Jakub Jelen 87ab5f
+                free(id->filename);
Jakub Jelen 87ab5f
+                key_free(id->key);
Jakub Jelen 87ab5f
+                free(id);
Jakub Jelen 87ab5f
                 if(retval == 1)
Jakub Jelen 87ab5f
                     break;
Jakub Jelen 87ab5f
             }
Jakub Jelen 87ab5f
         }
Jakub Jelen 87ab5f
-        pamsshagentauth_buffer_free(&session_id2);
Jakub Jelen bbf61d
+        sshbuf_free(session_id2);
Jakub Jelen 87ab5f
         ssh_close_authentication_connection(ac);
Jakub Jelen 87ab5f
     }
Jakub Jelen 87ab5f
     else {
Jakub Jelen 87ab5f
-        pamsshagentauth_verbose("No ssh-agent could be contacted");
Jakub Jelen 87ab5f
+        verbose("No ssh-agent could be contacted");
Jakub Jelen 87ab5f
     }
Jakub Jelen bbf61d
-    /* pamsshagentauth_xfree(session_id2); */
Jakub Jelen 87ab5f
     EVP_cleanup();
Jakub Jelen bbf61d
     return retval;
Jakub Jelen bbf61d
 }
Jakub Jelen bbf61d
diff -up openssh/pam_ssh_agent_auth-0.10.3/pam_ssh_agent_auth.c.psaa-compat openssh/pam_ssh_agent_auth-0.10.3/pam_ssh_agent_auth.c
Jakub Jelen 51f5c1
--- openssh/pam_ssh_agent_auth-0.10.3/pam_ssh_agent_auth.c.psaa-compat	2020-02-07 10:43:05.010757940 +0100
Jakub Jelen 51f5c1
+++ openssh/pam_ssh_agent_auth-0.10.3/pam_ssh_agent_auth.c	2020-02-07 10:43:05.012757972 +0100
Jakub Jelen 87ab5f
@@ -104,7 +104,7 @@ pam_sm_authenticate(pam_handle_t * pamh,
Jakub Jelen 87ab5f
  * a patch 8-)
Jakub Jelen 87ab5f
  */
Jakub Jelen 87ab5f
 #if ! HAVE___PROGNAME || HAVE_BUNDLE
Jakub Jelen 87ab5f
-    __progname = pamsshagentauth_xstrdup(servicename);
Jakub Jelen 87ab5f
+    __progname = xstrdup(servicename);
Jakub Jelen 87ab5f
 #endif
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
     for(i = argc, argv_ptr = (char **) argv; i > 0; ++argv_ptr, i--) {
Jakub Jelen 87ab5f
@@ -130,11 +130,11 @@ pam_sm_authenticate(pam_handle_t * pamh,
Jakub Jelen 87ab5f
 #endif
Jakub Jelen 87ab5f
     }
Jakub Jelen 87ab5f
 
Jakub Jelen bdb932
-    pamsshagentauth_log_init(__progname, log_lvl, facility, getenv("PAM_SSH_AGENT_AUTH_DEBUG") ? 1 : 0);
Jakub Jelen bdb932
+    log_init(__progname, log_lvl, facility, getenv("PAM_SSH_AGENT_AUTH_DEBUG") ? 1 : 0);
Jakub Jelen 87ab5f
     pam_get_item(pamh, PAM_USER, (void *) &user);
Jakub Jelen 87ab5f
     pam_get_item(pamh, PAM_RUSER, (void *) &ruser_ptr);
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
-    pamsshagentauth_verbose("Beginning pam_ssh_agent_auth for user %s", user);
Jakub Jelen 87ab5f
+    verbose("Beginning pam_ssh_agent_auth for user %s", user);
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
     if(ruser_ptr) {
Jakub Jelen 87ab5f
         strncpy(ruser, ruser_ptr, sizeof(ruser) - 1);
Jakub Jelen 87ab5f
@@ -149,12 +149,12 @@ pam_sm_authenticate(pam_handle_t * pamh,
Jakub Jelen 87ab5f
 #ifdef ENABLE_SUDO_HACK
Jakub Jelen 87ab5f
         if( (strlen(sudo_service_name) > 0) && strncasecmp(servicename, sudo_service_name, sizeof(sudo_service_name) - 1) == 0 && getenv("SUDO_USER") ) {
Jakub Jelen 87ab5f
             strncpy(ruser, getenv("SUDO_USER"), sizeof(ruser) - 1 );
Jakub Jelen 87ab5f
-            pamsshagentauth_verbose( "Using environment variable SUDO_USER (%s)", ruser );
Jakub Jelen 87ab5f
+            verbose( "Using environment variable SUDO_USER (%s)", ruser );
Jakub Jelen bdb932
         } else
Jakub Jelen 87ab5f
 #endif
Jakub Jelen 87ab5f
         {
Jakub Jelen 87ab5f
             if( ! getpwuid(getuid()) ) {
Jakub Jelen 87ab5f
-                pamsshagentauth_verbose("Unable to getpwuid(getuid())");
Jakub Jelen 87ab5f
+                verbose("Unable to getpwuid(getuid())");
Jakub Jelen 87ab5f
                 goto cleanexit;
Jakub Jelen 87ab5f
             }
Jakub Jelen 87ab5f
             strncpy(ruser, getpwuid(getuid())->pw_name, sizeof(ruser) - 1);
Jakub Jelen 87ab5f
@@ -163,11 +163,11 @@ pam_sm_authenticate(pam_handle_t * pamh,
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
     /* Might as well explicitely confirm the user exists here */
Jakub Jelen 87ab5f
     if(! getpwnam(ruser) ) {
Jakub Jelen 87ab5f
-        pamsshagentauth_verbose("getpwnam(%s) failed, bailing out", ruser);
Jakub Jelen 87ab5f
+        verbose("getpwnam(%s) failed, bailing out", ruser);
Jakub Jelen 87ab5f
         goto cleanexit;
Jakub Jelen 87ab5f
     }
Jakub Jelen 87ab5f
     if( ! getpwnam(user) ) {
Jakub Jelen 87ab5f
-        pamsshagentauth_verbose("getpwnam(%s) failed, bailing out", user);
Jakub Jelen 87ab5f
+        verbose("getpwnam(%s) failed, bailing out", user);
Jakub Jelen 87ab5f
         goto cleanexit;
Jakub Jelen 87ab5f
     }
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
@@ -177,8 +177,8 @@ pam_sm_authenticate(pam_handle_t * pamh,
Jakub Jelen 87ab5f
          */
Jakub Jelen 87ab5f
         parse_authorized_key_file(user, authorized_keys_file_input);
Jakub Jelen 87ab5f
     } else {
Jakub Jelen 87ab5f
-        pamsshagentauth_verbose("Using default file=/etc/security/authorized_keys");
Jakub Jelen 87ab5f
-        authorized_keys_file = pamsshagentauth_xstrdup("/etc/security/authorized_keys");
Jakub Jelen 87ab5f
+        verbose("Using default file=/etc/security/authorized_keys");
Jakub Jelen 87ab5f
+        authorized_keys_file = xstrdup("/etc/security/authorized_keys");
Jakub Jelen 87ab5f
     }
Jakub Jelen 87ab5f
 
Jakub Jelen bdb932
     /*
Jakub Jelen 87ab5f
@@ -187,19 +187,19 @@ pam_sm_authenticate(pam_handle_t * pamh,
Jakub Jelen 87ab5f
      */
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
     if(user && strlen(ruser) > 0) {
Jakub Jelen 87ab5f
-        pamsshagentauth_verbose("Attempting authentication: `%s' as `%s' using %s", ruser, user, authorized_keys_file);
Jakub Jelen 87ab5f
+        verbose("Attempting authentication: `%s' as `%s' using %s", ruser, user, authorized_keys_file);
Jakub Jelen 87ab5f
 
Jakub Jelen bdb932
         /*
Jakub Jelen 87ab5f
          * this pw_uid is used to validate the SSH_AUTH_SOCK, and so must be the uid of the ruser invoking the program, not the target-user
Jakub Jelen 87ab5f
          */
Jakub Jelen 87ab5f
         if(pamsshagentauth_find_authorized_keys(user, ruser, servicename)) { /* getpwnam(ruser)->pw_uid)) { */
Jakub Jelen 87ab5f
-            pamsshagentauth_logit("Authenticated: `%s' as `%s' using %s", ruser, user, authorized_keys_file);
Jakub Jelen 87ab5f
+            logit("Authenticated: `%s' as `%s' using %s", ruser, user, authorized_keys_file);
Jakub Jelen 87ab5f
             retval = PAM_SUCCESS;
Jakub Jelen 87ab5f
         } else {
Jakub Jelen 87ab5f
-            pamsshagentauth_logit("Failed Authentication: `%s' as `%s' using %s", ruser, user, authorized_keys_file);
Jakub Jelen 87ab5f
+            logit("Failed Authentication: `%s' as `%s' using %s", ruser, user, authorized_keys_file);
Jakub Jelen 87ab5f
         }
Jakub Jelen 87ab5f
     } else {
Jakub Jelen 87ab5f
-        pamsshagentauth_logit("No %s specified, cannot continue with this form of authentication", (user) ? "ruser" : "user" );
Jakub Jelen 87ab5f
+        logit("No %s specified, cannot continue with this form of authentication", (user) ? "ruser" : "user" );
Jakub Jelen 87ab5f
     }
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
 cleanexit:
Jakub Jelen bbf61d
diff -up openssh/pam_ssh_agent_auth-0.10.3/pam_user_authorized_keys.c.psaa-compat openssh/pam_ssh_agent_auth-0.10.3/pam_user_authorized_keys.c
Jakub Jelen bbf61d
--- openssh/pam_ssh_agent_auth-0.10.3/pam_user_authorized_keys.c.psaa-compat	2016-11-13 04:24:32.000000000 +0100
Jakub Jelen 51f5c1
+++ openssh/pam_ssh_agent_auth-0.10.3/pam_user_authorized_keys.c	2020-02-07 10:43:05.012757972 +0100
Jakub Jelen bbf61d
@@ -66,8 +66,8 @@
Jakub Jelen bbf61d
 #include "xmalloc.h"
Jakub Jelen bbf61d
 #include "match.h"
Jakub Jelen bbf61d
 #include "log.h"
Jakub Jelen bbf61d
-#include "buffer.h"
Jakub Jelen bbf61d
-#include "key.h"
Jakub Jelen bbf61d
+#include "sshbuf.h"
Jakub Jelen bbf61d
+#include "sshkey.h"
Jakub Jelen bbf61d
 #include "misc.h"
Jakub Jelen bbf61d
 
Jakub Jelen bbf61d
 #include "xmalloc.h"
Jakub Jelen bbf61d
@@ -77,7 +77,6 @@
Jakub Jelen bbf61d
 #include "pathnames.h"
Jakub Jelen bbf61d
 #include "secure_filename.h"
Jakub Jelen bbf61d
 
Jakub Jelen bbf61d
-#include "identity.h"
Jakub Jelen bbf61d
 #include "pam_user_key_allowed2.h"
Jakub Jelen bbf61d
 
Jakub Jelen bbf61d
 extern char *authorized_keys_file;
Jakub Jelen bbf61d
@@ -117,12 +116,12 @@ parse_authorized_key_file(const char *us
Jakub Jelen bdb932
         } else {
Jakub Jelen bdb932
             slash_ptr = strchr(auth_keys_file_buf, '/');
Jakub Jelen bdb932
             if(!slash_ptr)
Jakub Jelen bdb932
-                pamsshagentauth_fatal
Jakub Jelen bdb932
+                fatal
Jakub Jelen bdb932
                     ("cannot expand tilde in path without a `/'");
Jakub Jelen 87ab5f
 
Jakub Jelen bdb932
             owner_uname_len = slash_ptr - auth_keys_file_buf - 1;
Jakub Jelen bdb932
             if(owner_uname_len > (sizeof(owner_uname) - 1))
Jakub Jelen bdb932
-                pamsshagentauth_fatal("Username too long");
Jakub Jelen bdb932
+                fatal("Username too long");
Jakub Jelen 87ab5f
 
Jakub Jelen bdb932
             strncat(owner_uname, auth_keys_file_buf + 1, owner_uname_len);
Jakub Jelen bdb932
             if(!authorized_keys_file_allowed_owner_uid)
Jakub Jelen bbf61d
@@ -130,11 +129,11 @@ parse_authorized_key_file(const char *us
Jakub Jelen bdb932
                     getpwnam(owner_uname)->pw_uid;
Jakub Jelen bdb932
         }
Jakub Jelen bdb932
         authorized_keys_file =
Jakub Jelen bdb932
-            pamsshagentauth_tilde_expand_filename(auth_keys_file_buf,
Jakub Jelen bdb932
+            tilde_expand_filename(auth_keys_file_buf,
Jakub Jelen bdb932
                                                   authorized_keys_file_allowed_owner_uid);
Jakub Jelen bdb932
         strncpy(auth_keys_file_buf, authorized_keys_file,
Jakub Jelen bdb932
                 sizeof(auth_keys_file_buf) - 1);
Jakub Jelen bdb932
-        pamsshagentauth_xfree(authorized_keys_file)        /* when we
Jakub Jelen bdb932
+        free(authorized_keys_file)        /* when we
Jakub Jelen bdb932
                                                               percent_expand
Jakub Jelen bdb932
                                                               later, we'd step
Jakub Jelen bdb932
                                                               on this, so free
Jakub Jelen bbf61d
@@ -150,13 +149,13 @@ parse_authorized_key_file(const char *us
Jakub Jelen bdb932
     strncat(hostname, fqdn, strcspn(fqdn, "."));
Jakub Jelen bdb932
 #endif
Jakub Jelen bdb932
     authorized_keys_file =
Jakub Jelen bdb932
-        pamsshagentauth_percent_expand(auth_keys_file_buf, "h",
Jakub Jelen bdb932
+        percent_expand(auth_keys_file_buf, "h",
Jakub Jelen bdb932
                                        getpwnam(user)->pw_dir, "H", hostname,
Jakub Jelen bdb932
                                        "f", fqdn, "u", user, NULL);
Jakub Jelen 87ab5f
 }
Jakub Jelen bbf61d
 
Jakub Jelen bbf61d
 int
Jakub Jelen bbf61d
-pam_user_key_allowed(const char *ruser, Key * key)
Jakub Jelen bbf61d
+pam_user_key_allowed(const char *ruser, struct sshkey * key)
Jakub Jelen bbf61d
 {
Jakub Jelen bbf61d
     return
Jakub Jelen bbf61d
         pamsshagentauth_user_key_allowed2(getpwuid(authorized_keys_file_allowed_owner_uid),
Jakub Jelen bbf61d
diff -up openssh/pam_ssh_agent_auth-0.10.3/pam_user_authorized_keys.h.psaa-compat openssh/pam_ssh_agent_auth-0.10.3/pam_user_authorized_keys.h
Jakub Jelen bbf61d
--- openssh/pam_ssh_agent_auth-0.10.3/pam_user_authorized_keys.h.psaa-compat	2016-11-13 04:24:32.000000000 +0100
Jakub Jelen 51f5c1
+++ openssh/pam_ssh_agent_auth-0.10.3/pam_user_authorized_keys.h	2020-02-07 10:43:05.012757972 +0100
Jakub Jelen bbf61d
@@ -32,7 +32,7 @@
Jakub Jelen bbf61d
 #define _PAM_USER_KEY_ALLOWED_H
Jakub Jelen bbf61d
 
Jakub Jelen bbf61d
 #include "identity.h"
Jakub Jelen bbf61d
-int pam_user_key_allowed(const char *, Key *);
Jakub Jelen bbf61d
+int pam_user_key_allowed(const char *, struct sshkey *);
Jakub Jelen bbf61d
 void parse_authorized_key_file(const char *, const char *);
Jakub Jelen bbf61d
 
Jakub Jelen bbf61d
 #endif
Jakub Jelen bbf61d
diff -up openssh/pam_ssh_agent_auth-0.10.3/pam_user_key_allowed2.c.psaa-compat openssh/pam_ssh_agent_auth-0.10.3/pam_user_key_allowed2.c
Jakub Jelen bbf61d
--- openssh/pam_ssh_agent_auth-0.10.3/pam_user_key_allowed2.c.psaa-compat	2016-11-13 04:24:32.000000000 +0100
Jakub Jelen 51f5c1
+++ openssh/pam_ssh_agent_auth-0.10.3/pam_user_key_allowed2.c	2020-02-07 10:43:05.012757972 +0100
Jakub Jelen bbf61d
@@ -45,44 +45,46 @@
Jakub Jelen bbf61d
 #include "xmalloc.h"
Jakub Jelen bbf61d
 #include "ssh.h"
Jakub Jelen bbf61d
 #include "ssh2.h"
Jakub Jelen bbf61d
-#include "buffer.h"
Jakub Jelen bbf61d
+#include "sshbuf.h"
Jakub Jelen 87ab5f
 #include "log.h"
Jakub Jelen 87ab5f
 #include "compat.h"
Jakub Jelen bbf61d
-#include "key.h"
Jakub Jelen 87ab5f
+#include "digest.h"
Jakub Jelen bbf61d
+#include "sshkey.h"
Jakub Jelen 87ab5f
 #include "pathnames.h"
Jakub Jelen 87ab5f
 #include "misc.h"
Jakub Jelen 87ab5f
 #include "secure_filename.h"
Jakub Jelen 87ab5f
 #include "uidswap.h"
Jakub Jelen bbf61d
-
Jakub Jelen bbf61d
-#include "identity.h"
Jakub Jelen 87ab5f
+#include <unistd.h>
Jakub Jelen 87ab5f
 
Jakub Jelen bbf61d
 /* return 1 if user allows given key */
Jakub Jelen bbf61d
 /* Modified slightly from original found in auth2-pubkey.c */
Jakub Jelen bbf61d
 static int
Jakub Jelen bbf61d
-pamsshagentauth_check_authkeys_file(FILE * f, char *file, Key * key)
Jakub Jelen bbf61d
+pamsshagentauth_check_authkeys_file(FILE * f, char *file, struct sshkey * key)
Jakub Jelen bbf61d
 {
Jakub Jelen bbf61d
-    char line[SSH_MAX_PUBKEY_BYTES];
Jakub Jelen bbf61d
+    char *line = NULL;
Jakub Jelen bbf61d
     int found_key = 0;
Jakub Jelen bbf61d
     u_long linenum = 0;
Jakub Jelen bbf61d
-    Key *found;
Jakub Jelen bbf61d
+    struct sshkey *found;
Jakub Jelen 87ab5f
     char *fp;
Jakub Jelen bbf61d
+    size_t linesize = 0;
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
     found_key = 0;
Jakub Jelen 87ab5f
-    found = pamsshagentauth_key_new(key->type);
Jakub Jelen bbf61d
+    found = sshkey_new(key->type);
Jakub Jelen 87ab5f
 
Jakub Jelen bbf61d
-    while(read_keyfile_line(f, file, line, sizeof(line), &linenum) != -1) {
Jakub Jelen bbf61d
+    while ((getline(&line, &linesize, f)) != -1) {
Jakub Jelen 87ab5f
         char *cp = NULL; /* *key_options = NULL; */
Jakub Jelen bbf61d
 
Jakub Jelen bbf61d
+        linenum++;
Jakub Jelen bbf61d
         /* Skip leading whitespace, empty and comment lines. */
Jakub Jelen bbf61d
         for(cp = line; *cp == ' ' || *cp == '\t'; cp++);
Jakub Jelen 87ab5f
         if(!*cp || *cp == '\n' || *cp == '#')
Jakub Jelen 87ab5f
             continue;
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
-        if(pamsshagentauth_key_read(found, &cp) != 1) {
Jakub Jelen bbf61d
+        if (sshkey_read(found, &cp) != 0) {
Jakub Jelen 87ab5f
             /* no key? check if there are options for this key */
Jakub Jelen 87ab5f
             int quoted = 0;
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
-            pamsshagentauth_verbose("user_key_allowed: check options: '%s'", cp);
Jakub Jelen 87ab5f
+            verbose("user_key_allowed: check options: '%s'", cp);
Jakub Jelen 87ab5f
             /* key_options = cp; */
Jakub Jelen 87ab5f
             for(; *cp && (quoted || (*cp != ' ' && *cp != '\t')); cp++) {
Jakub Jelen 87ab5f
                 if(*cp == '\\' && cp[1] == '"')
Jakub Jelen bbf61d
@@ -92,26 +94,27 @@ pamsshagentauth_check_authkeys_file(FILE
Jakub Jelen 87ab5f
             }
Jakub Jelen 87ab5f
             /* Skip remaining whitespace. */
Jakub Jelen 87ab5f
             for(; *cp == ' ' || *cp == '\t'; cp++);
Jakub Jelen 87ab5f
-            if(pamsshagentauth_key_read(found, &cp) != 1) {
Jakub Jelen 87ab5f
-                pamsshagentauth_verbose("user_key_allowed: advance: '%s'", cp);
Jakub Jelen bbf61d
+            if(sshkey_read(found, &cp) != 0) {
Jakub Jelen 87ab5f
+                verbose("user_key_allowed: advance: '%s'", cp);
Jakub Jelen 87ab5f
                 /* still no key? advance to next line */
Jakub Jelen 87ab5f
                 continue;
Jakub Jelen 87ab5f
             }
Jakub Jelen 87ab5f
         }
Jakub Jelen 87ab5f
-        if(pamsshagentauth_key_equal(found, key)) {
Jakub Jelen bbf61d
+        if(sshkey_equal(found, key)) {
Jakub Jelen 87ab5f
             found_key = 1;
Jakub Jelen 87ab5f
-            pamsshagentauth_logit("matching key found: file/command %s, line %lu", file,
Jakub Jelen 87ab5f
+            logit("matching key found: file/command %s, line %lu", file,
Jakub Jelen 87ab5f
                                   linenum);
Jakub Jelen 87ab5f
-            fp = pamsshagentauth_key_fingerprint(found, SSH_FP_MD5, SSH_FP_HEX);
Jakub Jelen 87ab5f
-            pamsshagentauth_logit("Found matching %s key: %s",
Jakub Jelen 87ab5f
-                                  pamsshagentauth_key_type(found), fp);
Jakub Jelen 87ab5f
-            pamsshagentauth_xfree(fp);
Jakub Jelen bbf61d
+            fp = sshkey_fingerprint(found, SSH_DIGEST_SHA256, SSH_FP_BASE64);
Jakub Jelen 87ab5f
+            logit("Found matching %s key: %s",
Jakub Jelen bbf61d
+                                  sshkey_type(found), fp);
Jakub Jelen 87ab5f
+            free(fp);
Jakub Jelen 87ab5f
             break;
Jakub Jelen 87ab5f
         }
Jakub Jelen 87ab5f
     }
Jakub Jelen 87ab5f
-    pamsshagentauth_key_free(found);
Jakub Jelen bbf61d
+    free(line);
Jakub Jelen bbf61d
+    sshkey_free(found);
Jakub Jelen 87ab5f
     if(!found_key)
Jakub Jelen 87ab5f
-        pamsshagentauth_verbose("key not found");
Jakub Jelen 87ab5f
+        verbose("key not found");
Jakub Jelen 87ab5f
     return found_key;
Jakub Jelen 87ab5f
 }
Jakub Jelen 87ab5f
 
Jakub Jelen bbf61d
@@ -120,19 +123,19 @@ pamsshagentauth_check_authkeys_file(FILE
Jakub Jelen bbf61d
  * returns 1 if the key is allowed or 0 otherwise.
Jakub Jelen bbf61d
  */
Jakub Jelen bbf61d
 int
Jakub Jelen bbf61d
-pamsshagentauth_user_key_allowed2(struct passwd *pw, Key * key, char *file)
Jakub Jelen bbf61d
+pamsshagentauth_user_key_allowed2(struct passwd *pw, struct sshkey * key, char *file)
Jakub Jelen bbf61d
 {
Jakub Jelen bbf61d
     FILE *f;
Jakub Jelen bbf61d
     int found_key = 0;
Jakub Jelen bbf61d
     struct stat st;
Jakub Jelen bbf61d
-    char buf[SSH_MAX_PUBKEY_BYTES];
Jakub Jelen bbf61d
+    char buf[256];
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
     /* Temporarily use the user's uid. */
Jakub Jelen 87ab5f
-    pamsshagentauth_verbose("trying public key file %s", file);
Jakub Jelen 87ab5f
+    verbose("trying public key file %s", file);
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
     /* Fail not so quietly if file does not exist */
Jakub Jelen 87ab5f
     if(stat(file, &st) < 0) {
Jakub Jelen 87ab5f
-        pamsshagentauth_verbose("File not found: %s", file);
Jakub Jelen 87ab5f
+        verbose("File not found: %s", file);
Jakub Jelen 87ab5f
         return 0;
Jakub Jelen 87ab5f
     }
Jakub Jelen 87ab5f
 
Jakub Jelen bbf61d
@@ -144,7 +147,7 @@ pamsshagentauth_user_key_allowed2(struct
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
     if(pamsshagentauth_secure_filename(f, file, pw, buf, sizeof(buf)) != 0) {
Jakub Jelen 87ab5f
         fclose(f);
Jakub Jelen 87ab5f
-        pamsshagentauth_logit("Authentication refused: %s", buf);
Jakub Jelen 87ab5f
+        logit("Authentication refused: %s", buf);
Jakub Jelen 87ab5f
         return 0;
Jakub Jelen 87ab5f
     }
Jakub Jelen 87ab5f
 
Jakub Jelen bbf61d
@@ -160,7 +163,7 @@ pamsshagentauth_user_key_allowed2(struct
Jakub Jelen bbf61d
 int
Jakub Jelen bbf61d
 pamsshagentauth_user_key_command_allowed2(char *authorized_keys_command,
Jakub Jelen bbf61d
                           char *authorized_keys_command_user,
Jakub Jelen bbf61d
-                          struct passwd *user_pw, Key * key)
Jakub Jelen bbf61d
+                          struct passwd *user_pw, struct sshkey * key)
Jakub Jelen bbf61d
 {
Jakub Jelen bbf61d
     FILE *f;
Jakub Jelen bbf61d
     int ok, found_key = 0;
Jakub Jelen bbf61d
@@ -187,44 +190,44 @@ pamsshagentauth_user_key_command_allowed
Jakub Jelen 87ab5f
     else {
Jakub Jelen 87ab5f
         pw = getpwnam(authorized_keys_command_user);
Jakub Jelen 87ab5f
         if(pw == NULL) {
Jakub Jelen 87ab5f
-            pamsshagentauth_logerror("authorized_keys_command_user \"%s\" not found: %s",
Jakub Jelen 87ab5f
+            error("authorized_keys_command_user \"%s\" not found: %s",
Jakub Jelen 87ab5f
                  authorized_keys_command_user, strerror(errno));
Jakub Jelen 87ab5f
             return 0;
Jakub Jelen 87ab5f
         }
Jakub Jelen 87ab5f
     }
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
-    pamsshagentauth_temporarily_use_uid(pw);
Jakub Jelen 87ab5f
+    temporarily_use_uid(pw);
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
     if(stat(authorized_keys_command, &st) < 0) {
Jakub Jelen 87ab5f
-        pamsshagentauth_logerror
Jakub Jelen 87ab5f
+        error
Jakub Jelen 87ab5f
             ("Could not stat AuthorizedKeysCommand \"%s\": %s",
Jakub Jelen 87ab5f
              authorized_keys_command, strerror(errno));
Jakub Jelen 87ab5f
         goto out;
Jakub Jelen 87ab5f
     }
Jakub Jelen 87ab5f
     if(pamsshagentauth_auth_secure_path
Jakub Jelen 87ab5f
        (authorized_keys_command, &st, NULL, 0, errmsg, sizeof(errmsg)) != 0) {
Jakub Jelen 87ab5f
-        pamsshagentauth_logerror("Unsafe AuthorizedKeysCommand: %s", errmsg);
Jakub Jelen 87ab5f
+        error("Unsafe AuthorizedKeysCommand: %s", errmsg);
Jakub Jelen 87ab5f
         goto out;
Jakub Jelen 87ab5f
     }
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
     /* open the pipe and read the keys */
Jakub Jelen 87ab5f
     if(pipe(p) != 0) {
Jakub Jelen 87ab5f
-        pamsshagentauth_logerror("%s: pipe: %s", __func__, strerror(errno));
Jakub Jelen 87ab5f
+        error("%s: pipe: %s", __func__, strerror(errno));
Jakub Jelen 87ab5f
         goto out;
Jakub Jelen 87ab5f
     }
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
-    pamsshagentauth_debug("Running AuthorizedKeysCommand: \"%s\" as \"%s\" with argument: \"%s\"",
Jakub Jelen 87ab5f
+    debug("Running AuthorizedKeysCommand: \"%s\" as \"%s\" with argument: \"%s\"",
Jakub Jelen 87ab5f
                           authorized_keys_command, pw->pw_name, username);
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
     /* 
Jakub Jelen 87ab5f
      * Don't want to call this in the child, where it can fatal() and
Jakub Jelen 87ab5f
      * run cleanup_exit() code.
Jakub Jelen 87ab5f
      */
Jakub Jelen 87ab5f
-    pamsshagentauth_restore_uid();
Jakub Jelen 87ab5f
+    restore_uid();
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
     switch ((pid = fork())) {
Jakub Jelen 87ab5f
     case -1:                                              /* error */
Jakub Jelen 87ab5f
-        pamsshagentauth_logerror("%s: fork: %s", __func__, strerror(errno));
Jakub Jelen 87ab5f
+        error("%s: fork: %s", __func__, strerror(errno));
Jakub Jelen 87ab5f
         close(p[0]);
Jakub Jelen 87ab5f
         close(p[1]);
Jakub Jelen 87ab5f
         return 0;
Jakub Jelen bbf61d
@@ -234,13 +237,13 @@ pamsshagentauth_user_key_command_allowed
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
         /* do this before the setresuid so thta they can be logged */
Jakub Jelen 87ab5f
         if((devnull = open(_PATH_DEVNULL, O_RDWR)) == -1) {
Jakub Jelen 87ab5f
-            pamsshagentauth_logerror("%s: open %s: %s", __func__, _PATH_DEVNULL,
Jakub Jelen 87ab5f
+            error("%s: open %s: %s", __func__, _PATH_DEVNULL,
Jakub Jelen 87ab5f
                                      strerror(errno));
Jakub Jelen 87ab5f
             _exit(1);
Jakub Jelen 87ab5f
         }
Jakub Jelen 87ab5f
         if(dup2(devnull, STDIN_FILENO) == -1 || dup2(p[1], STDOUT_FILENO) == -1
Jakub Jelen 87ab5f
            || dup2(devnull, STDERR_FILENO) == -1) {
Jakub Jelen 87ab5f
-            pamsshagentauth_logerror("%s: dup2: %s", __func__, strerror(errno));
Jakub Jelen 87ab5f
+            error("%s: dup2: %s", __func__, strerror(errno));
Jakub Jelen 87ab5f
             _exit(1);
Jakub Jelen 87ab5f
         }
Jakub Jelen 87ab5f
 #if defined(HAVE_SETRESGID) && !defined(BROKEN_SETRESGID)
Jakub Jelen bbf61d
@@ -248,7 +251,7 @@ pamsshagentauth_user_key_command_allowed
Jakub Jelen 87ab5f
 #else
Jakub Jelen 87ab5f
         if (setgid(pw->pw_gid) != 0 || setegid(pw->pw_gid) != 0) {
Jakub Jelen 87ab5f
 #endif
Jakub Jelen 87ab5f
-            pamsshagentauth_logerror("setresgid %u: %s", (u_int) pw->pw_gid,
Jakub Jelen 87ab5f
+            error("setresgid %u: %s", (u_int) pw->pw_gid,
Jakub Jelen 87ab5f
                                      strerror(errno));
Jakub Jelen 87ab5f
             _exit(1);
Jakub Jelen 87ab5f
         }
Jakub Jelen bbf61d
@@ -258,7 +261,7 @@ pamsshagentauth_user_key_command_allowed
Jakub Jelen 87ab5f
 #else
Jakub Jelen 87ab5f
         if (setuid(pw->pw_uid) != 0 || seteuid(pw->pw_uid) != 0) {
Jakub Jelen 87ab5f
 #endif
Jakub Jelen 87ab5f
-            pamsshagentauth_logerror("setresuid %u: %s", (u_int) pw->pw_uid,
Jakub Jelen 87ab5f
+            error("setresuid %u: %s", (u_int) pw->pw_uid,
Jakub Jelen 87ab5f
                                      strerror(errno));
Jakub Jelen 87ab5f
             _exit(1);
Jakub Jelen 87ab5f
         }
Jakub Jelen bbf61d
@@ -270,18 +273,18 @@ pamsshagentauth_user_key_command_allowed
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
         /* pretty sure this will barf because we are now suid, but since we
Jakub Jelen 87ab5f
            should't reach this anyway, I'll leave it here */
Jakub Jelen 87ab5f
-        pamsshagentauth_logerror("AuthorizedKeysCommand %s exec failed: %s",
Jakub Jelen 87ab5f
+        error("AuthorizedKeysCommand %s exec failed: %s",
Jakub Jelen 87ab5f
                                  authorized_keys_command, strerror(errno));
Jakub Jelen 87ab5f
         _exit(127);
Jakub Jelen 87ab5f
     default:                                              /* parent */
Jakub Jelen 87ab5f
         break;
Jakub Jelen 87ab5f
     }
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
-    pamsshagentauth_temporarily_use_uid(pw);
Jakub Jelen 87ab5f
+    temporarily_use_uid(pw);
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
     close(p[1]);
Jakub Jelen 87ab5f
     if((f = fdopen(p[0], "r")) == NULL) {
Jakub Jelen 87ab5f
-        pamsshagentauth_logerror("%s: fdopen: %s", __func__, strerror(errno));
Jakub Jelen 87ab5f
+        error("%s: fdopen: %s", __func__, strerror(errno));
Jakub Jelen 87ab5f
         close(p[0]);
Jakub Jelen 87ab5f
         /* Don't leave zombie child */
Jakub Jelen 87ab5f
         while(waitpid(pid, NULL, 0) == -1 && errno == EINTR);
Jakub Jelen bbf61d
@@ -292,22 +295,22 @@ pamsshagentauth_user_key_command_allowed
Jakub Jelen 87ab5f
 
Jakub Jelen 87ab5f
     while(waitpid(pid, &status, 0) == -1) {
Jakub Jelen 87ab5f
         if(errno != EINTR) {
Jakub Jelen 87ab5f
-            pamsshagentauth_logerror("%s: waitpid: %s", __func__,
Jakub Jelen 87ab5f
+            error("%s: waitpid: %s", __func__,
Jakub Jelen 87ab5f
                                      strerror(errno));
Jakub Jelen 87ab5f
             goto out;
Jakub Jelen 87ab5f
         }
Jakub Jelen 87ab5f
     }
Jakub Jelen 87ab5f
     if(WIFSIGNALED(status)) {
Jakub Jelen 87ab5f
-        pamsshagentauth_logerror("AuthorizedKeysCommand %s exited on signal %d",
Jakub Jelen 87ab5f
+        error("AuthorizedKeysCommand %s exited on signal %d",
Jakub Jelen 87ab5f
                                  authorized_keys_command, WTERMSIG(status));
Jakub Jelen 87ab5f
         goto out;
Jakub Jelen 87ab5f
     } else if(WEXITSTATUS(status) != 0) {
Jakub Jelen 87ab5f
-        pamsshagentauth_logerror("AuthorizedKeysCommand %s returned status %d",
Jakub Jelen 87ab5f
+        error("AuthorizedKeysCommand %s returned status %d",
Jakub Jelen 87ab5f
                                  authorized_keys_command, WEXITSTATUS(status));
Jakub Jelen 87ab5f
         goto out;
Jakub Jelen 87ab5f
     }
Jakub Jelen 87ab5f
     found_key = ok;
Jakub Jelen 87ab5f
   out:
Jakub Jelen 87ab5f
-    pamsshagentauth_restore_uid();
Jakub Jelen 87ab5f
+    restore_uid();
Jakub Jelen 87ab5f
     return found_key;
Jakub Jelen 87ab5f
 }
Jakub Jelen bbf61d
diff -up openssh/pam_ssh_agent_auth-0.10.3/pam_user_key_allowed2.h.psaa-compat openssh/pam_ssh_agent_auth-0.10.3/pam_user_key_allowed2.h
Jakub Jelen bbf61d
--- openssh/pam_ssh_agent_auth-0.10.3/pam_user_key_allowed2.h.psaa-compat	2016-11-13 04:24:32.000000000 +0100
Jakub Jelen 51f5c1
+++ openssh/pam_ssh_agent_auth-0.10.3/pam_user_key_allowed2.h	2020-02-07 10:43:05.012757972 +0100
Jakub Jelen bbf61d
@@ -32,7 +32,7 @@
Jakub Jelen bbf61d
 #define _PAM_USER_KEY_ALLOWED_H
Jakub Jelen bbf61d
 
Jakub Jelen bbf61d
 #include "identity.h"
Jakub Jelen bbf61d
-int pamsshagentauth_user_key_allowed2(struct passwd *, Key *, char *);
Jakub Jelen bbf61d
-int pamsshagentauth_user_key_command_allowed2(char *, char *, struct passwd *, Key *);
Jakub Jelen bbf61d
+int pamsshagentauth_user_key_allowed2(struct passwd *, struct sshkey *, char *);
Jakub Jelen bbf61d
+int pamsshagentauth_user_key_command_allowed2(char *, char *, struct passwd *, struct sshkey *);
Jakub Jelen bbf61d
 
Jakub Jelen bbf61d
 #endif
Jakub Jelen bbf61d
diff -up openssh/pam_ssh_agent_auth-0.10.3/secure_filename.c.psaa-compat openssh/pam_ssh_agent_auth-0.10.3/secure_filename.c
Jakub Jelen bbf61d
--- openssh/pam_ssh_agent_auth-0.10.3/secure_filename.c.psaa-compat	2016-11-13 04:24:32.000000000 +0100
Jakub Jelen 51f5c1
+++ openssh/pam_ssh_agent_auth-0.10.3/secure_filename.c	2020-02-07 10:43:05.012757972 +0100
Jakub Jelen bbf61d
@@ -53,8 +53,8 @@
Jakub Jelen bbf61d
 #include "xmalloc.h"
Jakub Jelen bbf61d
 #include "match.h"
Jakub Jelen bbf61d
 #include "log.h"
Jakub Jelen bbf61d
-#include "buffer.h"
Jakub Jelen bbf61d
-#include "key.h"
Jakub Jelen bbf61d
+#include "sshbuf.h"
Jakub Jelen bbf61d
+#include "sshkey.h"
Jakub Jelen bbf61d
 #include "misc.h"
Jakub Jelen bbf61d
 
Jakub Jelen bbf61d
 
Jakub Jelen bdb932
@@ -80,7 +80,7 @@ pamsshagentauth_auth_secure_path(const c
Jakub Jelen bdb932
 	int comparehome = 0;
Jakub Jelen bdb932
 	struct stat st;
Jakub Jelen 87ab5f
 
Jakub Jelen bdb932
-    pamsshagentauth_verbose("auth_secure_filename: checking for uid: %u", uid);
Jakub Jelen bdb932
+    verbose("auth_secure_filename: checking for uid: %u", uid);
Jakub Jelen 87ab5f
 
Jakub Jelen bdb932
 	if (realpath(name, buf) == NULL) {
Jakub Jelen bdb932
 		snprintf(err, errlen, "realpath %s failed: %s", name,
Jakub Jelen bdb932
@@ -115,9 +115,9 @@ pamsshagentauth_auth_secure_path(const c
Jakub Jelen bdb932
 			snprintf(err, errlen, "dirname() failed");
Jakub Jelen bdb932
 			return -1;
Jakub Jelen bdb932
 		}
Jakub Jelen bdb932
-		pamsshagentauth_strlcpy(buf, cp, sizeof(buf));
Jakub Jelen bdb932
+		strlcpy(buf, cp, sizeof(buf));
Jakub Jelen bdb932
 
Jakub Jelen bdb932
-		pamsshagentauth_verbose("secure_filename: checking '%s'", buf);
Jakub Jelen bdb932
+		verbose("secure_filename: checking '%s'", buf);
Jakub Jelen bdb932
 		if (stat(buf, &st) < 0 ||
Jakub Jelen bdb932
 		    (st.st_uid != 0 && st.st_uid != uid) ||
Jakub Jelen bdb932
 		    (st.st_mode & 022) != 0) {
Jakub Jelen bdb932
@@ -128,7 +128,7 @@ pamsshagentauth_auth_secure_path(const c
Jakub Jelen bdb932
 
Jakub Jelen bdb932
 		/* If are passed the homedir then we can stop */
Jakub Jelen bdb932
 		if (comparehome && strcmp(homedir, buf) == 0) {
Jakub Jelen bdb932
-			pamsshagentauth_verbose("secure_filename: terminating check at '%s'",
Jakub Jelen bdb932
+			verbose("secure_filename: terminating check at '%s'",
Jakub Jelen bdb932
 			    buf);
Jakub Jelen bdb932
 			break;
Jakub Jelen bdb932
 		}
Jakub Jelen bbf61d
diff -up openssh/pam_ssh_agent_auth-0.10.3/userauth_pubkey_from_id.c.psaa-compat openssh/pam_ssh_agent_auth-0.10.3/userauth_pubkey_from_id.c
Jakub Jelen bbf61d
--- openssh/pam_ssh_agent_auth-0.10.3/userauth_pubkey_from_id.c.psaa-compat	2016-11-13 04:24:32.000000000 +0100
Jakub Jelen 51f5c1
+++ openssh/pam_ssh_agent_auth-0.10.3/userauth_pubkey_from_id.c	2020-02-07 10:43:23.520048960 +0100
Jakub Jelen bbf61d
@@ -37,10 +37,11 @@
Jakub Jelen bbf61d
 #include "xmalloc.h"
Jakub Jelen bbf61d
 #include "ssh.h"
Jakub Jelen bbf61d
 #include "ssh2.h"
Jakub Jelen bbf61d
-#include "buffer.h"
Jakub Jelen bbf61d
+#include "sshbuf.h"
Jakub Jelen bbf61d
 #include "log.h"
Jakub Jelen bbf61d
 #include "compat.h"
Jakub Jelen bbf61d
-#include "key.h"
Jakub Jelen bbf61d
+#include "sshkey.h"
Jakub Jelen bbf61d
+#include "ssherr.h"
Jakub Jelen bbf61d
 #include "pathnames.h"
Jakub Jelen bbf61d
 #include "misc.h"
Jakub Jelen bbf61d
 #include "secure_filename.h"
Jakub Jelen 51f5c1
@@ -48,54 +49,59 @@
Jakub Jelen bdb932
 #include "identity.h"
Jakub Jelen bdb932
 #include "pam_user_authorized_keys.h"
Jakub Jelen bdb932
 
Jakub Jelen bdb932
+#define SSH2_MSG_USERAUTH_TRUST_REQUEST          54
Jakub Jelen bdb932
+
Jakub Jelen bdb932
 /* extern u_char  *session_id2;
Jakub Jelen bdb932
 extern uint8_t  session_id_len;
Jakub Jelen bdb932
  */
Jakub Jelen bbf61d
 
Jakub Jelen bbf61d
 int
Jakub Jelen bbf61d
-userauth_pubkey_from_id(const char *ruser, Identity * id, Buffer * session_id2)
Jakub Jelen bbf61d
+userauth_pubkey_from_id(const char *ruser, Identity * id, struct sshbuf * session_id2)
Jakub Jelen bbf61d
 {
Jakub Jelen bbf61d
-    Buffer          b = { 0 };
Jakub Jelen bbf61d
+    struct sshbuf  *b = NULL;
Jakub Jelen bbf61d
     char           *pkalg = NULL;
Jakub Jelen bbf61d
     u_char         *pkblob = NULL, *sig = NULL;
Jakub Jelen bbf61d
-    u_int           blen = 0, slen = 0;
Jakub Jelen bbf61d
-    int             authenticated = 0;
Jakub Jelen 51f5c1
+    size_t          blen = 0, slen = 0;
Jakub Jelen bbf61d
+    int             r, authenticated = 0;
Jakub Jelen bbf61d
 
Jakub Jelen bbf61d
-    pkalg = (char *) key_ssh_name(id->key);
Jakub Jelen bbf61d
+    pkalg = (char *) sshkey_ssh_name(id->key);
Jakub Jelen bdb932
 
Jakub Jelen bdb932
     /* first test if this key is even allowed */
Jakub Jelen bdb932
     if(! pam_user_key_allowed(ruser, id->key))
Jakub Jelen bdb932
-        goto user_auth_clean_exit;
Jakub Jelen bdb932
+        goto user_auth_clean_exit_without_buffer;
Jakub Jelen bdb932
 
Jakub Jelen bdb932
-    if(pamsshagentauth_key_to_blob(id->key, &pkblob, &blen) == 0)
Jakub Jelen bdb932
-        goto user_auth_clean_exit;
Jakub Jelen bbf61d
+    if(sshkey_to_blob(id->key, &pkblob, &blen) != 0)
Jakub Jelen bdb932
+        goto user_auth_clean_exit_without_buffer;
Jakub Jelen bdb932
 
Jakub Jelen bdb932
     /* construct packet to sign and test */
Jakub Jelen bdb932
-    pamsshagentauth_buffer_init(&b);
Jakub Jelen bbf61d
+    if ((b = sshbuf_new()) == NULL)
Jakub Jelen bbf61d
+        fatal("%s: sshbuf_new failed", __func__);
Jakub Jelen bdb932
 
Jakub Jelen bdb932
-    pamsshagentauth_buffer_put_string(&b, session_id2->buf + session_id2->offset, session_id2->end - session_id2->offset);
Jakub Jelen bdb932
-    pamsshagentauth_buffer_put_char(&b, SSH2_MSG_USERAUTH_TRUST_REQUEST); 
Jakub Jelen bdb932
-    pamsshagentauth_buffer_put_cstring(&b, ruser);
Jakub Jelen bdb932
-    pamsshagentauth_buffer_put_cstring(&b, "pam_ssh_agent_auth");
Jakub Jelen bdb932
-    pamsshagentauth_buffer_put_cstring(&b, "publickey");
Jakub Jelen bdb932
-    pamsshagentauth_buffer_put_char(&b, 1);
Jakub Jelen bdb932
-    pamsshagentauth_buffer_put_cstring(&b, pkalg);
Jakub Jelen bdb932
-    pamsshagentauth_buffer_put_string(&b, pkblob, blen);
Jakub Jelen bbf61d
+    if ((r = sshbuf_put_string(b, sshbuf_ptr(session_id2), sshbuf_len(session_id2))) != 0 ||
Jakub Jelen bbf61d
+        (r = sshbuf_put_u8(b, SSH2_MSG_USERAUTH_TRUST_REQUEST)) != 0 ||
Jakub Jelen bbf61d
+        (r = sshbuf_put_cstring(b, ruser)) != 0 ||
Jakub Jelen bbf61d
+        (r = sshbuf_put_cstring(b, "pam_ssh_agent_auth")) != 0 ||
Jakub Jelen bbf61d
+        (r = sshbuf_put_cstring(b, "publickey")) != 0 ||
Jakub Jelen bbf61d
+        (r = sshbuf_put_u8(b, 1)) != 0 ||
Jakub Jelen bbf61d
+        (r = sshbuf_put_cstring(b, pkalg)) != 0 ||
Jakub Jelen bbf61d
+        (r = sshbuf_put_string(b, pkblob, blen)) != 0)
Jakub Jelen bbf61d
+        fatal("%s: buffer error: %s", __func__, ssh_err(r));
Jakub Jelen bdb932
 
Jakub Jelen bdb932
-    if(ssh_agent_sign(id->ac, id->key, &sig, &slen, pamsshagentauth_buffer_ptr(&b), pamsshagentauth_buffer_len(&b)) != 0)
Jakub Jelen bbf61d
+    if (ssh_agent_sign(id->ac, id->key, &sig, &slen, sshbuf_ptr(b), sshbuf_len(b)) != 0)
Jakub Jelen bdb932
         goto user_auth_clean_exit;
Jakub Jelen bdb932
 
Jakub Jelen bdb932
     /* test for correct signature */
Jakub Jelen bdb932
-    if(pamsshagentauth_key_verify(id->key, sig, slen, pamsshagentauth_buffer_ptr(&b), pamsshagentauth_buffer_len(&b)) == 1)
Jakub Jelen 51f5c1
+    if (sshkey_verify(id->key, sig, slen, sshbuf_ptr(b), sshbuf_len(b), NULL, 0, NULL) == 0)
Jakub Jelen bdb932
         authenticated = 1;
Jakub Jelen bdb932
 
Jakub Jelen bdb932
   user_auth_clean_exit:
Jakub Jelen bdb932
     /* if(&b != NULL) */
Jakub Jelen bdb932
-    pamsshagentauth_buffer_free(&b);
Jakub Jelen bbf61d
+    sshbuf_free(b);
Jakub Jelen bdb932
+  user_auth_clean_exit_without_buffer:
Jakub Jelen bdb932
     if(sig != NULL)
Jakub Jelen bdb932
-        pamsshagentauth_xfree(sig);
Jakub Jelen bdb932
+        free(sig);
Jakub Jelen bdb932
     if(pkblob != NULL)
Jakub Jelen bdb932
-        pamsshagentauth_xfree(pkblob);
Jakub Jelen bdb932
+        free(pkblob);
Jakub Jelen bdb932
     CRYPTO_cleanup_all_ex_data();
Jakub Jelen bdb932
     return authenticated;
Jakub Jelen 87ab5f
 }
Jakub Jelen bbf61d
diff -up openssh/pam_ssh_agent_auth-0.10.3/userauth_pubkey_from_id.h.psaa-compat openssh/pam_ssh_agent_auth-0.10.3/userauth_pubkey_from_id.h
Jakub Jelen bbf61d
--- openssh/pam_ssh_agent_auth-0.10.3/userauth_pubkey_from_id.h.psaa-compat	2016-11-13 04:24:32.000000000 +0100
Jakub Jelen 51f5c1
+++ openssh/pam_ssh_agent_auth-0.10.3/userauth_pubkey_from_id.h	2020-02-07 10:43:05.013757988 +0100
Jakub Jelen bbf61d
@@ -31,7 +31,7 @@
Jakub Jelen bbf61d
 #ifndef _USERAUTH_PUBKEY_FROM_ID_H
Jakub Jelen bbf61d
 #define _USERAUTH_PUBKEY_FROM_ID_H
Jakub Jelen bbf61d
 
Jakub Jelen bbf61d
-#include <identity.h>
Jakub Jelen bbf61d
-int userauth_pubkey_from_id(const char *, Identity *, Buffer *);
Jakub Jelen bbf61d
+#include "identity.h"
Jakub Jelen bbf61d
+int userauth_pubkey_from_id(const char *, Identity *, struct sshbuf *);
Jakub Jelen bbf61d
 
Jakub Jelen bbf61d
 #endif
Jakub Jelen bbf61d
diff -up openssh/pam_ssh_agent_auth-0.10.3/uuencode.c.psaa-compat openssh/pam_ssh_agent_auth-0.10.3/uuencode.c
Jakub Jelen bbf61d
--- openssh/pam_ssh_agent_auth-0.10.3/uuencode.c.psaa-compat	2016-11-13 04:24:32.000000000 +0100
Jakub Jelen 51f5c1
+++ openssh/pam_ssh_agent_auth-0.10.3/uuencode.c	2020-02-07 10:43:05.013757988 +0100
Jakub Jelen 87ab5f
@@ -56,7 +56,7 @@ pamsshagentauth_uudecode(const char *src
Jakub Jelen 87ab5f
 	/* and remove trailing whitespace because __b64_pton needs this */
Jakub Jelen 87ab5f
 	*p = '\0';
Jakub Jelen 87ab5f
 	len = pamsshagentauth___b64_pton(encoded, target, targsize);
Jakub Jelen 87ab5f
-	pamsshagentauth_xfree(encoded);
Jakub Jelen 87ab5f
+	xfree(encoded);
Jakub Jelen 87ab5f
 	return len;
Jakub Jelen 87ab5f
 }
Jakub Jelen 87ab5f
 
Jakub Jelen bdb932
@@ -70,7 +70,7 @@ pamsshagentauth_dump_base64(FILE *fp, co
Jakub Jelen 87ab5f
 		fprintf(fp, "dump_base64: len > 65536\n");
Jakub Jelen 87ab5f
 		return;
Jakub Jelen 87ab5f
 	}
Jakub Jelen 87ab5f
-	buf = pamsshagentauth_xmalloc(2*len);
Jakub Jelen 87ab5f
+	buf = malloc(2*len);
Jakub Jelen 87ab5f
 	n = pamsshagentauth_uuencode(data, len, buf, 2*len);
Jakub Jelen 87ab5f
 	for (i = 0; i < n; i++) {
Jakub Jelen 87ab5f
 		fprintf(fp, "%c", buf[i]);
Jakub Jelen bdb932
@@ -79,5 +79,5 @@ pamsshagentauth_dump_base64(FILE *fp, co
Jakub Jelen 87ab5f
 	}
Jakub Jelen 87ab5f
 	if (i % 70 != 69)
Jakub Jelen 87ab5f
 		fprintf(fp, "\n");
Jakub Jelen 87ab5f
-	pamsshagentauth_xfree(buf);
Jakub Jelen 87ab5f
+	free(buf);
Jakub Jelen 87ab5f
 }