Professional Web Applications Themes

Authorization Services - Mac Programming

I've written a small program for our computer labs on campus and I need to allow it to delete a directory in the /volumes directory if it is present. Since this program is running as the user, it does not have the rigths to do this. I have the admin account and password so, can I get authorization from within the program w/o prompting the user? I'm reading through the auth services docs right now, but it appears there is no way to do that. Is this possible or should I just setiud the program to root and have it ...

  1. #1

    Default Authorization Services

    I've written a small program for our computer labs on campus and I need
    to allow it to delete a directory in the /volumes directory if it is
    present. Since this program is running as the user, it does not have the
    rigths to do this. I have the admin account and password so, can I get
    authorization from within the program w/o prompting the user?
    I'm reading through the auth services docs right now, but it appears
    there is no way to do that. Is this possible or should I just setiud the
    program to root and have it run like that?
    Lorenzo Guest

  2. #2

    Default Re: Authorization Services

    In article <thethurmans.com>,
    Lorenzo Thurman <com> wrote:
     

    What are you really trying to do? Eject a removable volume?
    David Guest

  3. #3

    Default Re: Authorization Services

    David Phillip Oster wrote:
     


    Exactly, although I'm not sure why, sometimes the directory is not removed
    although the volume has been unmounted (directory is empty
    anyway).Subsequent to attempts to mount that volume end up with a volume
    name appended with a number, like /volumes/share-1. My program fails if
    that happens. I was hoping I ccould get auth to remove it if it existed.
    --
    "My Break-Dancing days are over, but there's always the Funky Chicken"
    --The Full Monty
    Lorenzo Guest

  4. #4

    Default Re: Authorization Services

    In article <internal.thethurmans.com>,
    Lorenzo Thurman <com> wrote:
     
    >
    >
    > Exactly, although I'm not sure why, sometimes the directory is not removed
    > although the volume has been unmounted (directory is empty
    > anyway).Subsequent to attempts to mount that volume end up with a volume
    > name appended with a number, like /volumes/share-1. My program fails if
    > that happens. I was hoping I ccould get auth to remove it if it existed.[/ref]

    Have you considered sending an appleEvent to the Finder asking it to
    remove the Volume?
    David Guest

  5. #5

    Default Re: Authorization Services

    On Thu, 15 Jul 2004, Lorenzo Thurman wrote:
     
    >
    >
    > Exactly, although I'm not sure why, sometimes the directory is not removed
    > although the volume has been unmounted (directory is empty
    > anyway).Subsequent to attempts to mount that volume end up with a volume
    > name appended with a number, like /volumes/share-1. My program fails if
    > that happens. I was hoping I ccould get auth to remove it if it existed.[/ref]

    IMO, you are taking the wrong approach. Instead of trying to clean up
    after the system, you should instead write your code to query the system
    for the path of the newly-mounted volume instead of constructing it
    yourself. That will fix this problem, as well as a host of other potential
    problems.
    Michael Guest

  6. #6

    Default Re: Authorization Services

    In article <internal.thethurmans.com>,
    Lorenzo Thurman <com> wrote:
     

    I have seen this behaviour too. I think its an OS bug. Just thought
    I'd mention that.
    Sean Guest

  7. #7

    Default Re: Authorization Services

    David Phillip Oster wrote:
     
    No, I hadn't. But that will execute under the users privileges, correct?
    Then that should also fail, right.
    --
    "My Break-Dancing days are over, but there's always the Funky Chicken"
    --The Full Monty
    Lorenzo Guest

  8. #8

    Default Re: Authorization Services

    In article <internal.thethurmans.com>,
    Lorenzo Thurman <com> wrote:
     

    Your program must not fail when that happens. It's reasonable of the user to get
    into the same situation in a number of other ways. You have no way of preventing
    it, and you shouldn't try to. Fix your program.

    meeroh

    --
    If this message helped you, consider buying an item
    from my wish list: <http://web.meeroh.org/wishlist>

    Miro Guest

  9. #9

    Default Re: Authorization Services

    Michael Ash wrote:
     
    I did consider that and its easy enough, but only solves half the problem.
    If the volume is not completely unmounted and removed, another directory
    will appear with another number appended at the end. What I'm also trying
    to avoid is having the volumes directory flll up
    with /volumes/share-1, /volumes/share-2, etc. I'm not sure what the file
    system limit to this is, and how often the unmount does not complete, but
    considering how many users log into our computers, it could add up quite
    quickly. These directories do not get removed after a restart,
    --
    "My Break-Dancing days are over, but there's always the Funky Chicken"
    --The Full Monty
    Lorenzo Guest

  10. #10

    Default Re: Authorization Services

    Sean McBride wrote:
     
    I thought so, but this should be easy enough to work around.
    --
    "My Break-Dancing days are over, but there's always the Funky Chicken"
    --The Full Monty
    Lorenzo Guest

  11. #11

    Default Re: Authorization Services

    In article <mit.edu>,
    Miro Jurisic <org> wrote:
     

    I intend to do that, but that's only half the problem as I mentioned
    earlier. But I think there's actually a simpler fix and I'm surprised no
    one has yet offered it:
    I'm using FSMountServerVolumeSync which takes as one of its parameters a
    path which it will use as the mount directory. It has to exist when you
    make the call. I can just check to see if its there, use it if it is, if
    not let the system make it for me. Have not tried it yet, but we'll see
    what happens.
    Thanks everyone

    --
    "My Break-Dancing days are over, but there's always the
    Funky Chicken"
    --The Full Monty
    Lorenzo Guest

  12. #12

    Default Re: Authorization Services

    On Thu, 15 Jul 2004, Lorenzo Thurman wrote:
     
    > I did consider that and its easy enough, but only solves half the problem.
    > If the volume is not completely unmounted and removed, another directory
    > will appear with another number appended at the end. What I'm also trying
    > to avoid is having the volumes directory flll up
    > with /volumes/share-1, /volumes/share-2, etc. I'm not sure what the file
    > system limit to this is, and how often the unmount does not complete, but
    > considering how many users log into our computers, it could add up quite
    > quickly. These directories do not get removed after a restart,[/ref]

    I see. However, you should make this change anyway; there is no guarantee
    that the volume will be mounted at the path you expect regardless. Relying
    on the volume to be mounted at /Volumes/volumename is relying on an
    implementation detail that could change at any time. Given your
    description, I can see how you also need to delete the original directory
    (*if* it isn't mapped to another drive!) so I think you should do both. :)
    Michael Guest

  13. #13

    Default Re: Authorization Services

    In article <aei.ca>,
    Sean McBride <org> wrote:
     

    Well, our Systems Programming tutor called it an optimization of Unix:

    It doesn't delete the directory right away, because it really doesn't
    take that much disk space and it will be a little faster if it doesn't
    have to recreate it if the same disk is ejected and re-inserted
    repeatedly.

    Well, okay, we were actually talking about devices in Linux, but you
    get the idea.

    OTOH, the OS isn't re-using the folder, so it probably *is* a bug.

    Cheers,
    -- Uli
    http://www.zathras.de
    Uli Guest

Similar Threads

  1. how to use <authorization>
    By Julia in forum ASP.NET Security
    Replies: 2
    Last Post: November 21st, 12:18 PM
  2. Replies: 4
    Last Post: March 31st, 10:13 PM
  3. URL Authorization
    By Leonard Rutkowski in forum ASP.NET Security
    Replies: 6
    Last Post: January 13th, 06:59 PM
  4. ASP.NET Authorization
    By popman in forum ASP.NET Security
    Replies: 2
    Last Post: May 21st, 08:44 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139