[1285] in Moira

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

blanche not stripping "@mit.edu"

daemon@ATHENA.MIT.EDU (Jonathon Weiss)
Sat Sep 18 01:33:34 1999

Date: Sat, 18 Sep 1999 01:33:30 -0400 (EDT)
Message-Id: <199909180533.BAA53233@deliverator.mit.edu>
To: bug-moira@MIT.EDU
From: Jonathon Weiss <jweiss@MIT.EDU>


I found that blanche only stripped @mit.edu from a string before
adding it to a list if the user explicitly specified that it was a
string.  A much more common case is the user who tries to add
foo@mit.edu without specifying that it is a string.  The following
patch causes blanche to strip the @mit.edu unless the user is trying
to add a kerberos principal.  It also preserves the behavior of
converting things that are explicitly strings to type any if it
stripped the domain.  I'm not particularly attached to this behavior,
and actually think we might be better without it; opnions?

Can someone please review this patch for sanity?

	Jonathon


Index: blanche.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/blanche/blanche.c,v
retrieving revision 1.40
diff -c -r1.40 blanche.c
*** blanche.c	1999/05/13 18:53:41	1.40
--- blanche.c	1999/09/18 05:17:20
***************
*** 468,474 ****
    while (sq_get_data(addlist, &memberstruct))
      {
        /* canonicalize string if necessary */
!       if (memberstruct->type == M_STRING &&
  	  (p = strchr(memberstruct->name, '@')))
  	{
  	  char *host = canonicalize_hostname(strdup(++p));
--- 468,474 ----
    while (sq_get_data(addlist, &memberstruct))
      {
        /* canonicalize string if necessary */
!       if (memberstruct->type != M_KERBEROS &&
  	  (p = strchr(memberstruct->name, '@')))
  	{
  	  char *host = canonicalize_hostname(strdup(++p));
***************
*** 498,505 ****
  		{
  		  host = strdup(memberstruct->name);
  		  *(strchr(memberstruct->name, '@')) = 0;
! 		  memberstruct->type = M_ANY;
! 		  fprintf(stderr, "Warning: \"STRING:%s\" converted to "
  			  "\"%s\" because it is a local name.\n",
  			  host, memberstruct->name);
  		  break;
--- 498,506 ----
  		{
  		  host = strdup(memberstruct->name);
  		  *(strchr(memberstruct->name, '@')) = 0;
! 		  if (memberstruct->type == M_STRING)
! 		      memberstruct->type = M_ANY;
! 		  fprintf(stderr, "Warning: \"%s\" converted to "
  			  "\"%s\" because it is a local name.\n",
  			  host, memberstruct->name);
  		  break;


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