bind-helper.c revision b819cea2f73f98c5662230cc9affc8cc84f77fcf
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
*/
/*
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
*/
/*
* This program is installed with an RBAC exec_attr
* that allows it to bind a reserved address.
* (Or just make it setuid root.)
*
* To grant privileges to the program using RBAC,
* Forced Privilege:solaris:cmd:::\
* /usr/lib/smbsrv/bind-helper:\
* privs=net_privaddr,sys_smb\
*
* Args: family address port
* Does a bind on fileno(stdin)
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
int
{
/* LINTED E_BAD_PTR_CAST_ALIGN */
/* LINTED E_BAD_PTR_CAST_ALIGN */
if (argc < 4) {
argv[0]);
exit(1);
}
case AF_INET:
break;
case AF_INET6:
break;
default:
rc = 0;
break;
}
if (rc > 0)
err = 0;
else if (rc == 0)
else if (rc < 0)
if (err != 0) {
exit(1);
}
exit(2);
}
exit(0);
}