read stderr with AuthorizationExecuteWithPrivileges

  • -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Hi Everybody,

    I'm desperately trying to find a way to read the stderr output when
    using the function AuthorizationExecuteWithPrivileges(). I'm, as far
    as I can tell, obliged to use this function as I want to build  GUI
    front end to ipfw. ipfw needs to be run with administrator privileges
    that's why I can't use an NSTask.

    During the insertion rule process ipfw provide a convient check method
    by prefixing your add command with -n. If the rule is not well formed
    you get a description of the error in the stderr. It would be highly
    desirable for my front end to be able to capture this output and to
    display it such that the user knows why his rule wasn't accepted.

    I read a lot about Authorization on the list (from the very old
    BLAuthentication to the Apple code sample "BetterAuthorizationSample")
    but didn't find any satisfying method. The only example that I found
    (but unfortunately truncated to the half) seemed to write the stderr
    to a file and then read from that file.

    If someone does have any idea on how to read the stderr, I would be
    more than happy to hear it.

    CU Jerome
    - - --
    Paschoud Jerome
    Ingénieur Informaticien (ing. info. dipl. EPFL)
    http://www.spikesoft.ch
    PGP key: http://www.spikesoft.ch/jpaschoud/JeromePaschoud.asc
    PGP fingerprint: 9193 403D D9C1 0512 4ECC  AE9C 81F3 4F2A 0A15 F629

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.7 (Darwin)

    iD8DBQFHgpavgfNPKgoV9ikRAjigAJ43bI6rCHiot8GtkGIPvIM6hbynbACeMGPz
    xZ4BIjmCzdFKIP4F2bMtIDs=
    =OleO
    -----END PGP SIGNATURE-----
  • On 7 Jan 2008, at 21:16, Jérôme Paschoud wrote:

    > I'm desperately trying to find a way to read the stderr output when
    > using the function AuthorizationExecuteWithPrivileges().

    This is not a Cocoa question, so you won't get a good answer here.

    All I'll say is that it sounds like you're trying to misuse
    AuthorizationExecuteWithPrivileges().  It isn't supposed to be used as
    a generic process-launching function; it's specifically intended for
    use with *your own* helper tool (which is where you should be
    processing the standard error output if that's what you need).

    Kind regards,

    Alastair.

    --
    http://alastairs-place.net
previous month january 2008 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today