[2498] in Kerberos

home help back first fref pref prev next nref lref last post

V5 beta: make popper work

daemon@ATHENA.MIT.EDU (Jonathan I. Kamens)
Wed Jan 6 16:57:11 1993

Date: 6 Jan 1993 21:37:16 GMT
From: jik@Athena.MIT.EDU (Jonathan I. Kamens)
To: kerberos@shelby.Stanford.EDU

The following patches, to be applied in appl/popper, make it work (it wouldn't
even compile as shippped).

In more detail, they make the following changes:

pop_enter.c:

1) Fix a reversed "if" statement.
2) Use "com_err" to report errors.

pop_init.c:

In general, fix it and make it work.

pop_updt.c:

Fix it to recognize the "From " line format produced by SunOS /bin/mail.

*** 1.1	1992/12/03 21:58:05
--- pop_enter.c	1992/12/03 22:19:17
***************
*** 10,16 ****
  #include <sys/stat.h>
  #include <sys/file.h>
  #include <mit-copyright.h>
! 
  #ifdef ZEPHYR
  #include <zephyr/zephyr.h>
  
--- 10,17 ----
  #include <sys/stat.h>
  #include <sys/file.h>
  #include <mit-copyright.h>
! #include <com_err.h>
!      
  #ifdef ZEPHYR
  #include <zephyr/zephyr.h>
  
***************
*** 43,49 ****
  
    while (--argc > 0) 
      {
!       if(open_drop(argv[i]) < 0)
  	{
  	  lseek(newmail, 0, L_SET);
  	  if(new_message(maildrop, newmail) < 0)
--- 44,50 ----
  
    while (--argc > 0) 
      {
!       if(open_drop(argv[i]) != -1)
  	{
  	  lseek(newmail, 0, L_SET);
  	  if(new_message(maildrop, newmail) < 0)
***************
*** 51,58 ****
  	  if(close(maildrop) < 0)
  	    {
  	      status = 1;
! 	      sprintf(buffer, "%s: error on close", argv[i]);
! 	      error(buffer, errno);
  	    }
  	  notify_recipient(argv[i]);
  	}
--- 52,58 ----
  	  if(close(maildrop) < 0)
  	    {
  	      status = 1;
! 	      com_err(argv[i], errno, "error on close");
  	    }
  	  notify_recipient(argv[i]);
  	}
*** 1.1	1992/11/16 20:06:57
--- pop_init.c	1992/12/17 20:49:44
***************
*** 24,29 ****
--- 24,34 ----
  #include "popper.h"
  
  #ifdef KERBEROS
+ #ifndef KRB4
+ #ifndef KRB5
+  #error you must use one of KRB4, KRB5 if KERBEROS is enabled
+ #endif /* ! KRB5 */
+ #endif /* ! KRB4 */
  #ifdef KRB4
  #ifdef KRB5
   #error you can only use one of KRB4, KRB5
***************
*** 302,310 ****
  
      strcpy(p->user, kdata.pname);
  
      krb5_init_ets();
  
!     if (retval = krb5_sname_to_principal(p->myhost, "pop", TRUE, &server)) {
  	pop_msg(p, POP_FAILURE,
  		"server mis-configured, can't get principal--%s",
  		error_message(retval));
--- 307,322 ----
  
      strcpy(p->user, kdata.pname);
  
+ #else /* must be krb5 */
+     int retval;
+     int sock = 0;
+     krb5_principal server;
+     krb5_data *tmpdata;
+ 
      krb5_init_ets();
  
!     if (retval = krb5_sname_to_principal(p->myhost, "pop", KRB5_NT_SRV_HST,
! 					 &server)) {
  	pop_msg(p, POP_FAILURE,
  		"server mis-configured, can't get principal--%s",
  		error_message(retval));
***************
*** 341,347 ****
      pop_log(p, POP_DEBUG, "%s (%s): ok", client_name, inet_ntoa(addr->sin_addr));
  #endif /* DEBUG */
  
! #endif /* KRB5 */
  #endif /* KERBEROS */
  
      return(POP_SUCCESS);
--- 353,363 ----
      pop_log(p, POP_DEBUG, "%s (%s): ok", client_name, inet_ntoa(addr->sin_addr));
  #endif /* DEBUG */
  
!     tmpdata = krb5_princ_component(ext_client, 0);
!     strncpy(p->user, tmpdata->data, tmpdata->length);
!     p->user[tmpdata->length] = '\0';
! 
! #endif /* KRB4 */
  #endif /* KERBEROS */
  
      return(POP_SUCCESS);
*** 1.1	1992/12/03 22:16:52
--- pop_updt.c	1992/12/03 22:17:33
***************
*** 252,258 ****
    if(*line++ != ' ')
      return(0);
    
!   if(strlen(line) < 28)
      return(0);
  
    /* Tue */
--- 252,258 ----
    if(*line++ != ' ')
      return(0);
    
!   if(strlen(line) < 20)
      return(0);
  
    /* Tue */

-- 
Jonathan Kamens                                         jik@MIT.Edu
Aktis, Inc.                                 Moderator, news.answers

home help back first fref pref prev next nref lref last post