cups icon indicating copy to clipboard operation
cups copied to clipboard

adminutil.c: Recognize other policy scopes than default

Open zdohnal opened this issue 1 month ago • 2 comments

The function cupsAdminGetServerSettings() did not take different policies as policy, which resulted into adding their contents into output array settings.

If the caller uses the same array for cupsAdminSetServerSettings(), there is possibility to add such directives at the end of configuration file if a different tool removes those directives from the original file.

Possibly reason for dangling JobPrivate*, SubscriptionPrivate* directives outside of policy scope...

zdohnal avatar Dec 03 '25 15:12 zdohnal

Nice catch, this does indeed look like it is what is causing the directives to be added at the end of the config file.

mdeslaur avatar Dec 03 '25 18:12 mdeslaur

@michaelrsweet @mdeslaur thanks!

Additionally (related to reason for #1443) we should fix that we get and set only the correct directives in correct places, otherwise we might share unknown broken directives via those functions.

I would make a list of cupsd directives which can be outside of Location and Policy scopes, and only those directives will be saved/set in cupsAdmin{Get,Set}ServerSettings functions.

zdohnal avatar Dec 04 '25 07:12 zdohnal