Skip to content
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
This repository was archived by the owner on Mar 10, 2026. It is now read-only.

ServerName not treated as allowed Host: value #3167

Closed

Description

@michaelrsweet

Version: 1.3.10
CUPS.org User: twaugh.redhat

When a ServerName is set it is not treated as an allowed Host: value.

Original bug report:
https://bugzilla.redhat.com/show_bug.cgi?id=497301

Activity

  1. michaelrsweet commented on Apr 29, 2009

    @michaelrsweet
    ContributorAuthor

    CUPS.org User: mike

    I'm opting to use a simpler fix that just adds the ServerName as an alias, since specifying the ServerName overrides the default auto-detection stuff anyways.

  2. michaelrsweet commented on Apr 29, 2009

    @michaelrsweet
    ContributorAuthor

    "cups-servername-is-alias.patch":

    diff -up cups-1.3.10/scheduler/conf.c~ cups-1.3.10/scheduler/conf.c
    --- cups-1.3.10/scheduler/conf.c~ 2009-04-24 15:14:04.000000000 +0100
    +++ cups-1.3.10/scheduler/conf.c 2009-04-24 16:35:32.000000000 +0100
    @@ -689,38 +689,44 @@ cupsdReadConfiguration(void)
    }

     cupsdSetString(&ServerName, temp);
    
    • add_alias(temp);
    • }
    • if (HostNameLookups || RemoteAccessEnabled)
    • {
    •  struct hostent   *host;      /* Host entry to get FQDN */
      
    •  if ((host = gethostbyname(temp)) != NULL)
      
    • add_alias(ServerName);
    • if (HostNameLookups || RemoteAccessEnabled)
    • {
    • struct hostent host; / Host entry to get FQDN */
    • if ((host = gethostbyname(ServerName)) != NULL)
    • {
    •  if (strcasecmp(ServerName, host->h_name))
      
      {
    •    if (strcasecmp(temp, host->h_name))
      
    •    {
      
    • cupsdSetString(&ServerName, host->h_name);
      
    • add_alias(host->h_name);
      
    • }
    • cupsdSetString(&ServerName, host->h_name);
    • add_alias(host->h_name);
    •  }
      
    •    if (host->h_aliases)
      
    • {
    •      for (i = 0; host->h_aliases[i]; i ++)
      
    •   if (strcasecmp(temp, host->h_aliases[i]))
      
    •     add_alias(host->h_aliases[i]);
      
    • }
    •  if (host->h_aliases)
      
    •  {
      
    • for (i = 0; host->h_aliases[i]; i ++)
    • if (strcasecmp(ServerName, host->h_aliases[i]))
      
    •   add_alias(host->h_aliases[i]);
      
      }
      }
    • }
    • /*
    • * Make sure we have the base hostname added as an alias, too!
    • */
    • /*
    • * Make sure we have the base hostname added as an alias, too!
    • */
    • if ((slash = strchr(temp, '.')) != NULL)
    • {
    •  *slash = '\0';
      
    •  add_alias(temp);
      
    • }
    • if ((slash = strchr(ServerName, '.')) != NULL)
    • {
    • size_t n = slash - ServerName;
    • if (n > sizeof(temp) - 1)
    •  n = sizeof(temp) - 1;
      
    • memcpy (temp, ServerName, n);
    • temp[n] = '\0';
    • add_alias(temp);
      }

    for (slash = ServerName; isdigit(*slash & 255) || *slash == '.'; slash ++);

  3. michaelrsweet commented on Apr 29, 2009

    @michaelrsweet
    ContributorAuthor

    "str3167.patch":

    Index: scheduler/conf.c

    --- scheduler/conf.c (revision 8571)
    +++ scheduler/conf.c (working copy)
    @@ -716,8 +716,15 @@

    • See if the ServerName is an IP address...
      */
    • if (!ServerName)
    • if (ServerName)
      {
    • if (!ServerAlias)
    •  ServerAlias = cupsArrayNew(NULL, NULL);
      
    • cupsdLogMessage(CUPSD_LOG_DEBUG, "Added auto ServerAlias %s", ServerName);
    • }
    • else
    • {
      if (gethostname(temp, sizeof(temp)))
      {
      cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to get hostname: %s",
  4. added this to the Stable milestone on Mar 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions