smb_autohome.c revision 89dc44ce9705974a8bc4a39f1e878a0491a5be61
1N/A * The contents of this file are subject to the terms of the 1N/A * Common Development and Distribution License (the "License"). 1N/A * You may not use this file except in compliance with the License. 1N/A * See the License for the specific language governing permissions 1N/A * and limitations under the License. 1N/A * When distributing Covered Code, include this CDDL HEADER in each 1N/A * If applicable, add the following below this CDDL HEADER, with the 1N/A * fields enclosed by brackets "[]" replaced with your own identifying 1N/A * information: Portions Copyright [yyyy] [name of copyright owner] 1N/A * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 1N/A * Use is subject to license terms. 1N/A * Add an autohome share. See smb_autohome(4) for details. 1N/A * If share directory contains backslash path separators, they will 1N/A * be converted to forward slash to support NT/DOS path style for 1N/A * A static share with this name already exists 1N/A * autohome shares will be added for each login attempt 1N/A * Remove an autohome share. 1N/A * Search the autohome database for the specified name. The name cannot 1N/A * be an empty string or begin with * or +. 1N/A * 1. Search the file for the specified name. 1N/A * 2. Check for the wildcard rule and, if present, treat it as a match. 1N/A * 3. Check for the nsswitch rule and, if present, lookup the name 1N/A * via the name services. Note that the nsswitch rule will never 1N/A * be applied if the wildcard rule is present. 1N/A * Returns a pointer to the entry on success or null on failure. * Open or rewind the autohome database. * Close the autohome database and invalidate the autohome info. * We can't zero the whole info structure because the application * should still have access to the data after the file is closed. * Return the next entry in the autohome database, opening the file * if necessary. Returns null on EOF or error. * Note that we are not looking for the specified name. The name is * only used for key substitution, so that the caller sees the entry * Find the next non-comment, non-empty line. * Anything after a # is a comment and can be discarded. * Discard a newline to avoid it being included in the parsing * Leading and training whitespace is discarded, and replicated * whitespace is compressed to simplify the token parsing, * although strsep() deals with that better than strtok(). * Set up an autohome entry from the line buffer. The line should just * contain tokens separated by single whitespace. The line format is: * <username> <home-dir-path> <ADS container> }
while (*(
si->
argv[i]) ==
'\0');
* Sanity check: the name could be an empty * string but it can't be a null pointer. * Substitute the ? and & map keys. * ? is replaced by the first character of the name * & is replaced by the whole name. * Substitution characters are not allowed in the key. * Get a pointer to the context buffer and validate it. * Parse the options string, which contains a comma separated list of * name-value pairs. One of the options may be an AD container, which * is also a comma separated list of name-value pairs. For example, * dn=ad,dn=sun,dn=com,ou=users * All options other than the AD container will be extracted from * shr_container and used to set share properties. * On return, shr_container will contain the AD container string. }
while (*
value ==
'\0');