[cups.development] Handle authentication

Michael Sweet msweet at apple.com
Thu Feb 4 16:03:44 PST 2010


On Feb 4, 2010, at 10:57 AM, Daniel Nicoletti wrote:
> Hi,
> I'm writing a GUI for cups (KDE4),
> I used the cups API to get dests and jobs,
> and my queue is working nicely, but
> there is one thing that is not working well
> it's authentication.
> Even if i set the callback funcion if I try
> to remove a job from another user or pause the
> printer i get FORBIDEN 403, and the callback
> function is not called.
> I niticed that if I run this app and setUser("root")
> it calls the callback and I can authenticate as root,
> but this seems to be wrong since the prompt message
> shows "password for root?", in linux this is not actually
> a problem since root is root, but if my client.conf
> points to a mac machine it's "Mac Admin" iirc.
> 
> To resume, what is the right way to do this?


OK, so currently the best way is to try with the current username and then if that fails with a forbidden error try with user "root" which works on Mac OS X as well - any user in the system group ("admin" on Mac OS X, other groups on Linux) will be able to authenticate.

UI-wise I'd just not fill-in the username and use your own prompt string with your password dialog. The callback can set the current username as needed...

___________________________________________________
Michael Sweet, Senior Printing System Engineer







More information about the cups mailing list