ui-sun.c revision 4bff34e37def8a90f9194d81bc345c52ba20086a
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * Copyright (c) 2001 Apple Computer, Inc. All rights reserved.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * @APPLE_LICENSE_HEADER_START@
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * Reserved. This file contains Original Code and/or Modifications of
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * Original Code as defined in and that are subject to the Apple Public
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * Source License Version 1.0 (the 'License'). You may not use this file
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * except in compliance with the License. Please obtain a copy of the
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * License at http://www.apple.com/publicsource and read it before using
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * this file.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * The Original Code and all software distributed under the License are
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * License for the specific language governing rights and limitations
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * under the License."
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * @APPLE_LICENSE_HEADER_END@
4bff34e37def8a90f9194d81bc345c52ba20086athurlow#pragma ident "%Z%%M% %I% %E% SMI"
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * Routines for interacting with the user to get credentials
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * (workgroup/domain, username, password, etc.)
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /* If input empty, accept default. */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /* Use input as new value. */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow if (ctx->ct_flags & SMBCF_KCFOUND || ctx->ct_flags & SMBCF_KCBAD) {
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * 1st: try lookup using system name
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * Need passwd to be not empty for existing logic.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * The string here is arbitrary (a debugging hint)
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * and will be replaced in the driver by the real
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * password from the keychain.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow " server/user: %s/%s\n",
4bff34e37def8a90f9194d81bc345c52ba20086athurlow return (0);
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * 2nd: try lookup using domain name
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /* Need passwd to be not empty... (see above) */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow " domain/user: %s/%s\n",
4bff34e37def8a90f9194d81bc345c52ba20086athurlow return (0);
4bff34e37def8a90f9194d81bc345c52ba20086athurlow if (isatty(STDIN_FILENO)) { /* need command-line prompting? */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow npw = getpassphrase(dgettext(TEXT_DOMAIN, "Password:"));
4bff34e37def8a90f9194d81bc345c52ba20086athurlow return (0);
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * XXX: Ask the user for help, possibly via
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * GNOME dbus or some such... (todo).
4bff34e37def8a90f9194d81bc345c52ba20086athurlow "Cannot prompt for a password when input is redirected."), 0);
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * Let user pick a share.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * Not supported.