- int ret;
-
- pr->auth_protocol[pr->auth_plen] = '\0'; /* ASCIZ */
- ret = x11_verify(pr->auth_protocol, pr->auth_data, pr->auth_dlen);
-
- /*
- * If authentication failed, construct and send an error
- * packet, then terminate the connection.
- */
- if (!ret) {
- char message[] = "Authentication failed at PuTTY X11 proxy";
- unsigned char reply[8 + sizeof(message) + 4];
- int msglen = sizeof(message)-1; /* skip zero byte */
- int msgsize = (msglen+3) &~ 3;
- reply[0] = 0; /* failure */
- reply[1] = msglen; /* length of reason string */
- memcpy(reply+2, pr->firstpkt+2, 4); /* major/minor proto vsn */
- PUT_16BIT(pr->firstpkt[0], reply+6, msglen >> 2); /* data len */
- memset(reply+8, 0, msgsize);
- memcpy(reply+8, message, msglen);
- sshfwd_write(pr->c, reply, 8+msgsize);
- sshfwd_close(pr->c);
- x11_close(s);
- return;
- }
-
- /*
- * Now we know we're going to accept the connection. Strip
- * the auth data. (TODO: if we ever work out how, we should
- * replace some real auth data in here.)
- */
- PUT_16BIT(pr->firstpkt[0], pr->firstpkt+6, 0); /* auth proto */
- PUT_16BIT(pr->firstpkt[0], pr->firstpkt+8, 0); /* auth data */
- sk_write(s, pr->firstpkt, 12);
- pr->verified = 1;
+ int ret;
+
+ pr->auth_protocol[pr->auth_plen] = '\0'; /* ASCIZ */
+ ret = x11_verify(pr->auth, pr->auth_protocol,
+ pr->auth_data, pr->auth_dlen);
+
+ /*
+ * If authentication failed, construct and send an error
+ * packet, then terminate the connection.
+ */
+ if (!ret) {
+ char message[] = "Authentication failed at PuTTY X11 proxy";
+ unsigned char reply[8 + sizeof(message) + 4];
+ int msglen = sizeof(message) - 1; /* skip zero byte */
+ int msgsize = (msglen + 3) & ~3;
+ reply[0] = 0; /* failure */
+ reply[1] = msglen; /* length of reason string */
+ memcpy(reply + 2, pr->firstpkt + 2, 4); /* major/minor proto vsn */
+ PUT_16BIT(pr->firstpkt[0], reply + 6, msgsize >> 2);/* data len */
+ memset(reply + 8, 0, msgsize);
+ memcpy(reply + 8, message, msglen);
+ sshfwd_write(pr->c, reply, 8 + msgsize);
+ sshfwd_close(pr->c);
+ x11_close(s);
+ return 0;
+ }
+
+ /*
+ * Now we know we're going to accept the connection. Strip
+ * the auth data. (TODO: if we ever work out how, we should
+ * replace some real auth data in here.)
+ */
+ PUT_16BIT(pr->firstpkt[0], pr->firstpkt + 6, 0); /* auth proto */
+ PUT_16BIT(pr->firstpkt[0], pr->firstpkt + 8, 0); /* auth data */
+ sk_write(s, pr->firstpkt, 12);
+ pr->verified = 1;