You do not say whether you use ObjC or Java. If ObjC, it is quite simple: use the standard C or POSIX means of starting external programs.Originally posted by rharder
I've not found any examples of how to call a command-line utility (ipfw in my case) from a Cocoa app, and all the applications I've seen where people do that are Shareware not open source, so they don't help me.
I'd sure appreciate a few url's or examples if anyone has some.
-Rob
The C way would be
system( "your command line comes here" );
man 3 system to get more info about system C standard library API.
The POSIX API is safer and has less overhead: check fork(2) and execve(2) family of syscalls.
Since you need superuser privileges to load ipfw rules, a suid root command line wrapper called by your Cocoa app might be better because the Cocoa part then does not need the superuser privileges (and superuser privileges should be restricted to programs with as little complexity as possible, in order to avoid security issues)
Happy hacking!




LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks