[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Cleanup.
From: |
shishi-commit |
Subject: |
Cleanup. |
Date: |
Sat, 13 Dec 2003 12:21:12 +0100 |
Commit from jas (2003-12-13 12:21 CET)
---------------
Cleanup.
inetutils libtelnet/shishi.c 1.4
----------------------------
inetutils/libtelnet/shishi.c (1.3 -> 1.4)
----------------------------
@@ -1,22 +1,26 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Simon Josefsson
+ Copyright (C) 2003 Free Software Foundation, Inc.
-This file is part of GNU Inetutils.
+This file is part of Shishi / GNU Inetutils.
-GNU Inetutils is free software; you can redistribute it and/or modify
+Shishi is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-GNU Inetutils is distributed in the hope that it will be useful,
+Shishi is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with GNU Inetutils; see the file COPYING. If not, write to
+along with Shishi; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+/* Written by Simon Josefsson and Nicolas Pouvesle, based on
+ kerberos5.c from GNU InetUtils. */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -169,85 +173,66 @@
type_check[0] = ap->type;
type_check[1] = ap->way;
- if (tkt)
+ rc = shishi_ap_etype (shishi_handle, &auth_handle, SHISHI_DES_CBC_MD5);
+ if (rc != SHISHI_OK)
{
- rc = shishi_ap_nosubkey (shishi_handle, &auth_handle);
- if (rc != SHISHI_OK)
- {
- DEBUG (("telnet: Kerberos V5: Could not make AP-REQ (%s)\r\n",
- shishi_strerror (rc)));
- return 0;
- }
-
- rc = shishi_key_random (shishi_handle, SHISHI_DES_CBC_MD5, &subkey);
- if (rc != SHISHI_OK)
- return rc;
-
- rc = shishi_authenticator_set_subkey (shishi_handle,
shishi_ap_authenticator (auth_handle),
- shishi_key_type (subkey),
- shishi_key_value (subkey),
- shishi_key_length (subkey));
- if (rc != SHISHI_OK)
- {
- DEBUG (("telnet: Kerberos V5: Could not make AP-REQ (%s)\r\n",
- shishi_strerror (rc)));
- return 0;
- }
-
- shishi_key_done (subkey);
+ DEBUG (("telnet: Kerberos V5: Could not make AP-REQ (%s)\r\n",
+ shishi_strerror (rc)));
+ return 0;
+ }
- rc = shishi_ap_set_tktoptionsdata (auth_handle, tkt, ap_opts, (char *)
&type_check, 2);
- if (rc != SHISHI_OK)
- {
- DEBUG (("telnet: Kerberos V5: Could not make AP-REQ (%s)\r\n",
- shishi_strerror (rc)));
- return 0;
- }
+ rc = shishi_ap_set_tktoptionsdata (auth_handle, tkt, ap_opts,
+ (char *) &type_check, 2);
+ if (rc != SHISHI_OK)
+ {
+ DEBUG (("telnet: Kerberos V5: Could not make AP-REQ (%s)\r\n",
+ shishi_strerror (rc)));
+ return 0;
+ }
#ifdef ENCRYPTION
- if (enckey)
- {
- shishi_key_done (enckey);
- enckey = NULL;
- }
-
- rc = shishi_authenticator_get_subkey (shishi_handle,
shishi_ap_authenticator (auth_handle), &enckey);
- if ((rc != SHISHI_OK) || ((shishi_key_type (enckey) !=
SHISHI_DES_CBC_CRC) &&
- (shishi_key_type (enckey) !=
SHISHI_DES_CBC_MD5)))
- {
- DEBUG (("telnet: Kerberos V5: could get encryption key (%s)\r\n",
- shishi_strerror (rc)));
- return 0;
- }
+ if (enckey)
+ {
+ shishi_key_done (enckey);
+ enckey = NULL;
+ }
+
+ rc = shishi_authenticator_get_subkey
+ (shishi_handle, shishi_ap_authenticator (auth_handle), &enckey);
+ if ((rc != SHISHI_OK) || (shishi_key_type (enckey) != SHISHI_DES_CBC_MD5))
+ {
+ DEBUG (("telnet: Kerberos V5: could not get encryption key (%s)\r\n",
+ shishi_strerror (rc)));
+ return 0;
+ }
#endif
-
- rc = shishi_ap_req_der (auth_handle, &apreq, &apreq_len);
- if (rc != SHISHI_OK)
- {
- DEBUG (("telnet: Kerberos V5: could not DER encode (%s)\r\n",
- shishi_strerror (rc)));
- return 0;
- }
- if (auth_debug_mode)
- {
- shishi_authenticator_print
- (shishi_handle, stdout, shishi_ap_authenticator (auth_handle));
- shishi_apreq_print (shishi_handle, stdout,
- shishi_ap_req (auth_handle));
- }
+ rc = shishi_ap_req_der (auth_handle, &apreq, &apreq_len);
+ if (rc != SHISHI_OK)
+ {
+ DEBUG (("telnet: Kerberos V5: could not DER encode (%s)\r\n",
+ shishi_strerror (rc)));
+ return 0;
+ }
- if (!auth_sendname (UserNameRequested, strlen (UserNameRequested)))
- {
- DEBUG (("telnet: Not enough room for user name\r\n"));
- return 0;
- }
+ if (auth_debug_mode)
+ {
+ shishi_authenticator_print (shishi_handle, stdout,
+ shishi_ap_authenticator (auth_handle));
+ shishi_apreq_print (shishi_handle, stdout,
+ shishi_ap_req (auth_handle));
+ }
- if (!Data (ap, KRB_AUTH, apreq, apreq_len))
- {
- DEBUG (("telnet: Not enough room for authentication data\r\n"));
- return 0;
- }
+ if (!auth_sendname (UserNameRequested, strlen (UserNameRequested)))
+ {
+ DEBUG (("telnet: Not enough room for user name\r\n"));
+ return 0;
+ }
+
+ if (!Data (ap, KRB_AUTH, apreq, apreq_len))
+ {
+ DEBUG (("telnet: Not enough room for authentication data\r\n"));
+ return 0;
}
DEBUG (("telnet: Sent Kerberos V5 credentials to server\r\n"));
- Cleanup., shishi-commit, 2003/12/10
- Cleanup., shishi-commit, 2003/12/10
- Cleanup., shishi-commit, 2003/12/11
- Cleanup.,
shishi-commit <=
- Cleanup., shishi-commit, 2003/12/18
- Cleanup., shishi-commit, 2003/12/18
- Cleanup., shishi-commit, 2003/12/18
- Cleanup., shishi-commit, 2003/12/18