warmstart.c revision 8f6d9dae92449b59bdafcb7777bc32f1b2726e48
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Allows for gathering of registrations from a earlier dumped file.
*
* Copyright 1990,2002-2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
*/
#include <stdio.h>
#include <errno.h>
#include <rpc/rpcb_prot.h>
#ifdef PORTMAP
#include <rpc/pmap_prot.h>
#endif
#include "rpcbind.h"
#include <syslog.h>
#include <unistd.h>
#include <rpcsvc/daemon_utils.h>
#include <assert.h>
/* These files keep the pmap_list and rpcb_list in XDR format */
#ifdef PORTMAP
#endif
static FILE *
open_tmp_file(const char *filename)
{
int fd;
/*
* Remove any existing files, and create a new one.
* Ensure that rpcbind is not forced to overwrite
* a file pointed to by a symbolic link created
* by an attacker.
* Use open O_CREAT|O_EXCL so file is not created
* between unlink() and open() operation.
*/
return (NULL);
}
if (fd == -1)
return (NULL);
return (NULL);
}
return (fp);
}
static bool_t
{
int i;
for (i = 0; i < 10; i++)
close(i);
"cannot open file = %s for writing", filename);
return (FALSE);
}
}
XDR_DESTROY(&xdrs);
return (FALSE);
}
XDR_DESTROY(&xdrs);
return (TRUE);
}
static bool_t
{
int fd;
if (fd == -1) {
"rpcbind: cannot open file = %s for reading\n", filename);
goto error;
}
"rpcbind: cannot open file = %s for reading\n", filename);
goto error;
}
"rpcbind: cannot stat file = %s for reading\n", filename);
goto error;
}
"reading\n", filename);
goto error;
}
/*
* Make sure that the pathname for fstat and lstat is the same and
* that it's not a link. An attacker can create symbolic or
* hard links and use them to gain unauthorised access to the
* system when rpcbind aborts or terminates on SIGINT or SIGTERM.
*/
"rpcbind: cannot lstat file = %s for reading\n", filename);
goto error;
}
"%s for reading\n", filename);
goto error;
}
XDR_DESTROY(&xdrs);
goto error;
}
XDR_DESTROY(&xdrs);
return (TRUE);
return (FALSE);
}
void
write_warmstart(void)
{
#ifdef PORTMAP
#endif
}
void
read_warmstart(void)
{
#ifdef PORTMAP
#endif
return;
#ifdef PORTMAP
return;
}
#endif
#ifdef PORTMAP
#endif
}