Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printer operation policies not loaded correctly on start/restart. #2319

Closed
michaelrsweet opened this issue Apr 1, 2007 · 5 comments
Closed
Milestone

Comments

@michaelrsweet
Copy link
Collaborator

Version: 1.2-current
CUPS.org User: jreich

Printer operation policies set with lpadmin or the web interface are handled correctly. But after restarting the CUPS daemon the policies are not recognized any more, although they are set in printers.conf.
The problem seems to be in scheduler/printers.c: The pointer to the policy structure is not set in cupsdLoadAllPrinters().
The attachement contains a patch against 1.2.10. I simply copied the code from cupsdUpdatePrinters().
There is also a bug report to debian-printing: Someone reports the same problem with the same solution (the patch is against 1.2.7). You can find the bug report under http://lists.debian.org/debian-printing/2007/02/msg00038.html

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: jreich

I've just noticed that the bug also applies to classes: In cupsdLoadAllClasses() in file scheduler/classes.c the same problem seems to exist.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Confirmed...

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in Subversion repository.

@michaelrsweet
Copy link
Collaborator Author

"cups-printer-op-policies.patch":

--- cups-1.2.10/scheduler/printers.c 2007-02-27 16:46:10.000000000 +0100
+++ cups-1.2.10-printer-op-policies/scheduler/printers.c 2007-03-30 18:38:26.000000000 +0200
@@ -1186,8 +1186,16 @@ cupsdLoadAllPrinters(void)
}
else if (!strcasecmp(line, "OpPolicy"))
{

  •  if (value)
    
  •  if (value) {
     cupsdSetString(&p->op_policy, value);
    
  •    /*
    
  •     \* Update the operation policy pointer...
    
  •     */
    
  •    if ((p->op_policy_ptr = cupsdFindPolicy(p->op_policy)) == NULL)
    
  •      p->op_policy_ptr = DefaultPolicyPtr;
    
  •  }
    
    else
    {
    cupsdLogMessage(CUPSD_LOG_ERROR,

@michaelrsweet
Copy link
Collaborator Author

"str2319.patch":

Index: printers.c

--- printers.c (revision 6422)
+++ printers.c (working copy)
@@ -1194,7 +1194,20 @@
else if (!strcasecmp(line, "OpPolicy"))
{
if (value)

  •    cupsdSetString(&p->op_policy, value);
    
  •  {
    
  •    cupsd_policy_t _pol;       /_ Policy */
    
  •    if ((pol = cupsdFindPolicy(value)) != NULL)
    
  • {
  •      cupsdSetString(&p->op_policy, value);
    
  • p->op_policy_ptr = pol;
    
  • }
  • else
  • cupsdLogMessage(CUPSD_LOG_ERROR,
    
  •                 "Bad policy \"%s\" on line %d of printers.conf",
    
  •         value, linenum);
    
  •  }
    

    else
    {
    cupsdLogMessage(CUPSD_LOG_ERROR,
    Index: classes.c

    --- classes.c (revision 6422)
    +++ classes.c (working copy)
    @@ -682,7 +682,20 @@
    else if (!strcasecmp(line, "OpPolicy"))
    {
    if (value)
  •    cupsdSetString(&p->op_policy, value);
    
  •  {
    
  •    cupsd_policy_t _pol;       /_ Policy */
    
  •    if ((pol = cupsdFindPolicy(value)) != NULL)
    
  • {
  •      cupsdSetString(&p->op_policy, value);
    
  • p->op_policy_ptr = pol;
    
  • }
  • else
  • cupsdLogMessage(CUPSD_LOG_ERROR,
    
  •                 "Bad policy \"%s\" on line %d of classes.conf",
    
  •         value, linenum);
    
  •  }
    
    else
    {
    cupsdLogMessage(CUPSD_LOG_ERROR,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant