This answer uses the Private Framework. As naixn notes in the comments, this means that it can break even when the point is released.
There is no way to do this using only the open API (which I can find after hours of searching / disassembling).
URL- - . , , ..
, Finder, , NetAuthApp CoreServices. (netfs_MountURLWithAuthenticationSync) (FSMountServerVolumeSync). kSuppressAllUI.
rc 0, NSStrings .
include <inttypes.h>
#include <Foundation/Foundation.h>
const uint32_t kSoftMount = 0x10000;
const uint32_t kSuppressAllUI = 0x00100;
int main(int argc, char** argv)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSURL *volumeURL = [NSURL URLWithString:@"afp://server/path"];
NSArray* mountpoints = nil;
const uint32_t flags = kSuppressAllUI | kSoftMount;
const int rc = netfs_MountURLWithAuthenticationSync((CFURLRef)volumeURL, NULL, NULL,
NULL, flags, (CFArrayRef)&mountpoints);
NSLog(@"mountpoints: %@; status = 0x%x", mountpoints, rc);
[pool release];
}