/[pdpsoft]/trunk/grid-mw-security/cgul/realpath/realpath.h
ViewVC logotype

Contents of /trunk/grid-mw-security/cgul/realpath/realpath.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1884 - (show annotations) (download) (as text)
Thu Aug 19 12:55:54 2010 UTC (11 years, 9 months ago) by msalle
Original Path: trunk/grid-mw-security/cgul/realpath/cgul_realpath.h
File MIME type: text/x-csrc
File size: 2069 byte(s)
Adding a substitute for the unsafe realpath() or unportable
canonicalize_file_name().
Note that it is NOT thread safe due to the chdir trick...


1 /**
2 * Copyright (c) Members of the EGEE Collaboration. 2010.
3 * See http://www.eu-egee.org/partners/ for details on the copyright
4 * holders.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 * Authors: Oscar Koeroo, Mischa Sall\'e, Aram Verstegen
19 * NIKHEF Amsterdam, the Netherlands
20 * <grid-mw-security@nikhef.nl>
21 */
22
23 /*!
24 * Returns the fully canonicalized and absolute path for a diretory or NULL on
25 * error. Memory for the return string is malloced and should be freed by the
26 * caller. Any path cannot be longer than PATH_MAX. Note that it is necessary
27 * that we can chdir to dir.
28 * NOTE: This function is not thread-safe
29 * \param dir non-absolute and/or non-canonical directory
30 * \return canonical absolute directory
31 */
32 char *cgul_realdir(const char *dir);
33
34 /*!
35 * Returns the fully canonicalized and absolute path for any path or NULL on
36 * error. Note that this function substitutes the unsafe realpath() or the
37 * GNU-only canonicalize_file_name().
38 * Memory for the return string is malloced and should be freed by the
39 * caller. Any path cannot be longer than PATH_MAX. Any directory has to be
40 * accessible, including if it's the last element.
41 * NOTE: This function is not thread-safe
42 * \param inpath non-absolute and/or non-canonical path
43 * \param instat optional stat information on the input (for performance, if
44 * already available). When NULL it will be determined locally
45 * when needed.
46 * \return canonical absolute path
47 */
48 char *cgul_realpath(const char *inpath, struct stat *instat)

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28