/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Change the label of a file
*/
#include <ctype.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <errno.h>
#include "labeld.h"
#include <zone.h>
#include <string.h>
static int abspath(char *, const char *, char *);
/*
* setflabel(3TSOL) - set file label
*
* This is the library interface to the door call.
*/
/*
*
* Exit error = If error reported, the error indicator,
* -1, Unable to access label encodings file;
* 0, Invalid binary label passed;
* >0, Position after the first character in
* string of error, 1 indicates entire string.
* Otherwise, unchanged.
*
* Returns 0, If error.
* 1, If successful.
*
* Calls __call_labeld(SETFLABEL)
*
*/
int
{
/*
* If path is relative and we haven't already determined the current
* working directory, do so now. Calculating the working directory
* here lets us do the work once, instead of (potentially) repeatedly
* in realpath().
*/
cwd[0] = '\0';
return (-1);
}
}
/*
* Find an absolute pathname in the native file system name space that
* corresponds to path, stuffing it into canon.
*/
return (-1);
return (-1);
}
}
/* free allocated buffer */
}
/*
* reterr == 0, OK,
* reterr < 0, invalid binary label,
*/
if (err == 0) {
return (-1);
} else {
return (0);
}
} else if (err < 0) {
err = 0;
}
return (-1);
} else {
/* free allocated buffer */
}
/* server not present */
return (-1);
}
} /* setflabel */
/*
*
* Exit status = result of zone copy request
* -1, Copy not confirmed
* Otherwise, unchanged.
*
* Returns 0, If error.
* 1, If successful.
*
* Calls __call_labeld(ZCOPY)
*
*/
int
char *local_dir, int transfer_mode)
{
char *display;
display = "";
return (NULL);
}
}
strings = 0;
strings += filename_len;
strings += local_dir_len;
/* free allocated buffer */
}
/*
* reterr == 0, OK,
* reterr < 0, transer not confirmed
*/
if (err == 0) {
} else if (err < 0) {
err = 0;
}
return (PIPEMSG_CANCEL);
} else {
/* free allocated buffer */
}
/* server not present */
return (PIPEMSG_CANCEL);
}
}
/*
* Convert the path given in raw to canonical, absolute, symlink-free
* form, storing the result in the buffer named by canon, which must be
* at least MAXPATHLEN bytes long. If wd is non-NULL, assume that it
* points to a path for the current working directory and use it instead
* of invoking getcwd; accepting this value as an argument lets our caller
* cache the value, so that realpath (called from this routine) doesn't have
* to recalculate it each time it's given a relative pathname.
*
* Return 0 on success, -1 on failure.
*/
int
{
/*
* Preliminary sanity check.
*/
return (-1);
/*
* If the path is relative, convert it to absolute form,
* using wd if it's been supplied.
*/
if (raw[0] != '/') {
char *d;
/* Fill in working directory. */
return (-1);
/* Add separating slash. */
if (d < limit)
*d++ = '/';
/* Glue on the relative part of the path. */
continue;
}
/*
* Call realpath to canonicalize and resolve symlinks.
*/
}