Back to index

courier  0.68.2
logindomainlist.c
Go to the documentation of this file.
00001 #include "config.h"
00002 /*
00003 ** Copyright 2003 Double Precision, Inc.  See COPYING for
00004 ** distribution information.
00005 **
00006 ** Original author: Jesse D. Guardiani, wingnet.net
00007 */
00008 
00009 /*
00010 */
00011 
00012 #include      <stdio.h>
00013 #include      <stdlib.h>
00014 #include      <string.h>
00015 
00016 #include      "logindomainlist.h"
00017 
00018 /* LINELEN is the maximum length of a line in the file we are reading. */
00019 #define              LINELEN 500
00020 #define              NUM_WC_EN_MODS 2
00021 
00022 /* constants */
00023 static const int g_delim=':';
00024 static const int g_wildcard_char='*';
00025 
00026 /* array of wildcard enabled modifiers */
00027 static const char g_wc_en_mods[NUM_WC_EN_MODS][2] = { "@", "-" };
00028 
00029 /* --------------------------------------------------------------
00030  * Function : mystrsep()
00031  * Created  : 03/03/03
00032  * Author   : JDG
00033  * Purpose  : Emulate the BSD strsep() function.
00034  * Notes    : 
00035  * This function is designed to emulate the BSD strsep function 
00036  * without introducing any doubts that it is a custom 
00037  * implementation. It's probably quite a bit slower than the 
00038  * original BSD strsep(), but it'll do for most purposes. 
00039  * mystrsep's functionality should be nearly identical to the 
00040  * BSD strsep, except that it takes an int as argument for the 
00041  * delimiter.
00042  * -------------------------------------------------------------- */
00043 static char *mystrsep( char **stringp, int delim )
00044 {
00045        char *orig_stringp=*stringp;
00046 
00047        /* Make sure we return NULL if we are given NULL */
00048        if (*stringp == NULL) return orig_stringp;
00049 
00050        /* Locate first occurance of delim in stringp */
00051        *stringp=strchr(*stringp, delim);
00052        
00053        /* If no more delimiters were found, return the last substring */
00054        if (*stringp == NULL) return orig_stringp;
00055 
00056        /* Set that first occurance to NUL */
00057        **stringp='\0';
00058        
00059        /* move pointer in front of NUL character */
00060        ++(*stringp);
00061        
00062        /* Return original value of *stringp */
00063        return orig_stringp;
00064 
00065 }
00066 
00067 
00068 /* --------------------------------------------------------------
00069  * Function : ldl_haswildcard()
00070  * Created  : 04/08/03
00071  * Author   : JDG
00072  * Purpose  : Determine if the NUL terminated stringp contains
00073  *            the wildcard character specified in wildcard.
00074  * Notes    : Returns 0 if wildcard doesn't exist in stringp.
00075  *            Returns 1 if stringp does contain wildcard.
00076  * -------------------------------------------------------------- */
00077 static int ldl_haswildcard( char *stringp, int wildcard)
00078 {
00079        char *wildcardp;
00080 
00081        /* get pointer to wildcard within stringp */
00082        wildcardp = strchr(stringp, wildcard);
00083 
00084        if (wildcardp == NULL) return 0;
00085 
00086        return 1;
00087 }
00088 
00089 
00090 /* --------------------------------------------------------------
00091  * Function : ldl_getfields()
00092  * Created  : 03/04/03
00093  * Modified : 04/07/03 by JDG
00094  * Author   : JDG
00095  * Purpose  : Retrieve fields from a logindomainlist statement.
00096  * Notes    : This function is designed to provide a standard
00097  *            interface to retrieve fields from a logindomainlist
00098  *            statement line.
00099  *
00100  *            This function should never generate a NULL pointer,
00101  *            even if a field is empty.
00102  * -------------------------------------------------------------- */
00103 static void ldl_getfields( char *statementp, char *firstfieldp, char *secondfieldp, char *thirdfieldp )
00104 {
00105        int  delim=g_delim;
00106        char *tempfirst;
00107        char *tempsecond;
00108        char *tempthird;
00109        char *bufp=statementp;
00110 
00111 
00112        /* get pointers to individual fields from file */
00113        tempfirst=mystrsep(&bufp, delim);
00114        tempsecond=mystrsep(&bufp, delim);
00115        tempthird=mystrsep(&bufp, delim);
00116 
00117        /* fix NULL pointers */
00118        if (tempfirst == NULL) tempfirst="";
00119        if (tempsecond == NULL) tempsecond="";
00120        if (tempthird == NULL) tempthird="";
00121 
00122        /* copy strings */
00123        strcpy(firstfieldp, tempfirst);
00124        strcpy(secondfieldp, tempsecond);
00125        strcpy(thirdfieldp, tempthird);
00126 }
00127 
00128 
00129 /* --------------------------------------------------------------
00130  * Function : ldl_invalidstatement()
00131  * Created  : 03/04/03
00132  * Modified : 04/07/03
00133  * Author   : JDG
00134  * Purpose  : Examine line and determine if it is a valid state-
00135  *            ment.
00136  * Notes    : This function can be used to filter out comments,
00137  *            empty lines, and anything else that shouldn't be in
00138  *            a valid statement line. Returns 1 (one) if
00139  *            statementp is a comment or other invalid statement.
00140  *
00141  *            Returns zero otherwise.
00142  * -------------------------------------------------------------- */
00143 static int ldl_invalidstatement( char *statementp )
00144 {
00145        const int TRUE = 1;
00146        const int FALSE = 0;
00147        
00148        /* comments aren't valid statements */
00149        if (statementp[0] == '#') return TRUE;
00150 
00151        /* empty lines aren't valid statements */
00152        if (statementp[0] == ' ' ||
00153            statementp[0] == '\t' ||
00154            statementp[0] == '\n') return TRUE;
00155 
00156        /* extra long lines aren't valid statements either... */
00157        if (strlen(statementp) > LINELEN) return TRUE;
00158 
00159        /* might be a valid statement line */
00160        return FALSE;
00161 }
00162 
00163 
00164 /* --------------------------------------------------------------
00165  * Function : extract_wildcardvalue()
00166  * Created  : 04/07/03
00167  * Author   : JDG
00168  * Purpose  : compare wildcardedstringp and realstringp. If the
00169  *            two match, then replace the contents of realstringp
00170  *            with the contents of the wildcard character in
00171  *            wildcardedstringp.
00172  * Notes    : If the substring beforewildcardp appears at the
00173  *            absolute beginning of realstringp, then
00174  *            beforewildcardp is deleted from realstring.
00175  *            If the substring afterwildcardp appears at the
00176  *            absolute end of realstringp, then afterwildcardp
00177  *            is deleted from realstringp.
00178  *            
00179  *            The string remaining in realstringp represents the
00180  *            contents of our wildcard character in
00181  *            wildcardedstringp.
00182  *
00183  *            For example, if:
00184  *
00185  *            wildcardedstringp = my*domain.com
00186  *            realstringp       = myexampledomain.com
00187  *
00188  *            Then extract_wildcardvalue() will replace the
00189  *            contents of realstringp with the following string:
00190  *
00191  *            example
00192  *            
00193  *            If no wildcard character exists in
00194  *            wildcardedstringp or if wildcardedstringp and
00195  *            realstringp don't match, extract_wildcardvalue()
00196  *            will return zero.
00197  *            
00198  *            Otherwise, extract_wildcardvalue() returns non
00199  *            zero.
00200  * -------------------------------------------------------------- */
00201 static int extract_wildcardvalue( char *wildcardedstringp, char *realstringp, int wildcard) {
00202        char wildcardedstring[LINELEN]="";
00203        char *beforewildcardp;
00204        char *afterwildcardp;
00205        char *wildcardedstringpp=NULL;
00206 
00207 
00208        /* Continue only if there is actually a wildcard character in wildcardedstring */
00209        if (ldl_haswildcard(wildcardedstringp, wildcard)) {
00210               /* Copy argument to buffer so as not to modify the original. */
00211               strcpy(wildcardedstring, wildcardedstringp);
00212 
00213               /* create a pointer to a pointer of a copy*/     
00214               wildcardedstringpp = wildcardedstring;
00215               
00216 
00217               /* tokenize wildcardstring with '\0's */
00218               beforewildcardp=mystrsep(&wildcardedstringpp, wildcard);
00219               afterwildcardp=mystrsep(&wildcardedstringpp, wildcard);
00220 
00221 
00222               if (beforewildcardp != NULL && strcmp(beforewildcardp, "") != 0)
00223               {
00224                      /* If beforewildcardp string exists at the absolute
00225                       * beginning of realstring */
00226                      if (strstr(realstringp, beforewildcardp) == realstringp)
00227                      {
00228                             char *tmpp=realstringp;
00229                             char *p;
00230 
00231                             /* move pointer to the end of beforewildcardp in
00232                              * realstring. */
00233                             tmpp=tmpp + strlen(beforewildcardp);
00234 
00235                             /* Now, "delete" beforewildcardp from the very
00236                              * beginning of realstring. Note that we're not
00237                              * actually deleting it. We're just copying the
00238                              * remaining string in realstring from the
00239                              * location that tmpp points to in realstring.
00240                              * However, this has the same effect as if we
00241                              * had somehow "deleted" beforewildcardp from
00242                              * the beginning of realstring. */
00243                             
00244                             p=realstringp;
00245 
00246                             while ((*p++= *tmpp++) != 0)
00247                                    ;
00248                      }
00249                      else
00250                      {
00251                             /* if beforewildcardp does not exist at the
00252                              * beginning of realstringp, return non zero. */
00253                             return 0;
00254                      }
00255               }
00256 
00257 
00258               if (afterwildcardp != NULL && strcmp(afterwildcardp, "") != 0)
00259               {
00260                      /* If afterwildcardp exists at the very end of realstring */
00261                      size_t n=strlen(realstringp);
00262                      size_t o=strlen(afterwildcardp);
00263 
00264                      if (n >= o &&
00265                          strcmp(realstringp+n-o, afterwildcardp) == 0)
00266                      {
00267                             char *tmpp=realstringp;
00268 
00269                             /* move temp pointer to the end of the NUL
00270                              * terminated string in realstringp, then
00271                              * backspace the length of afterwildcardp
00272                              * and write a NUL character.
00273                              *
00274                              * This effectively "deletes"
00275                              * afterwildcardp from realstringp as far
00276                              * as any string manipulation functions
00277                              * that rely on a terminating NUL character
00278                              * are concerned. */
00279                             tmpp=tmpp + n - o;
00280                             *tmpp='\0';
00281                      }
00282                      else
00283                      {
00284                             /* if afterwildcardp does not exist at the
00285                              * end of realstringp, return non zero. */
00286                             return 0;
00287                      }
00288               }
00289 
00290 
00291               /* if we made it here, then we must have
00292                * successfully removed everything but
00293                * the value of the wildcard in
00294                * wildcardedstringp from realstringp.
00295                *
00296                * Return zero. */
00297               return 1;
00298        } else {
00299               /* no wildcard in wildcardedstringp */
00300               return 0;
00301        }
00302 }
00303 
00304 
00305 /* --------------------------------------------------------------
00306  * Function : replace_wildcard()
00307  * Created  : 04/07/03
00308  * Author   : JDG
00309  * Purpose  : replace wildcard character in wildcardedstringp
00310  *            with contents of wildcardvalue.
00311  * Notes    : return non zero on success. return zero otherwise.
00312  * -------------------------------------------------------------- */
00313 static int replace_wildcard( char *wildcardedstringp, char *wildcardvaluep, int wildcard) {
00314        char wildcardedstring[LINELEN]="";
00315        char *beforewildcardp;
00316        char *afterwildcardp;
00317        char *wildcardedstringpp=NULL;
00318 
00319        
00320        /* Continue only if there is actually a wildcard in wildcardedstringp */
00321        if (ldl_haswildcard(wildcardedstringp, wildcard)) {
00322               /* Copy wildcardedstringp so as not to modify the original. */
00323               strcpy(wildcardedstring, wildcardedstringp);
00324 
00325               /* create a pointer to a pointer of a copy */    
00326               wildcardedstringpp = wildcardedstring;
00327 
00328               
00329               /* tokenize first field */
00330               beforewildcardp=mystrsep(&wildcardedstringpp, wildcard);
00331               afterwildcardp=mystrsep(&wildcardedstringpp, wildcard);
00332 
00333               /* start with a clean slate */
00334               strcpy(wildcardedstringp, "");
00335 
00336               if (beforewildcardp != NULL &&
00337                   strcmp(beforewildcardp, "") != 0)
00338               {
00339                      /* Place string contents of beforewildcardp in wildcardedstringp */
00340                      strcpy(wildcardedstringp, beforewildcardp);
00341               }
00342 
00343               /* Add wildcardvaluep string to end of wildcardedstringp */
00344               strncat(wildcardedstringp, wildcardvaluep,
00345                      LINELEN-1-strlen(wildcardedstringp));
00346 
00347               if (afterwildcardp != NULL &&
00348                   strcmp(afterwildcardp, "") != 0)
00349               {
00350                      /* Add afterwildcardp string to end of wildcardedstringp */
00351                      strncat(wildcardedstringp, afterwildcardp,
00352                             LINELEN-1-strlen(wildcardedstringp));
00353               }
00354 
00355               /* all is well */
00356               return 1;
00357 
00358        } else {
00359               /* no wildcard in wildcardedstringp */
00360               return 0;
00361        }
00362 }
00363 
00364 
00365 /* --------------------------------------------------------------
00366  * Function : get_defaultdomainfields()
00367  * Created  : 02/25/03
00368  * Modified : 04/07/03 by JDG
00369  * Author   : JDG
00370  * Purpose  : Retrieve default domain from 'LOGINDOMAINLIST' file
00371  *            using either 'SERVER_ADDR' or 'HTTP_HOST' CGI 
00372  *            variables.
00373  * Notes    : 
00374  *
00375  * LOGINDOMAINLIST file can have the following format:
00376  * 
00377  * DOMAIN1:IP1:MODIFIER
00378  * DOMAIN2:DOMAIN3:MODIFIER
00379  * DOMAIN4:DOMAIN5:MODIFIER
00380  * etc...
00381  *
00382  * The first field contains the mail domain, and it is this field
00383  * that appears in the drop down list if a drop down is specified
00384  * by the modifier field.
00385  *
00386  * The second field can contain either an IP address or a domain
00387  * name. This field is campared against the contents of the
00388  * HTTP_HOST and/or SERVER_ADDR CGI environment variables. If a
00389  * match is found, then the first and third (last) fields are
00390  * written to domainp and modifyp, respectively.
00391  *
00392  * The third field, or modifier, can be an "*", an "@", or an
00393  * rbitrary group identifier string. See README.logindomainlist
00394  * in the main distribution directory for more details regarding
00395  * LOGINDOMAINLIST file syntax.
00396  * -------------------------------------------------------------- */
00397 static void get_defaultdomainfields( FILE *fp, char *domainp, char *modifyp)
00398 {
00399        char buf[LINELEN]="";
00400        char *serveraddr=getenv("SERVER_ADDR");
00401        char *httphost=getenv("HTTP_HOST");
00402 
00403        if (!serveraddr) serveraddr="";
00404        if (!httphost) httphost="";
00405 
00406        /* rewind the file pointer */
00407        rewind(fp);
00408 
00409        /* Read one line at a time from fp */
00410        while (fgets(buf, sizeof(buf), fp))
00411        {
00412               int count = 0;
00413               char firstfield[LINELEN]="";
00414               char secondfield[LINELEN]="";
00415               char thirdfield[LINELEN]="";
00416               /* get the position of the newline (if it exists) */
00417               char *p=strchr(buf, '\n');
00418 
00419               /* replace the newline with NUL */
00420               if (*p) *p='\0';
00421 
00422               /* ignore comments, empty lines, etc... */
00423               if (ldl_invalidstatement(buf)) continue;
00424 
00425 
00426               /* get individual fields from line */
00427               ldl_getfields(buf, firstfield, secondfield, thirdfield);
00428 
00429               /* process any wildcard enabled modifiers */
00430               for (count = 0; count < NUM_WC_EN_MODS; count++)
00431               {
00432                      const char *current_modifier = &g_wc_en_mods[count][0];
00433               
00434                      /* If this record is using wildcard domain mapping... */
00435                      if (strcmp(thirdfield, current_modifier) == 0)
00436                      {
00437                             int  wildcard = g_wildcard_char;
00438 
00439                             /* If either the first or second field contains a wildcard char */
00440                             if (ldl_haswildcard(firstfield, wildcard) ||
00441                                 ldl_haswildcard(secondfield, wildcard))
00442                             {
00443                                    char finaldomain[LINELEN] = "";
00444                                    char wildcardvalue[LINELEN] = "";
00445                                    char tempbuf[LINELEN] = "";
00446 
00447                                    /* extract the string that the wildcard in
00448                                     * secondfield represents when compared
00449                                     * with currentdomain */
00450 
00451                                    /* seed wildcardvalue with contents of
00452                                     * httphost. Sorry - no IP wildcarding. */
00453                                    strcpy( wildcardvalue, httphost);
00454 
00455                                    /* if secondfield and wildcardvalue match,
00456                                     * extract_wildcardvalue will "chop off"
00457                                     * the text before and after the wildcard
00458                                     * character in secondfield from
00459                                     * wildcardvalue */
00460                                    if (extract_wildcardvalue(secondfield, wildcardvalue, wildcard))
00461                                    {
00462                                           /* wildcardvalue may now contain the final
00463                                            * domain name to use as default domain if
00464                                            * firstfield does NOT contain a wildcard.
00465                                            *
00466                                            * That is why we save the contents of
00467                                            * wildcardvalue in finaldomain here. */
00468                                           strcpy(finaldomain, wildcardvalue);
00469                                    }
00470                                    else
00471                                    {
00472                                           /* Make sure this wildcardless record
00473                                            * actually matches httphost before doing
00474                                            * anything else */
00475                                           if (strcmp(secondfield, httphost) != 0) continue;
00476 
00477                                           /* we don't have a wildcard in the second
00478                                            * field, so just do a straight copy */
00479                                           strcpy(finaldomain, secondfield);
00480                                    }
00481 
00482                                    
00483                                    /* seed tempbuf with contents of firstfield */
00484                                    strcpy(tempbuf, firstfield);
00485 
00486                                    /* Replace wildcard character in tempbuf
00487                                     * with contents of wildcardvalue */
00488                                    if (replace_wildcard(tempbuf, wildcardvalue, wildcard))
00489                                    {
00490 
00491                                           /* The above replace_wildcard() must have
00492                                            * been seccessful if we're still here,
00493                                            * so save the contents of tempbuf in
00494                                            * finaldomain. */
00495                                           strcpy(finaldomain, tempbuf);
00496                                    }
00497                                    else
00498                                    {
00499                                           /* we don't have a wildcard in the first
00500                                            * field, so just do a straight copy */
00501                                           strcpy(finaldomain, firstfield);
00502                                    }
00503 
00504                                    /* return default domain */
00505                                    strcpy(domainp, finaldomain);
00506                                    strcpy(modifyp, thirdfield);
00507                                    return;
00508                             }
00509                             else
00510                             {
00511                                    /* Fall through to matching against serveraddr
00512                                     * and httphost if no wildcards exist in either
00513                                     * firstfield or secondfield */
00514                             }
00515                      }
00516               }
00517 
00518                      
00519               /* This is reached if the third field (modifier) is NOT a wildcard */
00520               /* compare second field against CGI variables */
00521               if (strcmp(secondfield, serveraddr) == 0 ||
00522                   strcmp(secondfield, httphost) == 0)
00523               {
00524                      strcpy(domainp, firstfield);
00525                      strcpy(modifyp, thirdfield);
00526                      return;
00527               }
00528 
00529        }
00530 }
00531 
00532 
00533 /* --------------------------------------------------------------
00534  * Function : ldl_displayhidden()
00535  * Created  : 04/05/03
00536  * Author   : JDG
00537  * Purpose  : display an HTML hidden input field with
00538  *            value="defaultdomain"
00539  * Notes    : none
00540  * -------------------------------------------------------------- */
00541 static void ldl_displayhiddenfield( char *defaultdomainp) {
00542        
00543        if (strlen(defaultdomainp) > 0)
00544        {
00545               /* This is displayed only if defaultdomain is NOT
00546                * empty */
00547               printf("<input type=\"hidden\" name=\"logindomain\" value=\"%s\" />@%s",
00548                             defaultdomainp, defaultdomainp);
00549        }
00550        else
00551        {
00552               /* Do nothing. This is here so that nothing will
00553                * be displayed if defaultdomain is empty. */
00554        }
00555 }
00556 
00557 
00558 /* --------------------------------------------------------------
00559  * Function : ldl_displaytextfield()
00560  * Created  : 04/07/03
00561  * Author   : JDG
00562  * Purpose  : display an HTML text input field with
00563  *            value="defaultdomain"
00564  * Notes    : none
00565  * -------------------------------------------------------------- */
00566 static void ldl_displaytextfield( char *defaultdomainp) {
00567        
00568        if (strlen(defaultdomainp) > 0)
00569        {
00570               /* This is displayed only if defaultdomain is NOT
00571                * empty */
00572               printf("@<input type=\"text\" name=\"logindomain\" value=\"%s\" size=\"%d\" />",
00573                             defaultdomainp, (int)strlen(defaultdomainp)+2);
00574        }
00575        else
00576        {
00577               /* Do nothing. This is here so that nothing will
00578                * be displayed if defaultdomain is empty. */
00579        }
00580 }
00581 
00582 /* --------------------------------------------------------------
00583  * Function : ldl_displaydropdown()
00584  * Created  : 04/05/03
00585  * Modified : 04/07/03
00586  * Author   : JDG
00587  * Purpose  : Display an HTML drop down menu containing only
00588  *            records from fp with a third field identical to
00589  *            defaultgroupp.
00590  *            Set the record with a first field matching
00591  *            defaultdomainp as 'selected'.
00592  * Notes    : none
00593  * -------------------------------------------------------------- */
00594 static void ldl_displaydropdown( FILE *fp, char *defaultdomainp, char *defaultgroupp) {
00595 
00596        char buf[LINELEN];
00597        
00598        /* This is a flag that is toggled once the first match has been
00599         * made. */
00600        int firstmatch=0;
00601 
00602 
00603        /* rewind file pointer */
00604        rewind(fp);
00605 
00606 
00607        /* Read one line at a time from fp */
00608        while (fgets(buf, sizeof(buf), fp))
00609        {
00610               char firstfield[LINELEN]="";
00611               char secondfield[LINELEN]="";
00612               char thirdfield[LINELEN]="";
00613               /* get the position of the newline (if it exists) */
00614               char *p=strchr(buf, '\n');
00615 
00616               /* replace the newline with NUL */
00617               if (*p) *p='\0';
00618 
00619               /* ignore comments, empty lines, etc... */
00620               if (ldl_invalidstatement(buf)) continue;
00621 
00622               /* get individual fields from file */
00623               ldl_getfields(buf, firstfield, secondfield, thirdfield);
00624 
00625               /* only display this option if it's group field (thirdfield)
00626                * is identical to defaultgroupp. */
00627               if (strcmp(thirdfield, defaultgroupp) == 0)
00628               {
00629                      /* Only display the select tag the first time we
00630                       * find a match. */
00631                      if (firstmatch == 0)
00632                      {
00633                             printf("@<select name=\"logindomain\"><option value=\"\">&nbsp;</option>\n");
00634                             firstmatch=1;
00635                      }
00636 
00637                      /* Do not display options with empty first fields. */
00638                      if (strlen(firstfield) > 0)
00639                      {
00640                             /* If 'defaultdomainp' is identical to firstfield
00641                              * then set this option as 'selected'. */
00642                             if (strcmp(defaultdomainp, firstfield) == 0)
00643                             {
00644                                    printf("<option value=\"%s\" selected=\"selected\">%s</option>\n",
00645                                                  firstfield, firstfield);
00646                             }
00647                             else
00648                             {
00649                                    printf("<option value=\"%s\">%s</option>\n",
00650                                                  firstfield, firstfield);
00651                             }
00652                      }
00653               }      
00654        }
00655 
00656        /* Display a closing select tag only if we displayed
00657         * a starting select tag */
00658        if (firstmatch > 0) printf("</select>");
00659 }
00660 
00661 
00662 /* --------------------------------------------------------------
00663  * Function : print_logindomainlist()
00664  * Created  : 03/04/03
00665  * Modified : 04/07/03 - JDG
00666  * Author   : JDG
00667  * Purpose  : parse fp and print proper output.
00668  * Notes    : none
00669  * -------------------------------------------------------------- */
00670 void print_logindomainlist( FILE *fp )
00671 {
00672        char defaultdomain[LINELEN]="";
00673        char modifierfield[LINELEN]="";
00674 
00675        /* get default domain field and the corresponding default
00676         * group field (if applicable) from fp. */       
00677        get_defaultdomainfields(fp, defaultdomain, modifierfield);
00678 
00679 
00680        /* There are basically two ways to graphically display the
00681         * default domain.
00682         *
00683         * 1.) As a hidden field with descriptive text.
00684         * 2.) As a drop down menu with a defaulted option.
00685         *
00686         * The modifiers '@' and '*' display a hidden field.
00687         *
00688         * If the modifier field contains anything else, then we
00689         * consider it's contents a 'group' identifier and we
00690         * display a drop down. */
00691        if (strcmp(modifierfield, "@") == 0)
00692        {
00693               /* ----------------------
00694                * DISPLAY HIDDEN FIELD
00695                * ---------------------- */
00696               
00697               ldl_displayhiddenfield(defaultdomain);
00698        }
00699        else if (strcmp(modifierfield, "-") == 0)
00700        {
00701               /* ----------------------
00702                * DISPLAY TEXT FIELD
00703                * ---------------------- */
00704 
00705               ldl_displaytextfield(defaultdomain);
00706        }
00707        else
00708        {
00709               /* ----------------------
00710                * DISPLAY DROP DOWN MENU
00711                * ---------------------- */
00712 
00713               ldl_displaydropdown(fp, defaultdomain, modifierfield);
00714        }
00715 }