muddleftpd-1.3.13.1/0040755000175000017500000000000007751444710013101 5ustar joergjoergmuddleftpd-1.3.13.1/doc/0040755000175000017500000000000007751444665013657 5ustar joergjoergmuddleftpd-1.3.13.1/doc/info/0040755000175000017500000000000007751444665014612 5ustar joergjoergmuddleftpd-1.3.13.1/doc/info/muddleftpd.info0100644000175000017500000007544307646754463017634 0ustar joergjoergThis is info/muddleftpd.info, produced by makeinfo version 4.2 from info/muddleftpd.texi. INFO-DIR-SECTION Internet This file documents MUDDLEFTPD, a file transfer protocol server. Copyright (C) 1999 Jonas Öberg and Beau Kuiper Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.  File: muddleftpd.info, Node: Top, Next: Introduction, Prev: (dir), Up: (dir) This file documents the MUDDLEFTPD program, a server for the Internet File Transfer Protocol. This is edition 1.1 for Muddleftpd version 1.1. * Menu: * Introduction:: Introduction * Invocation:: How to invoke muddleftpd * Site Configuration:: How to configure the program * Troubleshooting:: Troubleshooting the server * FTP Commands:: FTP Commands implemented in the server * Magic Cookies:: Magic Cookies used in values and files * Reporting Bugs:: Reporting bugs * Directive Index:: Index of configuration file directives  File: muddleftpd.info, Node: Introduction, Next: Invocation, Prev: Top, Up: Top Introduction ************ MUDDLEFTPD is a server for the Internet File Transfer Protocol. Normal FTP servers tend to always want to run with root privileges on the server host. MUDDLEFTPD is designed to overcome this obstacle without limiting the available features when running without root privileges. This manual describes version 1.1 of the program.  File: muddleftpd.info, Node: Invocation, Next: Site Configuration, Prev: Introduction, Up: Top Invocation ********** Neither the server program, MUDDLEFTPD, or the special information program, FTPWHO takes any special arguments except the name of the configuration file to use. If no configuration file is specified on the command line, both programs will try to open the default configuration file.  File: muddleftpd.info, Node: Site Configuration, Next: Troubleshooting, Prev: Invocation, Up: Top Site Configuration ****************** MUDDLEFTPD uses two different configuration files. The main configuration file and the user configuration files. They both use a simple format where lines consist of two items separated by space (key and value). There can only be one pair of key and value on each line. Comments start with the `#' character and continue until the end of the line. Values can include spaces by escaping them with the `\' character as is shown in the example below. # The \ allows space to be recognized as part of the value access /etc/name\ spaced * Menu: * Main config:: Main configuration file * User config:: User configuration files  File: muddleftpd.info, Node: Main config, Next: User config, Up: Site Configuration Main config *********** The main config file is read when muddleftpd is first started. It contains information that applies to the entire program. Some options can be declared several times in the configuration file to add more values. * Menu: * ftpport:: Specify a port to bind to * maxusers:: Maximum user count * logstrength:: The messages to send to main log * runasuid:: The uid to run as * runasgid:: The gid to run as * logfile:: The name of the log file * accessdir:: Directory for user configuration files * timeout:: Default timeout value * addhost:: Allow access to a range of IP numbers * logindump:: File that gets printed when a user connects * pidfile:: File that will store muddleftpds pid number * email:: Email address of the ftp archive maintainer  File: muddleftpd.info, Node: ftpport, Next: maxusers, Up: Main config ftpport ******* * Accepted value: (port)/(ip) | (port) * Default: none `ftpport' tells the server that it should try to listen on `port' for connections. You may specify this directive more than once to listen on more than on port. For each `ftpport' directive, you may also specify the IP number of the interface on which MUDDLEFTPD should accept connections. MUDDLEFTPD will refuse to start if you don't specify atleast one `ftpport' directive. Examples: ftpport 21 #listen to port 21 for connections ftpport 121/127.0.0.1 #listen to port 121 only on the loopback #device ftpport 4990/10.1.1.1 #listen to port 4990 only on the ethernet #device with IP 10.1.1.1  File: muddleftpd.info, Node: maxusers, Next: logstrength, Prev: ftpport, Up: Main config maxusers ******** * Accepted value: (maximum user count) * Default: 30 `maxusers' tells the server the maximum number of users that MUDDLEFTPD will allow to connect at any one time. When the maximum number of users have been reached, all subsequent connections will be silently dropped to prevent resource wastage. If you are setting up an anonymous FTP server, you should have maxusers higher that anonymous's maxusers. This way, a full FTP server doesn't rudely drop connections.  File: muddleftpd.info, Node: logstrength, Next: runasuid, Prev: maxusers, Up: Main config logstrength *********** * Accepted value: (logvalue) * Default: 1 `logstrength' tells the server what information to log. The value for this option is the sum of any of the following types: 1 Clients that try to access the server from invalid ip addresses 2 File transfers, uploads and downloads. 4 Commands the user sends to the server. 8 The replies the server sends to the user. 16 General Information logs (server starting and stopping) 32 Login information, including successful and denied logins. Examples: logstrength 63 # log everything logstrength 0 # log nothing logstrength 51 # log everything except user commands # and server replies  File: muddleftpd.info, Node: runasuid, Next: runasgid, Prev: logstrength, Up: Main config runasuid ******** * Accepted value: (uid) * Default: (none) When setting the directive, the server will attempt to change the user id to `uid'. This is usually used to bind to a privileged port number before switching to another user for user access. This may break some pedantic clients or firewalls, but these are few and far between. If you don't specify this directive, then the server will run with whatever permissions it has when it starts. Examples: runasuid 65535 # run as nobody  File: muddleftpd.info, Node: runasgid, Next: logfile, Prev: runasuid, Up: Main config runasgid ******** * Accepted value: (gid) * Default: (none) When setting the directive, the server will attempt to change the user group id to `uid'. This is usually used to bind to a privileged port number before switching to another user for user access. This may break some pedantic clients or firewalls, but these are few and far between. If you don't specify this directive, then the server will run with whatever permissions it has when it starts. Examples: runasgid 65535 # run as the group nogroup  File: muddleftpd.info, Node: logfile, Next: accessdir, Prev: runasgid, Up: Main config logfile ******* * Accepted value: (filename) * Default: `/var/log/muddleftpd.log' This directive tells MUDDLEFTPD where to store its log file. The server will append to the specified file. This file must exist and be writable to the starting user, otherwise MUDDLEFTPD will refuse to start and exit. Examples: logfile /home/rugger/ftpd/ftpd.log # store logs in an alternative # place  File: muddleftpd.info, Node: accessdir, Next: timeout, Prev: logfile, Up: Main config accessdir ********* * Accepted value: (directory) * Default: `/usr/local/etc' `accessdir' tells MUDDLEFTPD where to find the configuration files describing user access to the server. It must be readable to the running user or MUDDLEFTPD will be unable to autenticate any users. Examples: accessdir /etc/muddleftpd # files are stored in /etc/muddleftpd accessdir /home/rugger/ftpd # files are stored in # /home/rugger/ftpd  File: muddleftpd.info, Node: timeout, Next: addhost, Prev: accessdir, Up: Main config timeout ******* * Accepted value: (seconds) * Default: 300 seconds `timeout' gives the default timeout for a user connection. This timeout will apply before the user logs in, and will persist if timeout isn't configured in the user configuration files. Examples: timeout 20 # users must log in within 20 seconds timeout 3600 # 1 hour timeout  File: muddleftpd.info, Node: addhost, Next: logindump, Prev: timeout, Up: Main config addhost ******* * Accepted value: (ip address)/(netmask) * Default: (none) `addhost' tells the server to allow access to a given subnet. By default, MUDDLEFTPD denies access to all hosts. Examples: addhost 192.203.224.0/255.255.255.0 # allow access to all hosts from 192.203.224.X addhost 76.2.0.0/255.255.0.0 # allow access to all hosts from 76.2.X.X addhost 10.2.9.34/255.255.255.255 # allow access to host 10.2.9.34 addhost 0.0.0.0/0.0.0.0 # allow access to everyone  File: muddleftpd.info, Node: logindump, Next: pidfile, Prev: addhost, Up: Main config logindump ********* * Accepted value: (filename) * Default: (none) `logindump' specifies what file will be displayed to the user before the user logs in. All normal magic cookies are available (except %C) for use, although the information in many of them is useless until the user logs in. *Note Magic Cookies::. This can be used to display welcome messages and information to the user before he or she logs in. Examples: logindump /etc/issue # display the issue file logindump /etc/issue.ftp # display this file  File: muddleftpd.info, Node: pidfile, Next: email, Prev: logindump, Up: Main config pidfile ******* * Accepted value: (filename) * Default: `/var/run/muddleftpd.pid' `pidfile' defines the file that you wish to store the pid of the main MUDDLEFTPD process in. It is required to determine if MUDDLEFTPD is already running with a particular config file. If one can not be created, the server will abort and refuse to run. `pidfile' MUST not be in a directory where other users can create links. Examples: pidfile /home/rugger/pids/muddleftpd.pid # store the pid file here  File: muddleftpd.info, Node: email, Prev: pidfile, Up: Main config email ***** * Accepted value: (email address) * Default: `' `email' is where you provide an email address that is stored in the magic cookie %E. *Note Magic Cookies::. You can specify anything you want. Examples: email ekuiperba@cc.curtin.edu.au email I\ don't\ want\ to\ tell\ you! # just a string  File: muddleftpd.info, Node: User config, Prev: Main config, Up: Site Configuration User config *********** The user configuration files define almost everything about a user connection to the ftp server. This includes home directory, root directory, password and file access rights. MUDDLEFTPD will have at least one ofthese files, and will load them in the following order: 1. `user.' 2. `user.default' `user.default' will be loaded if MUDDLEFTPD can not find the first configuration file. Note that if `user.default' doesn't exist, then an error message will be written to the log. You can also create `group.' files that can be used as templates for `user.' files. If you specify a group template file in the `user.' file, then the `group.' file will be loaded AFTER the `user.' file has been parsed. If you specify a directive more than once in a user config file, then the first one will be the one that the server recognizes. User files also use magic cookies to improve configurablity. *Note Magic Cookies::. * Menu: * group:: Specify what group template file to use * password:: Set the user's encrypted password * rootdir:: Set the user's root directory * homedir:: Set the user's home directory * welcome:: Set what file is dumped when the user logs in * access:: Add an entry to the ACL table * umask:: Set the default umask for all created files * unixuser:: Set the username to read magic tokens from * maxconnect:: Set the maximum number of times this user can connect * utimeout:: Set this users timeout * permissions:: Set the uid and/or gid this user will access files as * dumpfiles:: Dump files for various events and actions * chmoding:: Set ability to change umask and file permissions  File: muddleftpd.info, Node: group, Next: password, Up: User config group ***** * Accepted value: (group name) * Default: (none) `group' tells the server to load the file `group.(groupname)' after processing all the directives in the user configuration file. This lets you use templates that multiple user configuration files can use. If this group file doesn't exist, a log entry will be generated. These group files are kept in the same directory as the user config files. Examples: group users # read the file group.users group # use no group file  File: muddleftpd.info, Node: password, Next: rootdir, Prev: group, Up: User config password ******** * Accpted value: (encrypted password) * Default: `%p' `password' specifies the password (in encrypted form) that the user must enter to successfully log on. If you specify `*', the username is disabled. if you specify `', then any password is accepted. Examples: password %p # use the normal password from /etc/passwd password %s # use a shadow password. password # accept any password.  File: muddleftpd.info, Node: rootdir, Next: homedir, Prev: password, Up: User config rootdir ******* * Accepted value: (directory) * Default: `/' `rootdir' specifies the root directory for this user. The user will not be able to access directories above this directory (unless a symbolic link exists to an outside directory, where that directory and its children will be visible). Examples: rootdir %h # use the home directory as the root directory. rootdir /home/ftp # use /home/ftp as the root directory. rootdir / # use / as the root directory.  File: muddleftpd.info, Node: homedir, Next: welcome, Prev: rootdir, Up: User config homedir ******* * Accepted value: (directory) * Default: `%h' `homedir' is the directory the server will place a user in after they have been successfully authenticated. It is relative to `rootdir' (eg if `homedir' is `/cow' and `rootdir' is `/mad', then the login directory will be `/mad/cow'). The user can also use `~' to access their home directory. Examples: homedir %h # set home directory to the passwd home directory homedir / # use / as the home directory.  File: muddleftpd.info, Node: welcome, Next: access, Prev: homedir, Up: User config welcome ******* * Accepted value: (filename) * Default: (none) `welcome' specifies the file that the user will see when he or she logs in. It is an absolute filename (no relation to rootdir). File magic cookies apply to this file. *Note Magic Cookies::. Examples: welcome /etc/ftpwelcome welcome /home/ftp/welcome.txt  File: muddleftpd.info, Node: access, Next: umask, Prev: welcome, Up: User config access ****** * Accepted value: (filename or directory):(keys) * Default: no access. `access' controls the ACL access layer that MUDDLEFTPD places above unix file system permissions. (filename or directory) specify the filename or directory to which these restrictions apply. (keys) specify which access rights to grant to the user in this directory or file. (filename or directory) is relative to rootdir. If a filename is specified, then the access will apply only to that file. If a directory is specified by ending (filename or directory) with a `/', then the access directive will apply to all files and subdirectories of that directory. The default is to give no access. To allow unix permission define access, use access /:ALL in the user configuration file. The following keys are available: R Read file or directory L List files (only meaningful for directories) A Add new files (only meaningful for directories) W Write access. D Delete file access (only meaningful for directories) X Do not override this ACL (if one exists in the group file) ALL All attributes except X NONE No attributes (no access) Examples: access /etc/ftpwelcome:R # give read access to /etc/ftpwelcome access /etc/:R # give read access to all files in /etc/ access /incoming/:A # give add file access to /incoming access /:ALL # give full access to all files, dirs. access /secret/:NONE # don't give access to any files in /secret.  File: muddleftpd.info, Node: umask, Next: unixuser, Prev: access, Up: User config umask ***** * Accepted value: (octal integer) * Default: umask when MUDDLEFTPD was started `umask' specifies what attributes files and directories will be given when they are created. `umask' specifies what bits are not set. Examples: umask 077 # only user bits are set on new file creation umask 666 # all new files are set non-accessible.  File: muddleftpd.info, Node: unixuser, Next: maxconnect, Prev: umask, Up: User config unixuser ******** * Accepted value: (username) * Default: (none) `unixuser' specifies what username to load the magic cookies from. It loads these cookies from the password file (`/etc/passwd') with (username). The only magic cookie available to this directive %U. *Note Magic Cookies::. Examples: unixuser %U # use the entered username as the unix username unixuser ftp # use the user ftp for all the cookies  File: muddleftpd.info, Node: maxconnect, Next: utimeout, Prev: unixuser, Up: User config maxconnect ********** * Accepted value: (count) * Default: (no limit) `maxconnect' controls how many people with the same username can log in at the same time (NOTE: This restribution is per username and not per configuration file). If this value is reached, user trying to connect will be denied access and `busydump' will be returned to the user. Examples: maxconnect 10 maxconnect 150  File: muddleftpd.info, Node: utimeout, Next: permissions, Prev: maxconnect, Up: User config utimeout ******** * Accepted value: (seconds) * Default: the main configuration timeout value This sets the `utimeout' for this specific user. Any sessions will automaticly be disconnected after this period of inactivity. Examples: utimeout 600 # set user timeout to 10 minutes utimeout 7200 # set user timeout to 2 hours.  File: muddleftpd.info, Node: permissions, Next: dumpfiles, Prev: utimeout, Up: User config permissions *********** * Accepted value: (integer) * Default: %u | %g The `uid' and `gid' directives sets the user and group id that all user requests file accesses will be performed as. Note: The server will not accept uid 0 (root) and will automatically change it to -1 (nobody). gid 0 (root or wheel) will be changed to -1 (nogroup). Examples: uid 20 # use user id 20 for all file access. uid %u # use the user id from the password file. gid 20 # use group id 20 for all file access. gid %g # use the group id from the password file.  File: muddleftpd.info, Node: dumpfiles, Next: chmoding, Prev: permissions, Up: User config dumpfiles ********* * Accepted value: (filename) * Default: (none) The `cddump', `busydump' and `quitdump' directives specify what files to send to the user when they perform a number of actions or when a certain event occurs. `cddump' specifies the file to send when a change directory action is performed. `busydump' specifies the file to send when `maxconnect' number of users are already connected. `quitdump' specifies the file to send when the user disconnects from the ftp service. File magic cookies apply to these files. *Note Magic Cookies::. Examples: cddump .message # show .message in the directory the user # changes to. busydump /etc/ftpbusy quitdump /etc/ftpbye  File: muddleftpd.info, Node: chmoding, Prev: dumpfiles, Up: User config chmoding ******** * Accepted value: 0 | 1 * Default: 0 If `chmoding' is set to 1, the user is allowed to change the umask and change permissions on files. Examples: chmoding 0 # disable chmod and umask changing chmoding 1 # enable chmod and umask changing  File: muddleftpd.info, Node: Troubleshooting, Next: FTP Commands, Prev: Site Configuration, Up: Top Troubleshooting *************** If problems occur while compiling, check the following: * If you are running OpenLinux 2.2, make sure that you have downloaded and installed the crypt package. Get it from: If you get either of these messages when running the sever: `muddleftpd error in file init.c line 51: muddleftpd already running!' This means that you are already running a copy of muddleftpd using the configuration file muddleftpd tried to open. (That is, the default compiled in config file, or what you specified on the command line). Simply close down the old version (with a SIGTERM) and start it again. `muddleftpd error in file shmem.c line 91: Permission denied' This means that muddleftpd could not get write permission on the main configuration file (It is used for locking the shared memory). You must give the user running muddleftpd write permission to the main config file muddleftpd will be running as.  File: muddleftpd.info, Node: FTP Commands, Next: Magic Cookies, Prev: Troubleshooting, Up: Top FTP Commands ************ The following commands are understood and used by muddleftpd: PORT Define the data port the server will connect to PASV Tell the server that the next data connection will use passive mode RETR Retreive a file from the server STOR Store a file on the server STOU Store a file on the server using an unique filename APPE Append to a file on the server TYPE Specify what type to transfer data (A = Ascii, B = binary) QUIT Quit the ftp server PASS Password to log on using USER Username to log on using SYST Returns the system type muddleftpd is running on (UNIX) LIST Do a long list over a data connection NLST Do a short list over a data connection PWD see XPWD XPWD Return the current directory CWD see XCWD XCWD Change the working directory ABOR Abort a data connection in progress CDUP Change to the parent directory. XCUP see CDUP STAT return server status or a listing over the control connection. NOOP Do nothing REIN Reinitalize the server for a new user REST Resume a data transfer at a particular position DELE Delete a file MKD see XMKD XMKD make a new directory RMD see XRMD XRMD remove a directory RNFR set the file to rename RNTO set the name to rename to SIZE get the size of a file using the current TYPE setting MDTM get the modification time of a file HELP show list of recognized commands SITE DUMP display a file over the control connection SITE ACCESS show ACLs of the current user SITE HELP show recognised site commands SITE UMASK set the umask SITE CHMOD change the permissions of a file Commands recognised but ignored in muddleftpd ALLO Allocate space (not needed) ACCT Account name (not needed)  File: muddleftpd.info, Node: Magic Cookies, Next: Reporting Bugs, Prev: FTP Commands, Up: Top Magic Cookies ************* Magic cookies are used in MUDDLEFTPD user config files and in files displayed to the user. Magic cookies recognized in files are replaced with the values they represent as MUDDLEFTPD parses them. eg: my email is %E has the magic cookie %E. Since %E represents the FTP server maintainer's email address, MUDDLEFTPD would create the following: my email is ekuiperba@cc.curtin.edu.au All magic cookies in MUDDLEFTPD start with a % char. There are 2 formats available: The %x Format: This format is simplest syntax and simply replaces the cookie (%x) with the entire string that represents the character x. The %(m,n)x Format: This format selects a range of characters from the string cookie (%x) represents. m is the first character to insert and n is the last character to insert from cookie x. The first character in a magic cookie is numbered is 0. m and n are both adjusted so m >= 0 and n <= length of the Magic cookie. *Note Magic Cookies::. if n > m, then the cookie is considered invalid, see below. eg. %(0,5)u will give the first six characters of what magic cookie u represents. %(10,10)E returns the 11th character of what cookie E represents. %(6,8)M returns the 7th to 9th characters from what cookie M represents. %(10,8)F This is invalid because n > m. Invalid Syntax: If MUDDLEFTPD determines that a magic cookie is invalid (ie, it doesn't exist or is the format is bad), then the line where the magic cookie was found will not be parsed and an entry (informational) will be added to the log. The following magic cookies are recognized in dumped files: %T The current time in the format: Wed Jan 30 21:49:08 1993 %U The username the user used to login %C The current directory of the user %E The administrators email, set in the main config file %M The maximum number of users muddleftpd will log on at a time %N The current number of users logged into this muddleftpd server. %R The string representation of the remote user's IP (muddleftpd doesn't do reverse name lookup on users) %L The full hostname of the host muddleftpd is running on %f The number of files the user has downloaded %F The number of files the user has uploaded %b The number of bytes the user has downloaded, downloading files. %B The number of bytes the user has uploaded, uploading files %I The number of bytes the user has downloaded, from listings %i The number of listings the user has downloaded %D The total number of bytes downloaded (listing and file downloads) over data connections. %d The total number of connections opened for downloading (listing and file downloads) %t The total number of bytes transfered (listing, uploading and downloading) over data connections %c The total number of data connections made (for listing, uploading and downloading) You can also use the %(m,n)x format on any of the above cookies. (although doing so may not be useful for many of the cookies) The %C magic cookie is invalid during the logindump file, because the user has no current directory before startup. To make user configuration files flexable, a set of magic cookies are accepted in these files. Most of these magic cookies get read from the password file. The following magic cookies are recognized in config files: %U The username of the connecting party %p The encrypted password from the normal password file %s The encrypted password from the shadow password file (if your system uses shadow passwords) %u The uid from the password file %g The gid from the password file %h The home directory from the password file. You can also use the %(m,n)x format on any of the above cookies. (although doing so may not be useful for many of the cookies) For the unixuser directive, only %U will be avaliable. unixuser will load the other cookies thought.  File: muddleftpd.info, Node: Reporting Bugs, Next: Directive Index, Prev: Magic Cookies, Up: Top Reporting Bugs ************** Report bugs to Beau Kuiper .  File: muddleftpd.info, Node: Directive Index, Prev: Reporting Bugs, Up: Top Directive Index *************** * Menu: * access: access. * accessdir: accessdir. * addhost: addhost. * busydump: dumpfiles. * cddump: dumpfiles. * chmoding: chmoding. * email: email. * ftpport: ftpport. * gid: permissions. * group: group. * homedir: homedir. * logfile: logfile. * logindump: logindump. * logstrength: logstrength. * maxconnect: maxconnect. * maxusers: maxusers. * password: password. * pidfile: pidfile. * quitdump: dumpfiles. * rootdir: rootdir. * runasgid: runasgid. * runasuid: runasuid. * timeout: timeout. * uid: permissions. * umask: umask. * unixuser: unixuser. * utimeout: utimeout. * welcome: welcome.  Tag Table: Node: Top653 Node: Introduction1375 Node: Invocation1825 Node: Site Configuration2237 Node: Main config3055 Node: ftpport4054 Node: maxusers4841 Node: logstrength5432 Node: runasuid6254 Node: runasgid6864 Node: logfile7495 Node: accessdir8009 Node: timeout8560 Node: addhost9024 Node: logindump9655 Node: pidfile10291 Node: email10896 Node: User config11304 Node: group13258 Node: password13849 Node: rootdir14389 Node: homedir14977 Node: welcome15562 Node: access15997 Node: umask17638 Node: unixuser18095 Node: maxconnect18625 Node: utimeout19136 Node: permissions19585 Node: dumpfiles20262 Node: chmoding21084 Node: Troubleshooting21445 Node: FTP Commands22624 Node: Magic Cookies24797 Node: Reporting Bugs28969 Node: Directive Index29165  End Tag Table muddleftpd-1.3.13.1/doc/info/muddleftpd.texi0100644000175000017500000007534107544536576017647 0ustar joergjoerg\input texinfo @c -*-texinfo-*- @c %**start of header @setfilename muddleftpd.info @settitle muddleftpd, a file transfer protocol server @dircategory Internet @c %**end of header @c This file has the new style title page commands. @c Run `makeinfo' rather than `texinfo-format-buffer'. @c smallbook @c tex @c \overfullrule=0pt @c end tex @c Combine indices. @synindex cp fn @syncodeindex vr fn @syncodeindex ky fn @syncodeindex pg fn @syncodeindex tp fn @defindex ci @ifinfo This file documents @sc{muddleftpd}, a file transfer protocol server. Copyright (C) 1999 Jonas Öberg and Beau Kuiper Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. @ignore Permission is granted to process this file through TeX and print the results, provided the printed document carries copying permission notice identical to this one except for the removal of this paragraph (this paragraph not being relevant to the printed manual). @end ignore Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. @end ifinfo @setchapternewpage off @titlepage @title muddleftpd, a file transfer protocol server @author by Jonas Öberg and Beau Kuiper @page @vskip 0pt plus 1filll Copyright @copyright{} 1999 Jonas Öberg and Beau Kuiper @sp 2 Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. @end titlepage @page @node Top, Introduction, (dir), (dir) This file documents the @sc{muddleftpd} program, a server for the Internet File Transfer Protocol. This is edition 1.1 for Muddleftpd version 1.1. @menu * Introduction:: Introduction * Invocation:: How to invoke muddleftpd * Site Configuration:: How to configure the program * Troubleshooting:: Troubleshooting the server * FTP Commands:: FTP Commands implemented in the server * Magic Cookies:: Magic Cookies used in values and files * Reporting Bugs:: Reporting bugs * Directive Index:: Index of configuration file directives @end menu @node Introduction, Invocation, Top, Top @comment node-name, next, previous, up @chapter Introduction @sc{muddleftpd} is a server for the Internet File Transfer Protocol. Normal FTP servers tend to always want to run with root privileges on the server host. @sc{muddleftpd} is designed to overcome this obstacle without limiting the available features when running without root privileges. This manual describes version 1.1 of the program. @node Invocation, Site Configuration, Introduction, Top @chapter Invocation Neither the server program, @sc{muddleftpd}, or the special information program, @sc{ftpwho} takes any special arguments except the name of the configuration file to use. If no configuration file is specified on the command line, both programs will try to open the default configuration file. @node Site Configuration, Troubleshooting, Invocation, Top @chapter Site Configuration @sc{muddleftpd} uses two different configuration files. The main configuration file and the user configuration files. They both use a simple format where lines consist of two items separated by space (key and value). There can only be one pair of key and value on each line. Comments start with the @samp{#} character and continue until the end of the line. Values can include spaces by escaping them with the @samp{\} character as is shown in the example below. @example # The \ allows space to be recognized as part of the value access /etc/name\ spaced @end example @menu * Main config:: Main configuration file * User config:: User configuration files @end menu @node Main config, User config, , Site Configuration @chapter Main config The main config file is read when muddleftpd is first started. It contains information that applies to the entire program. Some options can be declared several times in the configuration file to add more values. @menu * ftpport:: Specify a port to bind to * maxusers:: Maximum user count * logstrength:: The messages to send to main log * runasuid:: The uid to run as * runasgid:: The gid to run as * logfile:: The name of the log file * accessdir:: Directory for user configuration files * timeout:: Default timeout value * addhost:: Allow access to a range of IP numbers * logindump:: File that gets printed when a user connects * pidfile:: File that will store muddleftpds pid number * email:: Email address of the ftp archive maintainer @end menu @node ftpport, maxusers, , Main config @chapter ftpport @ciindex ftpport @itemize @bullet @item Accepted value: (port)/(ip) | (port) @item Default: none @end itemize @samp{ftpport} tells the server that it should try to listen on @samp{port} for connections. You may specify this directive more than once to listen on more than on port. For each @samp{ftpport} directive, you may also specify the IP number of the interface on which @sc{muddleftpd} should accept connections. @sc{muddleftpd} will refuse to start if you don't specify atleast one @samp{ftpport} directive. Examples: @example ftpport 21 #listen to port 21 for connections ftpport 121/127.0.0.1 #listen to port 121 only on the loopback #device ftpport 4990/10.1.1.1 #listen to port 4990 only on the ethernet #device with IP 10.1.1.1 @end example @node maxusers, logstrength, ftpport, Main config @chapter maxusers @ciindex maxusers @itemize @bullet @item Accepted value: (maximum user count) @item Default: 30 @end itemize @samp{maxusers} tells the server the maximum number of users that @sc{muddleftpd} will allow to connect at any one time. When the maximum number of users have been reached, all subsequent connections will be silently dropped to prevent resource wastage. If you are setting up an anonymous FTP server, you should have maxusers higher that anonymous's maxusers. This way, a full FTP server doesn't rudely drop connections. @node logstrength, runasuid, maxusers, Main config @chapter logstrength @ciindex logstrength @itemize @bullet @item Accepted value: (logvalue) @item Default: 1 @end itemize @samp{logstrength} tells the server what information to log. The value for this option is the sum of any of the following types: @multitable @columnfractions .10 .9 @item 1 @tab Clients that try to access the server from invalid ip addresses @item 2 @tab File transfers, uploads and downloads. @item 4 @tab Commands the user sends to the server. @item 8 @tab The replies the server sends to the user. @item 16 @tab General Information logs (server starting and stopping) @item 32 @tab Login information, including successful and denied logins. @end multitable Examples: @example logstrength 63 # log everything logstrength 0 # log nothing logstrength 51 # log everything except user commands # and server replies @end example @node runasuid, runasgid, logstrength, Main config @chapter runasuid @ciindex runasuid @itemize @bullet @item Accepted value: (uid) @item Default: (none) @end itemize When setting the directive, the server will attempt to change the user id to @samp{uid}. This is usually used to bind to a privileged port number before switching to another user for user access. This may break some pedantic clients or firewalls, but these are few and far between. If you don't specify this directive, then the server will run with whatever permissions it has when it starts. Examples: @example runasuid 65535 # run as nobody @end example @node runasgid, logfile, runasuid, Main config @chapter runasgid @ciindex runasgid @itemize @bullet @item Accepted value: (gid) @item Default: (none) @end itemize When setting the directive, the server will attempt to change the user group id to @samp{uid}. This is usually used to bind to a privileged port number before switching to another user for user access. This may break some pedantic clients or firewalls, but these are few and far between. If you don't specify this directive, then the server will run with whatever permissions it has when it starts. Examples: @example runasgid 65535 # run as the group nogroup @end example @node logfile, accessdir, runasgid, Main config @chapter logfile @ciindex logfile @itemize @bullet @item Accepted value: (filename) @item Default: @file{/var/log/muddleftpd.log} @end itemize This directive tells @sc{muddleftpd} where to store its log file. The server will append to the specified file. This file must exist and be writable to the starting user, otherwise @sc{muddleftpd} will refuse to start and exit. Examples: @example logfile /home/rugger/ftpd/ftpd.log # store logs in an alternative # place @end example @node accessdir, timeout, logfile, Main config @chapter accessdir @ciindex accessdir @itemize @bullet @item Accepted value: (directory) @item Default: @file{/usr/local/etc} @end itemize @samp{accessdir} tells @sc{muddleftpd} where to find the configuration files describing user access to the server. It must be readable to the running user or @sc{muddleftpd} will be unable to autenticate any users. Examples: @example accessdir /etc/muddleftpd # files are stored in /etc/muddleftpd accessdir /home/rugger/ftpd # files are stored in # /home/rugger/ftpd @end example @node timeout, addhost, accessdir, Main config @chapter timeout @ciindex timeout @itemize @bullet @item Accepted value: (seconds) @item Default: 300 seconds @end itemize @samp{timeout} gives the default timeout for a user connection. This timeout will apply before the user logs in, and will persist if timeout isn't configured in the user configuration files. Examples: @example timeout 20 # users must log in within 20 seconds timeout 3600 # 1 hour timeout @end example @node addhost, logindump, timeout, Main config @chapter addhost @ciindex addhost @itemize @bullet @item Accepted value: (ip address)/(netmask) @item Default: (none) @end itemize @samp{addhost} tells the server to allow access to a given subnet. By default, @sc{muddleftpd} denies access to all hosts. Examples: @example addhost 192.203.224.0/255.255.255.0 # allow access to all hosts from 192.203.224.X addhost 76.2.0.0/255.255.0.0 # allow access to all hosts from 76.2.X.X addhost 10.2.9.34/255.255.255.255 # allow access to host 10.2.9.34 addhost 0.0.0.0/0.0.0.0 # allow access to everyone @end example @node logindump, pidfile, addhost, Main config @chapter logindump @ciindex logindump @itemize @bullet @item Accepted value: (filename) @item Default: (none) @end itemize @samp{logindump} specifies what file will be displayed to the user before the user logs in. All normal magic cookies are available (except %C) for use, although the information in many of them is useless until the user logs in. @xref{Magic Cookies}. This can be used to display welcome messages and information to the user before he or she logs in. Examples: @example logindump /etc/issue # display the issue file logindump /etc/issue.ftp # display this file @end example @node pidfile, email, logindump, Main config @chapter pidfile @ciindex pidfile @itemize @bullet @item Accepted value: (filename) @item Default: @file{/var/run/muddleftpd.pid} @end itemize @samp{pidfile} defines the file that you wish to store the pid of the main @sc{muddleftpd} process in. It is required to determine if @sc{muddleftpd} is already running with a particular config file. If one can not be created, the server will abort and refuse to run. @samp{pidfile} MUST not be in a directory where other users can create links. Examples: @example pidfile /home/rugger/pids/muddleftpd.pid # store the pid file here @end example @node email, , pidfile, Main config @chapter email @ciindex email @itemize @bullet @item Accepted value: (email address) @item Default: @samp{} @end itemize @samp{email} is where you provide an email address that is stored in the magic cookie %E. @xref{Magic Cookies}. You can specify anything you want. Examples: @example email ekuiperba@@cc.curtin.edu.au email I\ don't\ want\ to\ tell\ you! # just a string @end example @node User config, , Main config, Site Configuration @chapter User config The user configuration files define almost everything about a user connection to the ftp server. This includes home directory, root directory, password and file access rights. @sc{muddleftpd} will have at least one ofthese files, and will load them in the following order: @enumerate @item @file{user.} @item @file{user.default} @end enumerate @file{user.default} will be loaded if @sc{muddleftpd} can not find the first configuration file. Note that if @file{user.default} doesn't exist, then an error message will be written to the log. You can also create @file{group.} files that can be used as templates for @file{user.} files. If you specify a group template file in the @file{user.} file, then the @file{group.} file will be loaded AFTER the @file{user.} file has been parsed. If you specify a directive more than once in a user config file, then the first one will be the one that the server recognizes. User files also use magic cookies to improve configurablity. @xref{Magic Cookies}. @menu * group:: Specify what group template file to use * password:: Set the user's encrypted password * rootdir:: Set the user's root directory * homedir:: Set the user's home directory * welcome:: Set what file is dumped when the user logs in * access:: Add an entry to the ACL table * umask:: Set the default umask for all created files * unixuser:: Set the username to read magic tokens from * maxconnect:: Set the maximum number of times this user can connect * utimeout:: Set this users timeout * permissions:: Set the uid and/or gid this user will access files as * dumpfiles:: Dump files for various events and actions * chmoding:: Set ability to change umask and file permissions @end menu @node group, password, , User config @chapter group @ciindex group @itemize @bullet @item Accepted value: (group name) @item Default: (none) @end itemize @samp{group} tells the server to load the file @file{group.(groupname)} after processing all the directives in the user configuration file. This lets you use templates that multiple user configuration files can use. If this group file doesn't exist, a log entry will be generated. These group files are kept in the same directory as the user config files. Examples: @example group users # read the file group.users group # use no group file @end example @node password, rootdir, group, User config @chapter password @ciindex password @itemize @bullet @item Accpted value: (encrypted password) @item Default: @samp{%p} @end itemize @samp{password} specifies the password (in encrypted form) that the user must enter to successfully log on. If you specify @samp{*}, the username is disabled. if you specify @samp{}, then any password is accepted. Examples: @example password %p # use the normal password from /etc/passwd password %s # use a shadow password. password # accept any password. @end example @node rootdir, homedir, password, User config @chapter rootdir @ciindex rootdir @itemize @bullet @item Accepted value: (directory) @item Default: @file{/} @end itemize @samp{rootdir} specifies the root directory for this user. The user will not be able to access directories above this directory (unless a symbolic link exists to an outside directory, where that directory and its children will be visible). Examples: @example rootdir %h # use the home directory as the root directory. rootdir /home/ftp # use /home/ftp as the root directory. rootdir / # use / as the root directory. @end example @node homedir, welcome, rootdir, User config @chapter homedir @ciindex homedir @itemize @bullet @item Accepted value: (directory) @item Default: @samp{%h} @end itemize @samp{homedir} is the directory the server will place a user in after they have been successfully authenticated. It is relative to @samp{rootdir} (eg if @samp{homedir} is @file{/cow} and @samp{rootdir} is @file{/mad}, then the login directory will be @file{/mad/cow}). The user can also use @samp{~} to access their home directory. Examples: @example homedir %h # set home directory to the passwd home directory homedir / # use / as the home directory. @end example @node welcome, access, homedir, User config @chapter welcome @ciindex welcome @itemize @bullet @item Accepted value: (filename) @item Default: (none) @end itemize @samp{welcome} specifies the file that the user will see when he or she logs in. It is an absolute filename (no relation to rootdir). File magic cookies apply to this file. @xref{Magic Cookies}. Examples: @example welcome /etc/ftpwelcome welcome /home/ftp/welcome.txt @end example @node access, umask, welcome, User config @chapter access @ciindex access @itemize @bullet @item Accepted value: (filename or directory):(keys) @item Default: no access. @end itemize @samp{access} controls the ACL access layer that @sc{muddleftpd} places above unix file system permissions. (filename or directory) specify the filename or directory to which these restrictions apply. (keys) specify which access rights to grant to the user in this directory or file. (filename or directory) is relative to rootdir. If a filename is specified, then the access will apply only to that file. If a directory is specified by ending (filename or directory) with a @samp{/}, then the access directive will apply to all files and subdirectories of that directory. The default is to give no access. To allow unix permission define access, use @example access /:ALL @end example in the user configuration file. The following keys are available: @multitable @columnfractions .10 .9 @item R @tab Read file or directory @item L @tab List files (only meaningful for directories) @item A @tab Add new files (only meaningful for directories) @item W @tab Write access. @item D @tab Delete file access (only meaningful for directories) @item X @tab Do not override this ACL (if one exists in the group file) @item @item ALL @tab All attributes except X @item NONE @tab No attributes (no access) @end multitable Examples: @example access /etc/ftpwelcome:R # give read access to /etc/ftpwelcome access /etc/:R # give read access to all files in /etc/ access /incoming/:A # give add file access to /incoming access /:ALL # give full access to all files, dirs. access /secret/:NONE # don't give access to any files in /secret. @end example @node umask, unixuser, access, User config @chapter umask @ciindex umask @itemize @bullet @item Accepted value: (octal integer) @item Default: umask when @sc{muddleftpd} was started @end itemize @samp{umask} specifies what attributes files and directories will be given when they are created. @samp{umask} specifies what bits are not set. Examples: @example umask 077 # only user bits are set on new file creation umask 666 # all new files are set non-accessible. @end example @node unixuser, maxconnect, umask, User config @chapter unixuser @ciindex unixuser @itemize @bullet @item Accepted value: (username) @item Default: (none) @end itemize @samp{unixuser} specifies what username to load the magic cookies from. It loads these cookies from the password file (@file{/etc/passwd}) with (username). The only magic cookie available to this directive %U. @xref{Magic Cookies}. Examples: @example unixuser %U # use the entered username as the unix username unixuser ftp # use the user ftp for all the cookies @end example @node maxconnect, utimeout, unixuser, User config @chapter maxconnect @ciindex maxconnect @itemize @bullet @item Accepted value: (count) @item Default: (no limit) @end itemize @samp{maxconnect} controls how many people with the same username can log in at the same time (NOTE: This restribution is per username and not per configuration file). If this value is reached, user trying to connect will be denied access and @samp{busydump} will be returned to the user. Examples: @example maxconnect 10 maxconnect 150 @end example @node utimeout, permissions, maxconnect, User config @chapter utimeout @ciindex utimeout @itemize @bullet @item Accepted value: (seconds) @item Default: the main configuration timeout value @end itemize This sets the @samp{utimeout} for this specific user. Any sessions will automaticly be disconnected after this period of inactivity. Examples: @example utimeout 600 # set user timeout to 10 minutes utimeout 7200 # set user timeout to 2 hours. @end example @node permissions, dumpfiles, utimeout, User config @chapter permissions @ciindex uid @ciindex gid @itemize @bullet @item Accepted value: (integer) @item Default: %u | %g @end itemize The @samp{uid} and @samp{gid} directives sets the user and group id that all user requests file accesses will be performed as. Note: The server will not accept uid 0 (root) and will automatically change it to -1 (nobody). gid 0 (root or wheel) will be changed to -1 (nogroup). Examples: @example uid 20 # use user id 20 for all file access. uid %u # use the user id from the password file. gid 20 # use group id 20 for all file access. gid %g # use the group id from the password file. @end example @node dumpfiles, chmoding, permissions, User config @chapter dumpfiles @ciindex cddump @ciindex busydump @ciindex quitdump @itemize @bullet @item Accepted value: (filename) @item Default: (none) @end itemize The @samp{cddump}, @samp{busydump} and @samp{quitdump} directives specify what files to send to the user when they perform a number of actions or when a certain event occurs. @samp{cddump} specifies the file to send when a change directory action is performed. @samp{busydump} specifies the file to send when @samp{maxconnect} number of users are already connected. @samp{quitdump} specifies the file to send when the user disconnects from the ftp service. File magic cookies apply to these files. @xref{Magic Cookies}. Examples: @example cddump .message # show .message in the directory the user # changes to. busydump /etc/ftpbusy quitdump /etc/ftpbye @end example @node chmoding, , dumpfiles, User config @chapter chmoding @ciindex chmoding @itemize @bullet @item Accepted value: 0 | 1 @item Default: 0 @end itemize If @samp{chmoding} is set to 1, the user is allowed to change the umask and change permissions on files. Examples: @example chmoding 0 # disable chmod and umask changing chmoding 1 # enable chmod and umask changing @end example @node Troubleshooting, FTP Commands, Site Configuration, Top @chapter Troubleshooting If problems occur while compiling, check the following: @itemize @bullet @item If you are running OpenLinux 2.2, make sure that you have downloaded and installed the crypt package. Get it from: @url{ftp://ftp.linuxland.de/pub/OpenLinux/crypto/2.2/glibc-crypt-2.1-3i.i386.rpm} @end itemize If you get either of these messages when running the sever: @table @samp @item muddleftpd error in file init.c line 51: muddleftpd already running! This means that you are already running a copy of muddleftpd using the configuration file muddleftpd tried to open. (That is, the default compiled in config file, or what you specified on the command line). Simply close down the old version (with a SIGTERM) and start it again. @item muddleftpd error in file shmem.c line 91: Permission denied This means that muddleftpd could not get write permission on the main configuration file (It is used for locking the shared memory). You must give the user running muddleftpd write permission to the main config file muddleftpd will be running as. @end table @node FTP Commands, Magic Cookies, Troubleshooting, Top @chapter FTP Commands The following commands are understood and used by muddleftpd: @multitable @columnfractions .20 .8 @item PORT @tab Define the data port the server will connect to @item PASV @tab Tell the server that the next data connection will use passive mode @item RETR @tab Retreive a file from the server @item STOR @tab Store a file on the server @item STOU @tab Store a file on the server using an unique filename @item APPE @tab Append to a file on the server @item TYPE @tab Specify what type to transfer data (A = Ascii, B = binary) @item QUIT @tab Quit the ftp server @item PASS @tab Password to log on using @item USER @tab Username to log on using @item SYST @tab Returns the system type muddleftpd is running on (UNIX) @item LIST @tab Do a long list over a data connection @item NLST @tab Do a short list over a data connection @item PWD @tab see XPWD @item XPWD @tab Return the current directory @item CWD @tab see XCWD @item XCWD @tab Change the working directory @item ABOR @tab Abort a data connection in progress @item CDUP @tab Change to the parent directory. @item XCUP @tab see CDUP @item STAT @tab return server status or a listing over the control connection. @item NOOP @tab Do nothing @item REIN @tab Reinitalize the server for a new user @item REST @tab Resume a data transfer at a particular position @item DELE @tab Delete a file @item MKD @tab see XMKD @item XMKD @tab make a new directory @item RMD @tab see XRMD @item XRMD @tab remove a directory @item RNFR @tab set the file to rename @item RNTO @tab set the name to rename to @item SIZE @tab get the size of a file using the current TYPE setting @item MDTM @tab get the modification time of a file @item HELP @tab show list of recognized commands @item SITE DUMP @tab display a file over the control connection @item SITE ACCESS @tab show ACLs of the current user @item SITE HELP @tab show recognised site commands @item SITE UMASK @tab set the umask @item SITE CHMOD @tab change the permissions of a file @end multitable Commands recognised but ignored in muddleftpd @multitable @columnfractions .20 .8 @item ALLO @tab Allocate space (not needed) @item ACCT @tab Account name (not needed) @end multitable @node Magic Cookies, Reporting Bugs, FTP Commands, Top @chapter Magic Cookies Magic cookies are used in @sc{muddleftpd} user config files and in files displayed to the user. Magic cookies recognized in files are replaced with the values they represent as @sc{muddleftpd} parses them. eg: @example my email is %E @end example has the magic cookie %E. Since %E represents the FTP server maintainer's email address, @sc{muddleftpd} would create the following: @example my email is ekuiperba@@cc.curtin.edu.au @end example All magic cookies in @sc{muddleftpd} start with a % char. There are 2 formats available: The %x Format: This format is simplest syntax and simply replaces the cookie (%x) with the entire string that represents the character x. The %(m,n)x Format: This format selects a range of characters from the string cookie (%x) represents. m is the first character to insert and n is the last character to insert from cookie x. The first character in a magic cookie is numbered is 0. m and n are both adjusted so m >= 0 and n <= length of the Magic cookie. @xref{Magic Cookies}. if n > m, then the cookie is considered invalid, see below. eg. @multitable @columnfractions .20 .8 @item %(0,5)u @tab will give the first six characters of what magic cookie u represents. @item %(10,10)E @tab returns the 11th character of what cookie E represents. @item %(6,8)M @tab returns the 7th to 9th characters from what cookie M represents. @item %(10,8)F @tab This is invalid because n > m. @end multitable Invalid Syntax: If @sc{muddleftpd} determines that a magic cookie is invalid (ie, it doesn't exist or is the format is bad), then the line where the magic cookie was found will not be parsed and an entry (informational) will be added to the log. The following magic cookies are recognized in dumped files: @multitable @columnfractions .1 .9 @item %T @tab The current time in the format: Wed Jan 30 21:49:08 1993 @item %U @tab The username the user used to login @item %C @tab The current directory of the user @item %E @tab The administrators email, set in the main config file @item %M @tab The maximum number of users muddleftpd will log on at a time @item %N @tab The current number of users logged into this muddleftpd server. @item %R @tab The string representation of the remote user's IP (muddleftpd doesn't do reverse name lookup on users) @item %L @tab The full hostname of the host muddleftpd is running on @item %f @tab The number of files the user has downloaded @item %F @tab The number of files the user has uploaded @item %b @tab The number of bytes the user has downloaded, downloading files. @item %B @tab The number of bytes the user has uploaded, uploading files @item %I @tab The number of bytes the user has downloaded, from listings @item %i @tab The number of listings the user has downloaded @item %D @tab The total number of bytes downloaded (listing and file downloads) over data connections. @item %d @tab The total number of connections opened for downloading (listing and file downloads) @item %t @tab The total number of bytes transfered (listing, uploading and downloading) over data connections @item %c @tab The total number of data connections made (for listing, uploading and downloading) @end multitable You can also use the %(m,n)x format on any of the above cookies. (although doing so may not be useful for many of the cookies) The %C magic cookie is invalid during the logindump file, because the user has no current directory before startup. To make user configuration files flexable, a set of magic cookies are accepted in these files. Most of these magic cookies get read from the password file. The following magic cookies are recognized in config files: @multitable @columnfractions .1 .9 @item %U @tab The username of the connecting party @item %p @tab The encrypted password from the normal password file @item %s @tab The encrypted password from the shadow password file (if your system uses shadow passwords) @item %u @tab The uid from the password file @item %g @tab The gid from the password file @item %h @tab The home directory from the password file. @end multitable You can also use the %(m,n)x format on any of the above cookies. (although doing so may not be useful for many of the cookies) For the unixuser directive, only %U will be avaliable. unixuser will load the other cookies thought. @node Reporting Bugs, Directive Index, Magic Cookies, Top @chapter Reporting Bugs Report bugs to Beau Kuiper . @node Directive Index, , Reporting Bugs, Top @chapter Directive Index @printindex ci @contents @bye muddleftpd-1.3.13.1/doc/man/0040755000175000017500000000000007751444665014432 5ustar joergjoergmuddleftpd-1.3.13.1/doc/man/ftpwho.10100644000175000017500000000045707544536576016031 0ustar joergjoerg.PU .TH ftpwho 1 local .SH NAME ftpwho \- show process information about each active ftp user .SH SYNOPSIS .ll +8 .B ftpwho .RB .ll -8 .SH DESCRIPTION The .I ftpwho command shows information about each active ftp user and a summary of the number of users connected. .ll -8 .SH "SEE ALSO" muddleftpd(1) muddleftpd-1.3.13.1/doc/man/muddleftpd.10100644000175000017500000000075707544536576016655 0ustar joergjoerg.PU .TH muddleftpd 1 local .SH NAME muddleftpd \- ftp server .SH SYNOPSIS .ll +8 .B muddleftpd .B [-V][-d][h][-c CONFIGFILE] .ll -8 .SH DESCRIPTION .I muddleftpd is a server for the Internet File Transfer Protocol. It can run either as a stand-alone daemon or from the INET super-server. Optionally, a configuration file can be specified on the command line and then the daemon process will use that instead of the configuration file in the default location. .ll -8 .SH "SEE ALSO" ftpwho(1) muddleftpd-1.3.13.1/doc/man/mudpasswd.10100644000175000017500000000255607544536576016533 0ustar joergjoerg..TH MUDPASSWD 1 ..SH NAME mudpasswd - manage muddleftpd(1) password files ..SH SYNOPSIS ..B muddleftpd -p \fIpassword-file\fP {-a \fIusername\fP [\fIoptions...\fP]|-d \fIusername\fP|-e \fIusername\fP \fIoptions...\fP} ..SH DESCRIPTION \fBmudpasswd\fP modifies a password file to be used by muddleftpd(1)'s \fIinternal\fP authentication method. Unless the \fI-h\fP or \fI-V\fP options are given, the \fI-p\fP option and one of the \fI-a\fP, \fI-e\fP, or \fI-d\fP options must be specified. Aditionally, if \fI-e\fP is selected, at least one of \fI-P\fP, \fI-H\fP, or \fI-R\fP must be given. ..SH OPTIONS ..TP ..B -p \fIpassword-file\fP Edit the passwords found in \fIpassword-file\fP. ..TP ..B -a \fIusername\fP Add the user \fIusername\fP. ..TP ..B -d \fIusername\fP Delete user \fIusername\fP. ..TP ..B -e \fIusername\fP Edit the information for user \fIusername\fP. ..TP ..B -P \fIpassword\fP Set the password for the user specified by -a or -e. ..TP ..B -R \fIdirectory\fP Set the root directory for the user specified by -a or -e. ..TP ..B -H \fIdirectory\fP Set the home directory for the user specified by -a or -e. ..TP ..B -W Interactively read in a password for the user specified by -e. ..SH SEE ALSO ftpwho(1) ..SH AUTHOR MuddleFTPd was written by Beau Kuiper . This manual page was written for the Debian system by Decklin Foster muddleftpd-1.3.13.1/doc/Makefile.in0100644000175000017500000000363707751233053015715 0ustar joergjoerg# Copyright (C) 1999 Beau Kuiper # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ include ../Makefile.defs prefix=@prefix@ # where the man pages are stored MANDIR=@mandir@ # where info files should be stored INFODIR=@infodir@ DOCDIR=@datadir@ DOCSRC = info/muddleftpd.texi DOCTARGET = ifdef MAKEINFO DOCOBJ = $(DOCSRC:.texi=.info) DOCTARGET += infofile endif all: doc ifdef MAKEINFO infofile: $(MAKEINFO) $(DOCSRC) -o $(DOCOBJ) doc: $(DOCTARGET) else doc: echo There is no makeinfo on this machine endif install: all mkdir -p $(MANDIR)/man1 install man/muddleftpd.1 -m 644 $(MANDIR)/man1/$(MUDOUTPROG).1 install man/ftpwho.1 -m 644 $(MANDIR)/man1/$(WHOPROG).1 install man/mudpasswd.1 -m 644 $(MANDIR)/man1/$(MUDPASSWDPROG).1 mkdir -p $(INFODIR) install $(DOCOBJ) -m 644 $(INFODIR) mkdir -p $(DOCDIR)/doc/muddleftpd install -m 644 cookie.txt $(DOCDIR)/doc/muddleftpd/cookie.txt install -m 644 ftpcmds.txt $(DOCDIR)/doc/muddleftpd/ftpcmds.txt install -m 644 muddleftpd.txt $(DOCDIR)/doc/muddleftpd/muddleftpd.txt install -m 644 mudlogd.txt $(DOCDIR)/doc/muddleftpd/mudlogd.txt install -m 644 mudpasswd.txt $(DOCDIR)/doc/muddleftpd/mudpasswd.txt install -m 644 reference.txt $(DOCDIR)/doc/muddleftpd/reference.txt clean: distclean: clean rm -f Makefile *~ maintainer-clean: distclean rm -f $(DOCOBJ) muddleftpd-1.3.13.1/doc/cookie.txt0100644000175000017500000001410107556000671015647 0ustar joergjoerg MUDDLEFTPD DOCUMENTATION (Version 1.3.4) Beau Kuiper (support@muddleftpd.cx) License under GPL 1) MAGIC COOKIES UNDER MUDDLEFTPD 1a) Overview: Magic cookies are used in the group sections of muddleftpd config files and in files displayed to the user. Magic cookies recognized in files are replaced with the values they represent as muddleftpd parses them. eg: my email is %E has the magic cookie %E. Since %E represents the FTP server maintainer's email address, muddleftpd would create the following: my email is ekuiperba@cc.curtin.edu.au 1b) Syntax: All magic cookies in muddleftpd start with a % char. There are 2 formats available: The %x Format: This format is simplest syntax and simply replaces the cookie (%x) with the entire string that represents the character x. The %(m,n)x Format: This format selects a range of characters from the string cookie (%x) represents. m is the first character to insert and n is the last character to insert from cookie x. The first character in a magic cookie is numbered is 0. m and n are both adjusted so m >= 0 and n <= length of the Magic cookie. if n > m, then the cookie is considered invalid, see below. eg. %(0,5)u will give the first six characters of what magic cookie u represents. %(10,10)E returns the 11th character of what cookie E represents. %(6,8)M returns the 7th to 9th characters from what cookie M represents. %(10,8)F This is invalid because n > m. Invalid Syntax: If muddleftpd determines that a magic cookie is invalid (ie, it doesn't exist or is the format is bad), then the line where the magic cookie was found will not be parsed. 2) MAGIC COOKIES IN DUMPED FILES. 2a) Overview: At certain times, muddleftpd can print the contents of a file to the screen in an extended FTP request. eg: 230- 230-Hello rugger@127.0.0.1 230- 230-WELCOME. IF YOU HAVE PROBLEMS WITH THIS SERVER EMAIL: 230- ekuiperba@cc.curtin.edu.au 230- 230 User rugger login successful. Magic cookies can be used in these files to create semi-dynamic content involving the remote user, the current directory, and statistics. 2b) Available Magic Cookies. The following magic cookies are recognized in dumped files: %T The current time in the format: Wed Jan 30 21:49:08 1993 %U The username the user used to login. %C The current directory of the user. %E The administrators email, set in the main config file. (see config.txt) %M The maximum number of users muddleftpd will log on at a time. %N The current number of users logged into this muddleftpd server. %R The hostname of the remote user connected to muddleftpd. %L The hostname of the virtual server the user is on. If no virtual servers are defined, it will be the main hostname/ %f The number of files the user has downloaded. %F The number of files the user has uploaded. %b The number of bytes the user has downloaded, downloading files. %B The number of bytes the user has uploaded, uploading files. %I The number of bytes the user has downloaded, from listings. %i The number of listings the user has downloaded. %D The total number of bytes downloaded (listing and file downloads) over data connections. %d The total number of connections opened for downloading. (listing and file downloads) %t The total number of bytes transfered (listing, uploading and downloading) over data connections. %c The total number of data connections made (for listing, uploading and downloading) %v The name of the section the users virtual server declaration is from. You can also use the %(m,n)x format on any of the above cookies. (although doing so may not be useful for many of the cookies) The %C magic cookie is invalid during the logindump file, (see config.txt) because the user has no current directory before startup. 2c) Examples: Text file that is dumped when someone is logged in: Hello %U@%R. Welcome to %L. You are user %N of %M. Send any problem reports to %E Current time over here is: %(11,18)T The resulting dumped file: 230- 230-Hello rugger&127.0.0.1. 230-Welcome to darkstar.example.net. 230-You are user 1 of 5. 230- 230-Send any problem reports to ekuiperba@cc.curtin.edu.au 230- 230-Current time over here is: 01:31:38 230 User rugger login successful. And the text file that is dumped as the user quits: you downloaded %b bytes in %f files you uploaded %B bytes in %F files you downloaded %I bytes in %i listings in total: download transfers %d downloaded bytes %D total transfers %c total transfered bytes %t The results when the user quits: 221-you downloaded 14082785 bytes in 4 files 221-you uploaded 1727152 bytes in 2 files 221-you downloaded 17015 bytes in 3 listings 221- 221-in total: 221- download transfers 7 221- downloaded bytes 14099800 221- total transfers 9 221- total transfered bytes 15826952 221- 221 muddleftpd Logging out user. after i had down some downloads and uploads and listings. 3) MAGIC COOKIES IN GROUP SECTIONS: 3a) Overview: To make user configuration files flexable, a set of magic cookies are accepted in these files. Most of these magic cookies get read from the authentication module. 3b) Avaliable magic cookies: The following magic cookies are recognized in group sections of config files: (note that some of these cookies are determined by the authetication module and are not avaliable until it has run) %U The username of the connecting party. %v The section name of the virtual server the user is connecting to. %V The host name of the virutal server the user is connecting to. %u The uid from the authentication module. %g The gid from the authentication module. %G A list of suplementary gids from the authentication module. %h The home directory from the authentication module. %r The root directory from the authentication module. You can also use the %(m,n)x format on any of the above cookies. (although doing so may not be useful for many of the cookies) For the authuser, and any directives used by the authentication module, only %U, %v and %V will be avaliable. 3c) Examples See the examples directory for examples of magic cookie usage in user config files. muddleftpd-1.3.13.1/doc/ftpcmds.txt0100644000175000017500000000364507556000671016051 0ustar joergjoerg MUDDLEFTPD DOCUMENTATION (Version 1.3.4) Beau Kuiper (support@muddleftpd.cx) License under GPL 1) FTP COMMANDS 1a) Command List The following commands are understood and used by muddleftpd: PORT Define the data port the server will connect to. PASV Tell the surver that the next data connection will use passive mode. RETR Retreive a file from the server. STOR Store a file on the server. STOU Store a file on the server using an unique filename. APPE Append to a file on the server. TYPE Specify what type to transfer data (A = Ascii, B = binary) QUIT Quit the ftp server. PASS Password to log on using. USER Username to log on using. SYST Returns the system type muddleftpd is running on (UNIX) LIST Do a long list over a data connection. NLST Do a short list over a data connection. PWD see XPWD XPWD Return the current directory. CWD see XCWD XCWD Change the working directory. ABOR Abort a data connection in progress. CDUP Change to the parent directory. XCUP see CDUP STAT return server status or a listing over the control connection. NOOP Do nothing. REIN Reinitalize the server for a new user. REST Resume a data transfer at a particular position. DELE Delete a file. MKD see XMKD XMKD make a new directory. RMD see XRMD XRMD remove a directory. RNFR set the file to rename. RNTO set the name to rename to. SIZE get the size of a file using the current TYPE setting. MDTM get the modification time of a file. HELP show list of recognised commands. SITE DUMP display a file over the control connection. SITE ACCESS show ACLs of the current user. SITE HELP show recognised site commands. SITE UMASK set the umask. SITE CHMOD change the permissions of a file. SITE IDLE adjust idle time of user. Commands recognised but ignored in muddleftpd: ALLO Allocate space (not needed) ACCT Account name (not needed) STRU Structure type (always F[file]) muddleftpd-1.3.13.1/doc/muddleftpd.txt0100644000175000017500000000702507556000671016535 0ustar joergjoerg MUDDLEFTPD DOCUMENTATION (Version 1.1.1) Beau Kuiper (ekuiperba@cc.curtin.edu.au) License under GPL 1) THE MUDDLEFTPD PROGRAM 1a) System Requirements: Your system needs to following to compile and run muddleftpd. * Some operating system that resembles UNIX (linux, FreeBSD, SunOs, Solaris, Irix, Ultrix). Muddleftpd has been tested on FreeBSD, linux with libc5, linux with glibc2, Irix 5.3, solaris 2.6, linux with glibc2.1 and Sun-os. * GNU gcc or any gcc compatible compiler (egcs, etc). I will accept patches to make muddleftpd compile on non-gcc compilers (as long as nothing breaks). * GNU make. Other makes seem to get confused about what I use in the Makefile 1b) Building muddleftpd: * Run the following command in the top level directory ./configure or if you wish to specify a prefix directory to install (eg /usr/local) ./configure --prefix= * Open defaults.h. There is a #define CONFIGFILEE statement in the first few lines. eg: #define CONFIGFILE "/etc/muddleftpd/ftpd.conf" If this is not where you want to place the main config file, then modify it to the location and filename you wish use instead. If you don't perform this step, muddleftpd and ftpwho will need to be manually told where their configuration files are each time they are started. * run the following to create the executables: make if you want to create a version that doesn't output startup messages, run: make QUIET=1 NOTE: on some systems you may need to run gmake instead of just make. 1c) Installing muddleftpd: * run the following to install muddleftpd: make install * Create the configuration at the location you specified in CONFIGFILE above. You may use one of the example configurations (standard set is recommended), see examples/README for more information. 1d) Running muddleftpd: To start muddleftpd, type muddleftpd [configfile] If you specify [configfile], then it will use [configfile] as the main configuration file instead of the one compiled into muddleftpd. If you want muddleftpd to run each time you boot the system up, then you need to put the muddleftpd statement above into one of your startup files, probably /etc/rc.d/rc.local (on linux systems) 2) TROUBLESHOOTING: 2a) Compile Problems: If problems occur while compiling, check the following: * If you are running OpenLinux 2.2, make sure that you have downloaded and installed the crypt package. Get it from: ftp://ftp.linuxland.de/pub/OpenLinux/crypto/2.2/glibc-crypt-2.1-3i.i386.rpm Everything should compile OK then. 2b) Running problems: If you get the message: ---------------------------------------------------------------------------- muddleftpd error in file init.c line 51: muddleftpd already running! CANNOT RESUME. Goodbye This means that you are already running a copy of muddleftpd using the configuration file muddleftpd tried to open. (That is, the default compiled in config file, or what you specified on the command line). Simply close down the old version (with a SIGTERM) and start it again. ---------------------------------------------------------------------------- muddleftpd error in file shmem.c line 91: Permission denied CANNOT RESUME. Goodbye This means that muddleftpd could not get write permission on the main configuration file (It is used for locking the shared memory). You must give the user running muddleftpd write permission to the main config file muddleftpd will be running as. ----------------------------------------------------------------------------muddleftpd-1.3.13.1/doc/mudlogd.txt0100644000175000017500000000331007556000671016031 0ustar joergjoerg MUDDLEFTPD DOCUMENTATION (Version 1.3.10) Beau Kuiper (support@muddleftpd.cx) License under GPL This is a quick guide to using mudlogd. Mudlogd is a deamon designed to make rotating muddleftpd log files simple, without bothering the main server. Muddleftpd isn't able to rotate its log files sometimes because it has lost the permissions or file access to do so. Mudlogd overcomes this by providing muddleftpd a single place to store logs and then handling rotation itself Although designed for muddleftpd, mudlogd can also be used by almost any program. Simply substitue any references to muddleftpd with your favourite program and its configuration requirements. Using mudlogd: 1) Decide a directory and filename to store the fifo object muddleftpd needs to communicate with mudlogd. Make sure this file cannot be modified/deleted by other local users. 2) Create a configuration file containing the following: [section] logger logfile /var/log/muddleftpd.conf fifoname /etc/muddleftpd/mudlog Replace the parameter on logfile with the output log file you wish to use. Replace the parameter on fifoname with the filename you decided in part 1. 3) In the muddleftpd configuration file. set the logfile directives for the servers and virtual servers that will use mudlogd to the filename you decided in part 1. 4) Start muddleftpd by running: mudlogd -c /etc/muddleftpd/mudlogd.conf muddleftpd -c /etc/muddleftpd/muddleftpd.conf Replace the configuration files specified above with the ones created for mudlogd and muddleftpd. 5) You can rotate the logs now using logrotate, or by using the following: mv /var/log/muddleftpd.log /var/log/muddleftpd.log.old killall -SIGUSR1 mudlogd muddleftpd-1.3.13.1/doc/mudpasswd.txt0100644000175000017500000000227207556000671016413 0ustar joergjoerg MUDDLEFTPD DOCUMENTATION (Version 1.3.4) Beau Kuiper (support@muddleftpd.cx) License under GPL 1) THE MUDPASSWD PROGRAM 1a) Building mudpasswd: The internal password module, uses its own password modification utility. This utility will be built when you build muddleftpd. 1b) Installing mudpasswd: Installed with the rest of muddleftpd. Note that it refused to be setuid root. This is because you can do much damage with it! 1c) Running mudpasswd: To add a user to a password file: mudpasswd -p -a You may also specify -P to set the password, -R to set the root directory, -H to set the home directory if you don't specify any of these, then mudpasswd will ask for them before creating the user To delete a user from a password file: mudpasswd -p -d To edit a user in a password file: mudpasswd -p -e (option to change) You must also specify what to change: -P to set a new password, -R to set a new root directory, -H to set a new home directory, -W to get mudpasswd to ask for a new password muddleftpd-1.3.13.1/doc/reference.txt0100644000175000017500000015456507556000671016357 0ustar joergjoergMuddleftpd reference text. Copyright Beau Kuiper 2000. 1.0 Config file format overview 1.0.1 Main sections 1.0.2 Virtual server sections 1.0.3 Group sections. 1.1 Directive reference 1.1.1 Quick reference This is a quick list of all muddleftpd directives, and where they are valid. access (group) altlongreplies (main) authmethod (group) authuser (group) badauthwait (virtual-server, main) busydump (group) busydumpdata (group) byteratios (group) cddump (group) cddumpdata (group) chmoding (group) chroot (group) cmdoff (group) devaccess (group) droproot (group) email (virtual-server, main) fakegroup (group) fakemode (group) fakename (group) fileratios (group) fnaccess (group) ftpport (virtual-server, main) fxpallow (group) gid (group) greeting (virtual-server, main) group (virtual-server, main) homedir (group) hostname (virtual-server, main) include initalbytes (group) initalfiles (group) ipacl (virtual-server, main, group) logfile (virtual-server, main) logindump (virtual-server, main) logindumpdata (virtual-server, main) logintries (virtual-server, main) logstrength (virtual-server, main) maxconnectperip (virtual-server, main) maxspeed (group) maxusers (virtual-server, main, group) nameacl (group) nice (group) pfnaccess (group) quitdump (group) quitdumpdata (group) ratiofile (group) ratios (group) rdnstimeout (main) realdir (group) rootdir (group) runasuser (main) sitecmdoff (group) smartbind (main) supgid (group) timeout (virtual-server, main, group) uid (group) umask (virtual-server, main, group) userjail (group) vserver (main) welcome (group) welcomedumpdata (group) zerobind (main) 1.1.2 Detailed reference 1.1.2.1 "access" directive Used in: group sections Syntax: access [DIR]:[MODE] Examples: access %h/:ALL # give all access to home directory access /secure/:NONE # deny all access to /secure directory access /:RCL # only allow reading, listing and # chdir to users Cookie support: Yes, see 1.2.2 Default: access /:NONE access is used to change the permissions on files or directories muddleftpd gives to users logged into a particular group. If [DIR] ends with /, then muddleftpd assumes it is refering to a directory and permissions only apply to files in the directory, not [DIR] itself. Otherwise, muddleftpd assumes it is a file, and the permissions will only apply to that filename. [MODE] is documented in 1.2.1. WARNING: when a symbolic link is encountered, muddleftpd will apply the access directives to the symbolic link only, not to the destination of the symbolic link. Users who can create symbolic links in the same areas they access with the ftp server will be able to easily circumvent the access directives. Therefore you MUST not depend on access being safe in groups where the user can create symbolic links in the same area as they can access via the ftp server. 1.1.2.2 "altlongreplies" directive Used in: main section Syntax: altlongreplies [VALUE] Examples: altlongreplies 0 # use rfc format for long replies altlongreplies 1 # use more compatible format for # long replies Cookie support: No Default: altlongreplies 0 altlongreplies makes muddleftpd use a different format for long FTP replies. When set to 1, it uses the following format for long replies: 220-Start long reply 220-Contiune 220 End long reply When set to 0, it uses this format: 220-Start long reply Continue 220 End long reply. When set to 1, muddleftpd may be more compatible with older clients and proxies. 1.1.2.3 "authmethod" directive Used in: group sections Syntax: authmethod [modulename] Examples: authmethod pam # use pam to authenticate users authmethod unix # use unix passwd to authenticate # users. authmethod /etc/muddleftpd/libauthmysql.so # use external authentication module. Cookie support: Yes, see 1.2.2 Default: (none), you must specify this. authmethod sets how muddleftpd chooses a user's group and how that user is authenticated. You can specify one of the internal authentication modules (unix,pam,internal,anonymous,deny) or an external module. If you use an external authentication module, its full path MUST be specified. Section 2.0 outlines 1.1.2.4 "authuser" directive Used in: group sections Syntax: authuser [username] Examples: authuser %U # no rewriting. authuser %U-servb # add the suffix -servb to the # username authuser %(5,100)U # remove first 5 characters of # username Cookie support: Yes, see 1.2.2 Default: authuser %U Authuser allows the server to do some very basic rewriting of the username before passing it to the authentication module (specifed in authmodule). This re-written username is ONLY used when communicating with the authentication module, and the original username is used everywhere else. 1.1.2.5 "badauthwait" directive Used in: virtual server sections or the main section. If virtual servers are defined, any occurence in the main section is taken as the default for virtual servers. Syntax: badauthwait [milliseconds] Examples: badauthwait 2000 # wait 2 seconds badauthwait 500 # wait 1/2 second Cookie support: No Default: badauthwait 3000 When a login fails (PASS command) for any reason, muddleftpd will wait a defined time before accepting a new command. Use this option to specify an appropriate time for muddleftpd to wait. 1.1.2.6 "busydump" directive Used in: group sections Syntax: busydump [filename] Examples: busydump /etc/muddleftpd/TOOBUSY # print this when too many users # are on Cookie support: Yes, see 1.2.2 Default: (none) When the server cannot log a user into a particular group due to maxusers limits, it will print this message before disconnecting the user from the server. This is not used when the server's or the virtual server's maxusers limit is reaches. When this occurs, the user is simply disconnected without any messages. Section 1.2.4 documents cookies you can use in files specified with this directive. The file must given with a full path. 1.1.2.7 "busydumpdata" directive Used in: group sections Syntax: busydumpdata [dump-string] Examples: busydumpdata Cannot log you in/nMaximum %M users exceeded./n # print this when too many users # are on Cookie support: Yes, see 1.2.4 Default: (none) This command is exactly like busydump (1.1.2.7), except the actual data is stored in the config file instead of an external file. The format for [dump-string] is described in section 1.2.3. This overrides any busydump directives in the same section. 1.1.2.8 "byteratios" directive Used in: group sections, only valid if ratios is set to 1 Syntax: byteratios [down:up] Examples: byteratios 10:3 # for every 3 bytes the user uploads # give 10 bytes of download credit. byteratios 1:5 # for every 5 bytes the user uploads # give 1 byte of credit. Cookie support: No Default: (none) This directive sets the ratios that will be placed on byte usage for users not found in the ratio file. (users in the ratio file have already got a ratio stored) If no ratio file is given, this will always be used. 1.1.2.9 "cddump" directive Used in: group sections Syntax: cddump [filename] Examples: cddump README # print the README file in the # directory the user is entering cddump /etc/cdinfo # print /etc/cdinfo out. Cookie support: Yes, see 1.2.2 Default: (none) When a user changes directory, this file will be printed. If it is relative filename (no / at the beginning), then the file will relative to the new directory the user is entering. A relativly specified file will also have to be normally accessable to the user via permissions and access directives. If the file is specified absolute (with a / at the beginning) then muddleftpd will not check it against access directives. Absolute files are not relative to rootdir. 1.1.2.10 "cddumpdata" directive Used in: group sections Syntax: cddumpdata [dump-string] Examples: cddumpdata You changed dir/nIt is now %C/n # print this when muddleftpd changes # dir Cookie support: Yes, see 1.2.4 Default: (none) This command is exactly like cddump (1.1.2.9), except the actual data is stored in the config file instead of an external file. The format for [dump-string] is described in section 1.2.3. This overrides any cddump directives in the same section. 1.1.2.11 "chmoding" directive Used in: group sections Syntax: chmoding [0 or 1] Examples: chmoding 1 # allow site chmod chmoding 0 # disallow site chmod Cookie support: Yes, see 1.2.2 Default: chmoding 0 This command controls whether users can change the permissions on files using "site chmod". By default, it is 0 and users cannot change file permissions on ANY files. Setting it to 1 will enable this ability. 1.1.2.12 "chroot" directive Used in: group sections Syntax: chroot [VALUE] Examples: chroot 1 # chroot after successful login chroot 0 # don't chroot after successful # login Cookie support: Yes, see 1.2.2 Default: chroot 0 This controls whether muddleftpd will change the system root directory to the users rootdir after login is complete. This means symbolic links that point outside of the users rootdir will NOT work. It has the following side effects: 1) userjail is set to 1, thus the user cannot login again. 2) welcome, cddump and quitdump, will complain if you attempt to use files outside of rootdir 3) log messages for file operations will now have filenames absolute to the user's rootdir. (may be fixed later) 4) log rotation will not be done for any muddleftpd process that has performed chroot. 1.1.2.13 "cmdoff" directive Used in: group sections Syntax: cmdoff [CMD] Examples: cmdoff SITE # disable all site commands. cmdoff PASV # disable passive transfers. cmdoff DELE # disable file deletion. Cookie support: Yes, see 1.2.2 Default: (none) This directive disables FTP commands. This can disable things like file rename, deleting, storing files, ect. When commands are disabled, they appear unimplemented to the user (ie, they become no different to commands that don't exist). See section 3.1 for commands that can be disabled with this command. 1.1.2.14 "devaccess" directive Used in: group sections Syntax: devaccess [VALUE] Examples: devaccess 1 # enable access to device files. devaccess 0 # disable access to device files. Cookie support: Yes, see 1.2.2 Default: devaccess 0 This directive sets whether users in a group can access device files. The default is to disallow this, although it does incur a very small performace penalty. (file must be checked to make sure it isn't a device). Attempting to access a device will result in a permission error. 1.1.2.15 "droproot" directive Used in: group sections Syntax: droproot [VALUE] Examples: droproot 1 # drop all root privliges after # login droproot 0 # don't drop root privliges. Cookie support: Yes, see 1.2.2 Default: droproot 0 This directive sets whether the server will drop all root privlidges after login. When enabled, security for the paranoid is enhanced (muddleftpd doesn't have root exploits), but: 1) muddleftpd cannot bind the server data port to 20. This means that ftp clients may not work through firewalls. However, this limitation will automaticly be removed if you have linux and the capibilities library installed. 2) userjail is set to 1. (user cannot relogin as another user) 3) logfiles cannot be rotated by any muddleftpd process that has a user logged into a group where droproot is set. 1.1.2.16 "email" directive Used in: virtual server sections or the main section. If virtual servers are defined, any occurence in the main section is taken as the default for virtual servers. Syntax: email [STRING] Examples: email ftpadmin@ftp.host.com # set email to this email user@hostname # another silly example Cookie support: No Default: email ftp@localhost This sets the email address returned when the HELP ftp command is used, and when the %e cookie is used in dumped files or strings. This can be anything you want really. 1.1.2.17 "fakegroup" directive Used in: group sections Syntax: fakegroup [STRING] Examples: fakegroup mudgroup # set group to mudgroup fakegroup anonymous # set group to anonymous Cookie support: Yes, see section 1.2.2 Default: (none) This is used to hide all group names in all listings, replacing them with the name you specify for the given group. This can hide the real group names in the group files from ftp users. 1.1.2.18 "fakemode" directive Used in: group sections Syntax: fakemode [OCTAL-VALUE] Examples: fakemode 777 # set mode to rwxrwxrwx fakemode 700 # set mode to rwx------ Cookie support: Yes, see section 1.2.2 Default: (none) This specifies that listings should always return a certain mode for filenames. This hides the real permissions from the ftp user. 1.1.2.19 "fakename" directive Used in: group sections Syntax: fakename [STRING] Examples: fakename mud # set username to mud fakename mp3 # set username to mp3 fakename %U # set username to the login username Cookie support: Yes, see section 1.2.2 Default: (none) This specifies that listings should always return a certain user ownership for files. This hides the files original owner from ftp users. 1.1.2.20 "fileratios" directive Used in: group sections, only valid if ratios is set to 1 Syntax: fileratios [down:up] Examples: fileratios 2:1 # for every file the user uploads # allow 2 to be downloaded fileratios 1:5 # for every 5 bytes the user uploads # give 1 byte of credit. Cookie support: No Default: (none) This sets inital ratios on how many files a user must upload to how many credits they recieve for doing so. This will not override information in the ratio file. If no ratio file is specified, this is always used. 1.1.2.21 "fnaccess" directive Used in: group sections Syntax: fnaccess [PATTERN]:[MODE] Examples: fnaccess *.mp3:NONE # no access to files with mp3 # extension fnaccess *.o:NONE # no access to object files. fnaccess /home/%U/*:R # give read access to all files in # user home dir and subdirs Cookie support: Yes, see section 1.2.2. Default: (none) This specifies access setting using basic regular expressions. fnaccess setting have priority over regular access directives, so care must be exercised in the specifing fnaccess directives. Eg, access /:C access /home/mud/:LC fnaccess *.c:R will allow access to filenames /a.c or /home/a.c. Also, fnaccess directives are checked in the order they are specified in the config file, so fnaccess directives specified earilier have higher priority over fnaccess directives specified later. WARNING: when a symbolic link is encountered, muddleftpd will apply the fnaccess directives to the symbolic link only, not to the destination of the symbolic link. Users who can create symbolic links in the same areas they access with the ftp server will be able to easily circumvent the fnaccess directives. Therefore you MUST not depend on fnaccess being safe in groups where the user can create symbolic links in the same area as they can access via the ftp server. 1.1.2.22 "ftpport" directive Used in: either the main section or virtual server sections. If used in the main section when virtual servers are defined, then the declaration in the main section is ignored. Syntax: ftpport [PORTNUM] or ftpport [PORTNUM]:[IPADDR] Examples: ftpport 21 # bind to port 21, all interfaces ftpport 21:10.1.1.1 # bind to port 21, interface # on 10.1.1.1 only ftpport 4008 # bind to port 4008. Cookie support: No Default: (none), must be specified. This directive specifies what ports muddleftpd will listen for connections on. It may be specified more than once in the same section, where muddleftpd will listen for all specified ports. If you don't supply the ip of an interface to bind to, muddleftpd will listen on all ports. When setting up virtual servers, it is often done by using the same port, while using a different ip for the interface in each virtual server definition. 1.1.2.23 "fxpallow" directive Used in: group sections Syntax: fxpallow [VALUE] Examples: fxpallow 0 # disallow server-server transfers. fxpallow 1 # allow server-server transfers. Cookie support: Yes, see section 1.2.2. Default: fxpallow 0 This directive specifies whether users of a particular group can perform server to server transfers. It is highly recommended that you do not set this unless you really, really need to. Setting this to true allows users to send a file to an abitary port (above 1024) on any remote server. It also allows a third party to steal a passive connection from a user from any remote computer. 1.1.2.24 "gid" directive Used in: group sections Syntax: gid [VALUE or NAME] Examples: gid %g # set gid from users gid from authentication # module gid 10 # set users group to 10 gid ftpuser # set the users group to ftpuser. Cookie support: Yes, see section 1.2.2. Default: gid %g This specifies what gid a user connected to the server will use to access files. It can be specified using a group name or an integer group value. By default, the gid from the authentication module is used. If you set it to 0 (the root group), then muddleftpd will automaticly demote it to nobody's group. 1.1.2.25 "greeting" directive Used in: virtual server sections or the main section. If virtual servers are defined, any occurence in the main section is taken as the default for virtual servers. Syntax: greeting [STRING] Examples: greeting Welcome to %L # set greeting to display # server name Cookie support: Yes, see section 1.2.4 Default: greeting muddleftpd (1.3.4-devel) server ready. Enter Username. Sets the greeting line when a person connects to the server. This accepts all of the cookies the logindump file will accept. This is used to personalize your server and hide the server name, version from users. 1.1.2.26 "group" directive Used in: either the main section or virtual server sections. If used in the main section when virtual servers are defined, then the declarations in the main section are ignored. Syntax: group [SECTION] Examples: group badusers # set to check badusers section first group anonymous # set to check anonymous section next group users # set to check users section last or group badsites # check badsites section first group users # then users section next Cookie support: No Default: (none), must be specified. This directive sets the sections muddleftpd will check as groups when logging someone in to the server, or one of its virtual servers. The groups are checked in the same order as specified in the config file. Group sections are discussed in detail in section 1.0.3 1.1.2.27 "homedir" directive Used in: group sections Syntax: homedir [DIRECTORY] Examples: homedir / # set homedir to same as rootdir homedir %h # set homedir to homedir from # authentication module. Cookie support: Yes, see section 1.2.2. Default: homedir %h This directive describes the home directory a user logging in will have. It is ALWAYS relative to the rootdir. This is so users don't have homedir's outside of their root directory. By default, homedir is set by the authentication module. 1.1.2.28 "hostname" directive Used in: virtual server sections or the main section. If virtual servers are defined, any occurence in the main section is taken as the default for virtual servers. Syntax: hostname [STRING] Examples: hostname mud.serious.net # a hostname hostname hostname # another example Cookie support: No Default: (same as the hostname from /etc/HOSTNAME) This sets the hostname muddleftpd will report to users when they use the ftp server. It sets the %L cookie for files dumped to the user (see section 1.2.4). It also sets the %V cookie for group sections (see section 1.2.2) 1.1.2.29 "include" directive Used in: anywhere Syntax: include [SECTIONNAME] Examples: include asection # include section asection Cookie support: No Default: (none) This is a low level function that allows a section to be included into another section. No cookies are interpretted by include. An example: [section] a hostname v access /:ALL access /test/:NONE [section] b access /:NONE include a access /test/:ALL when section b is interpreted, will become access /:NONE hostname v access /:ALL access /test/:NONE access /test/:ALL Here, the included data is inserted in order, so you must be careful of the order the final result will be. In this example, the access to / is overriden by the data in the included section. 1.1.2.30 "initalbytes" directive Used in: group sections, only valid if ratios is set to 1, and byteratios is set (see 1.1.2.8) Syntax: initalbytes [64bit-INT] Examples: initalbytes 2000000 # give 2 meg of inital credits. initalbytes 0 # give 0 meg of credits initally. Cookie support: No Default: (none) This sets how many byte credits a user has initally when using ratios. If you have ratiofile defined, then this is only used for new users. Otherwise the setting will be read from the ratiofile. This is specified as a 64-bit integer (ie, can have virtually any size) 1.1.2.31 "initalfiles" directive Used in: group sections, only valid if ratios is set to 1, and fileratios is set (see 1.1.2.20) Syntax: initalfiles [COUNT] Examples: initalfiles 100 # give 100 inital file credits. initalfiles 0 # give 0 file credits initally. Cookie support: No Default: (none) This sets how many file credits a user has initally when using ratios. If you have ratiofile defined, then this is only used for new users. Otherwise the setting will be read from the ratiofile. 1.1.2.32 "ipacl" directive Used in: main, vserver and group sections Syntax: ipacl [A or D]/[IP]/[NETMASK] ipacl [A or D]/[IP-PATTERN] ipacl [A or D]/([HOST-PATTERN]) Examples: ipacl A/10.1.1.0/255.255.255.0 # allow 10.X.X.X ipacl A/127.* # allow localhost addresses ipacl A/(localhost) # allow hostname localhost ipacl A/(*.edu) # allow any .edu address ipacl D/(*.com.??) # disallow country .com Cookie support: No Default: ipacl D/* Ipacl is a generic way of declaring what IP address/hostnames have access to something. The first format above allows you to specify a range of IP's using an ip address and a netmask. The second format allows you to specify a range of IP's using a basic regular expressions. The third fromat allows you to sepecify a basic regular expression to match the user's hostname. You must be very careful when using regular expressions against hostnames. Users may spoof DNS and their hostname, allowing them to get accesss they otherwise shouldn't have. Ipacl's are checked in the order they are in the config file. The first ipacl to match the user's hostname or IP will decide the access of a particular user. The access a user will get is defined by the first character before ':', an 'A' will grant access, anything else will deny it. When used in the main section, ipacl controls who is given access to the server. If the user is not accepted by these controls, they are dumped from the server immediately. If virtual servers are defined, ipacl's in the virtual server section decide if the user is accepted into the server (after the main ones are checked). In group sections, ipacl controls if a user can login to that group after the user has entered a username/password. If the user is not accepted, muddleftpd will check the next group. 1.1.2.33 "logfile" directive Used in: virtual server sections or the main section. Syntax: logfile [FILENAME] Examples: logfile /var/log/ftpd.log # set logfile Cookie support: No Default: logfile /var/log/muddleftpd.log Sets the logfile for muddleftpd logs. This file must be an absolute filename. When defined in virtual server sections, muddleftpd will log information users using that virual server into that file instead of the main log file. The parameter to logfile must be an absolute filename. (ie start with /) 1.1.2.34 "logindump" directive Used in: virtual server sections or the main section. If virtual servers are defined, any occurence in the main section is taken as the default for virtual servers. Syntax: logindump [filename] Examples: logindump /etc/issue # print this before user logs in Cookie support: No Default: (none) When a new user connection to the server occurs, this is printed before the greeting (see section 1.1.2.25). All new users will see this file before they login using a username/password. 1.1.2.35 "logindumpdata" directive Used in: virtual server sections or the main section. If virtual servers are defined, any occurence in the main section is taken as the default for virtual servers. Syntax: logindumpdata [dump-string] Examples: logindumpdata Welcome/nThis server will allow %M users./n # print this when a user connects Cookie support: Yes, see 1.2.4 Default: (none) This command is exactly like logindump (1.1.2.32), except the actual data is stored in the config file instead of an external file. The format for [dump-string] is described in section 1.2.3. This directive overrides any logindump directives in the same section. 1.1.2.36 "logintries" directive Used in: virtual server sections or the main section. If virtual servers are defined, any occurence in the main section is taken as the default for virtual servers. Syntax: logintries [COUNT] Examples: logintries 10 # give 10 tries to login. logintries 1 # give only one try to login. Cookie support: No Default: logintries 3 This command limits the number of incorrect username/password combinations a connection can make before it is locked out. After this, any USER command the client will fail. This can slow down the brute forcing of passwords. 1.1.2.37 "logstrength" directive Used in: virtual server and main sections. Syntax: logstrength [VALUE] Examples: logstrength 63 # Log Everything logstrength 25 # Log bad connections, commands # resposes and generic info. Cookie support: No Default: logstrength 63 This command sets how much logging muddleftpd and/or its virtual servers will perform. It is a value created by adding up one or more of the following numbers: 1 Log connections that fail due to ipacl settings 2 Log file transfers (uploads, downloads, SITE DUMP) 4 Log command the client sends to the server. 8 Log responses to commands the client sends. 16 Log generic information, including config errors (highly recommended) 32 Log successful/unsuccessful logins and logouts of clients. So to log file transfers and generic information, use a setting of 18. 1.1.2.38 "maxconnectperip" directive Used in: virtual server sections or the main section. Syntax: maxconnectperip [COUNT] Examples: maxconnectperip 0 # set no limit maxconnectperip 2 # only 2 connections from the same # ip Cookie support: No Default: maxconnectperip This directive limits the number of logins from the same IP address to the server (or one of its virtual servers). This options will reduce the login performace of the server if it is running in standalone mode. If used in the main section, it sets the total number of connections from any one IP regardless of the virtual server the client is connected to. When used in virtual server sections, it will only affect conections to that single virtual server. 1.1.2.39 "maxspeed" directive Used in: group sections Syntax: maxspeed [BYTES-PER-SECOND] Examples: maxspeed 4096 # set max transfer speed to 4096 b/s maxspeed 1000000 # set max transfer speed to 1 Meg/sec Cookie support: Yes, see section 1.2.2. Default: (none) This directive specifies how fast a user may download/upload data at. This can be used to conserve bandwidth/annoy users. The value used is specified in bytes per second. Control port data is not affected by this command, so you may wish to also use the directive "sitecmdoff dump" when using this option. 1.1.2.40 "maxusers" directive Used in: main, vserver and group sections Syntax: maxusers [COUNT] Examples: maxusers 100 # set maximum users to 5 maxusers 0 # allow no users, hide group. Cookie support: No Default: maxusers 30 maxusers sets the maximum number of users for a server, a virtual server, or for a group. When used in the main section, maxusers will set the maximum number of users the server will allow in. Any connections that would exceed this count are immediately dropped, without any messages. When used in a virtual server section, maxusers will set the maximum number of users the server will allow to connect to that virtual server. As with the main section, connections that overflow that count will be dropped. In group sections, maxusers sets the maximum number of users that can login via that group. When that limit is reached, new connections will be given the busydump message and disconnected instead of quietly disconnected. When maxusers is set to 0 in a group section, that group will not be displayed in ftpwho listings. 1.1.2.41 "nameacl" directive Used in: group sections Syntax: nameacl [A or D]:[PATTERN] Examples: nameacl A:* # accept any username nameacl A:anonymous # accept only anonymous. nameacl D:root # deny username root. Cookie support: No Default: nameacl D:* This directive declares which usernames will be accepting when attempting to authenticate against a group. nameacl directives are checked in order, and the first one to match the username will determine the final result. If the final result is accept, than the username will continue to be authenticated against that group. If the final result is deny, muddleftpd will try the next group. 1.1.2.42 "nice" directive Used in: group sections Syntax: nice [VALUE] Examples: nice -20 # give very low priority nice 5 # give higher priority. Cookie support: Yes, see section 1.2.2. Default: nice 0 This directive sets the CPU priority of a user in a group after they have logged on. VALUE may be from -20 (highest priority) to 20 (lowest priority) with 0 being normal priority. Note that you cannot use negative values unless you run muddleftpd as root and runasuser isn't set. 1.1.2.43 "pfnaccess" directive Used in: group sections Syntax: pfnaccess [PATTERN]:[MODE] Examples: pfnaccess /b/*.mp3:NONE # no access to files with mp3 # extension in only the b dir pfnaccess /*.o:NONE # no access to object files in root # dir. pfnaccess /home/%U/*:R # give read access to all files in # user home dir and subdirs Cookie support: Yes, see section 1.2.2. Default: (none) This specifies access setting using basic regular expressions, however wildcard characters cannot match / characters, so only a single directory is affected. pfnaccess have lower priority to fnaccess, and higher priority to plain access. All the rules for fnaccess (see section 1.1.2.21) also apply to pfnaccess. 1.1.2.44 "quitdump" directive Used in: group sections Syntax: quitdump [filename] Examples: quitdump /etc/muddleftpd/BYEMSG # print this when user exits Cookie support: Yes, see 1.2.2 Default: (none) When a user quits muddleftpd, the data from the specified filename will be printed to the user as they leave. Section 1.2.4 documents cookies you can use in files specified with this directive. The file must given with a full path. 1.1.2.45 "quitdumpdata" directive Used in: group sections Syntax: quitdumpdata [dump-string] Examples: quitdumpdata Thank you/nYou downloaded %b bytes./n # print this when user exits Cookie support: Yes, see 1.2.4 Default: (none) This command is exactly like quitdump (1.1.2.40), except the actual data is stored in the config file instead of an external file. The format for [dump-string] is described in section 1.2.3. This overrides any quitdump directives in the same section. 1.1.2.46 "ratios" directive Used in: group sections. Syntax: ratios [0 or 1] Examples: ratios 1 # enable ratios. Cookie support: Yes, see section 1.2.2 Default: ratios 0 This directive specifies whether a user in a group will be subject to ratios. These ratios are specified by: byteratios (see section 1.1.2.8) fileratios (see section 1.1.2.20) initalbytes (see section 1.1.2.30) initalfiles (see section 1.1.2.31) ratiofile (see section 1.1.2.47) 1.1.2.47 "ratiofile" directive Used in: group sections, only valid if ratios is set to 1 Syntax: ratiofile [filename] Examples: ratiofile /etc/ratios ratiofile /home/rugger/ratios # location of persistant # ratios Cookie support: No Default: (none) This directive specifes that persistant ratios are to be used, and that ratio information will be stored in the given file. The given file must be specified with a full path (absolute path). This file will store what a users private ratios are and what credits (byte, file) they have. This file is in a binary format, and cannot be freely moved between differnent types of systems. Using persistant ratios also causes a signifcant performace drop in muddleftpd, since a lot of file access must occur to keep ratio data consistant. Make sure the ratio file is stored on a filesystem that isn't mounted syncronously (ie not write-back cache) otherwise performace will be terrible. 1.1.2.48 "rdnstimeout" directive Used in: main section Syntax: rdnstimeout [VALUE] Examples: rdnstimeout 0 # disable reverse lookup. rdnstimeout 10 # allow reverse lookup 10 seconds. Cookie support: No Default: rdnstimeout 15 rdnstimeout sets the amount of time muddleftpd will wait for reverse DNS lookups to occur. During this time, muddleftpd will be non-responsive. If set to 0, reverse DNS lookups will be disabled. If reverse DNS lookup fails or times out, muddleftpd will use the IP address of the host to identify it. 1.1.2.49 "realdir" directive Used in: group sections Syntax: realdir [0 or 1] Examples: realdir 0 # don't resolve symlinks. realdir 1 # resolve symlinks Cookie support: Yes, see section 1.2.2. Default: realdir 0 This specifies whether muddleftpd will attempt to resolve the real directory when a user changes to a new directory. If set, muddleftpd will resolve symlinks when changing directories if the resultant directory is within rootdir. If the user changes to a symlink that points outside of rootdir, muddleftpd will not resolve it to its real directory. 1.1.2.50 "rootdir" directive Used in: group sections Syntax: rootdir [DIRECTORY] Examples: rootdir / # set rootdir to system rootdir rootdir %r # set rootdir from auth module rootdir %h # set rootdir to users home # directory. Cookie support: Yes, see section 1.2.2. Default: rootdir %r This sets the root directory of a user in a group. rootdir must be specified with a full pathname. By default, rootdir is set by the authentication module. A user can only enter directories outside of rootdir with symlinks (use chroot to disable this). rootdir will appear to be "/" to the logged in user. 1.1.2.51 "runasuser" directive Used in: main section Syntax: runasuser [username] Examples: runasuser rugger # run as user rugger runasuser ftp # run as ftp user Cookie support: No Default: (none) runasuser instructs muddleftpd to switch to a new uid/gid specified by username after initalizing. This will prevent these things occuring in addition to things that don't work without root: 1) log rotation will not work. 2) data ports binding to port 20. 1.1.2.52 "sitecmdoff" directive Used in: group sections Syntax: sitecmdoff [CMD] Examples: sitecmdoff IDLE # disable site idle command. sitecmdoff DUMP # disable site dump command Cookie support: Yes, see 1.2.2 Default: (none) This directive selectivly disables FTP SITE commands. This can disable things like SITE ACCESS and SITE DUMP, that may improve security when using other commands. 1.1.2.53 "smartbind" directive Used in: main section Syntax: smartbind [0 or 1] Examples: smartbind 0 # use simple binding method smartbind 1 # use smart binding method Cookie support: No Default: smartbind 0 This directive instructs whether muddleftpd will take all the ports/IP's it needs to listen to and collate them to use fewer file descriptors. Set to 1 to use smart binding, 0 otherwise. For example: ftpport 21/10.1.1.1 ftpport 21/127.0.0.1 ftpport 21/10.1.1.2 With simple binding, muddleftpd will simply bind each port individually and use 3 file descriptors. With smart binding, muddleftpd will bind to all interfaces on port 21, using one file descriptor. However, connections from extra interfaces that are bound by smart binding will simply be dropped and other programs will not be able to use them. NOTE: You must set smartbind to 1 if you wish to bind to individual interfaces on most unix systems. On these unix systems, you must also set zerobind to 1 as well. 1.1.2.54 "supgid" directive Used in: group sections Syntax: supgid [SUP-GIDS] Examples: supgid %G,1 # add 1 to supgids supgid 1,2,3 # set supgids to 1, 2 and 3 supgid %G,!10 # set supgids to authentication # module, but remove group 10 supgid * # set no sup groups. Cookie support: Yes, see section 1.2.2. Default: supgid %G supgid supplies a comma separated list of supplementary groups a user will be in. Using * will cause no supplementary groups to be set. You can prefix a group number with "!" to remove any eariler occurences of that group number in the list. 1.1.2.55 "timeout" directive Used in: main, vserver and group sections Syntax: timeout [VALUE] Examples: timeout 15 # give 15 second timeout timeout 7200 # give 2 hour timeout Cookie support: Yes, but only in group sections, see section 1.2.2. Default: timeout 300 Timeout sets the amount of time the server will wait for a user response before disconnecting that user. If used in the main section or virtual server sections, timeout specifies the timeout while the user logs in. If used in a group section, it specifies the timeout after a user is logged into that group. 1.1.2.56 "uid" directive Used in: group sections Syntax: uid [VALUE or NAME] Examples: uid %u # set uid from users uid from authentication # module uid 10 # set users uid to 10 uid ftp # set the users uid to ftp. Cookie support: Yes, see section 1.2.2. Default: uid %u This directive specifies what user id a user will access/create files as. It can be speciifed either using an integer user id or a normal username. By default, the uid from the authentication module is used. If you set it to 0 (the root user), then muddleftpd will automaticly demote it to nobody's user id. 1.1.2.57 "umask" directive Used in: main, vserver and group sections Syntax: umask [OCTAL-VALUE] Examples: umask 777 # make new files with no permisions umask 666 # make new files with only execute # permissions if directories. umask 022 # make new files only writeable by # owner Cookie support: Yes, but only in group sections, see section 1.2.2. Default: (default system umask) This sets the umask used when users create files using the ftp server. When used in the main section, it sets the default for any virtual server or groups. When set in a virtual server section it sets the default for groups used by that virtual group. If used in a group section, it overrides any other setting. Umask is defined by an octal value. Users can change their umask using SITE UMASK unless the command is disabled or chmoding is set to 0. 1.1.2.58 "userjail" directive Used in: group sections Syntax: userjail [0 or 1] Examples: userjail 0 # User can relogin. userjail 1 # User cannot change username Cookie support: Yes, see section 1.2.2. Default: userjail 0 This specifies whether the user logged into a particular group can relogin as a different username without disconnecting. If set to 1, the user cannot relogin, otherwise the user will be able to use the USER command to login as a different username. This is automaticly set to 1 if droproot (see section 1.1.2.15) and/or chroot (see section 1.1.2.12) are set to 1, since not enough resources will be avaliable to change the users identity. 1.1.2.59 "vserver" directive Used in: main section. Syntax: vserver [SECTION] Examples: vserver internal # declare section internal as a # virtual server. vserver external # declare section external as a # virtual server. Cookie support: No Default: (none) This directive, if used in the main section, changes muddleftpd behaviour from being a regular server to a virtual server system. This directive is used to declare what sections in the config file are to be definitions for virtual server. By specifiing this directive multiple times in the main section, muddleftpd will declare multiple virtual servers. For more information on virtual server sections, see 1.0.2. If this directive is not used, muddleftpd assumes that main defines server information. 1.1.2.60 "welcome" directive Used in: group sections Syntax: welcome [filename] Examples: welcome /etc/muddleftpd/WELCOMEMSG # print this when user logs into a # group Cookie support: Yes, see 1.2.2 Default: (none) When a user logs into a group successfully, the data from the specified filename will be printed to the user. Section 1.2.4 documents cookies you can use in files specified with this directive. The file must given with a full path. 1.1.2.61 "welcomedumpdata" directive Used in: group sections Syntax: welcomedumpdata [dump-string] Examples: welcomedumpdata You have logged in/nThere are %N users./n # print this when user logs on. Cookie support: Yes, see 1.2.4 Default: (none) This command is exactly like welcome (see 1.1.2.60), except the actual data is stored in the config file instead of an external file. The format for [dump-string] is described in section 1.2.3. This overrides any quitdump directives in the same section. 1.1.2.62 "zerobind" directive Used in: main section, ignored if smartbind (see 1.1.2.53) is not set to 1 Syntax: zerobind [0 or 1] Examples: zerobind 0 # bind to individual interfaces zerobind 1 # always bind to all interfaces. Cookie support: No Default: zerobind 0 This is a compatiblity option for unix systems that don't support listening for connections on only one interface. If you have a BSD system, or muddleftpd is refusing to bind to the ports you specify, set zerobind and smartbind (see 1.1.2.53) to 1. 1.2 Misc references 1.2.1 Access modes [MODE] The directives that specify permissions for users when they access files are: access (see 1.1.2.1) fnaccess (see 1.1.2.21) pfnaccess (see 1.1.2.43) These require a mode string to specify what permissions a user has when a particular access line is matched. A mode string is a combination of one or more charaters, or: ALL - give all access permissions NONE - give no access permissions Letters that may make up a mode string: A - Create new filenames that don't already exist. R - Read files that already exist. L - List files (only for directories) X - Replace files that already exist. M - Create new directories. I - Remove existing directories. W - Write to existing files. H - Chmod existing files. C - allow to change to that directory. By combining these letters, any access level can be set. 1.2.2 Cookies in group sections. In group sections, cookies allow you to customize how information from the authentication module and the server is used to generate information about a new users session. Most commands valid in group sections support the use of these cookies: %U - The username the user gave the server. %v - The section name of the virtual server the user is logged into. Set to "main" if no virtual servers are defined. %V - The hostname of the virtual server the user is logged into. If no virtual servers are defined, this is set the the hostname provided by the main section, or by the machines hostname. %u - The uid of the user from the authentication module. %g - The gid of the user from the authentication module. %h - The home directory of the user from the authentication module. %r - The root directory of the user from the authentication module. %G - A comma delimited list of supplementary gids from the authentication module. Depending on the particular authentication module used, one or more of these cookies may not be set. See 2.0 for more information on authentication modules and what cookies are set by each individual one. Group directives where group section cookies are not supported: busydumpdata, byteratios, cddumpdata, fileratios, include, initalbytes, initalfiles, ipacl, maxusers, nameacl, quitdumpdata, ratiofile, welcomdumpdata. Group directives where group section cookies are avaliable, but only cookies not derived from the authentication module. authuser, and any directives which are used by the authentication module currently selected. 1.2.3 Specifing a string for busydumpdata, cddumpdata, welcomedumpdata and quitdumpdata. To use these directives, a string must be specified on a single line describing what to dump onto the screen. To get over the limitation, you can use control characters to perform tabs, insert spaces, and move to the next line. Note that all the control characters are specified with a / prefix, not a \. All uses of \ result in the following character being quoted exactly before the / are resolved: eg: \/\n is the same as /n and will be resolved to a newline. Control characters that are valid are: /n - Goto the next line. /s - Insert a space. You need this if you need spaces at the beginning or end of the directive. /t - Insert a tab. // - Insert a regular forward slash The strings specified for the dumpdata directives may also contain cookies specified in 1.2.4. Examples: cddumpdata You are now in %C/nYou have %a credits left would result in the following output (for chdir /) 250-You are now in / You have 1000000 credits left 250 "/" is the current directory. busydumpdata /s/s/sThe server is full./n Please try again later/nBye! would result in the following output (on login to a full group) 421- The server is full. Please try again later Bye! 421 Too many users. Cannot login. 1.2.4 Cookies in dumped files. When you specify a file to be dumped onto the screen, or set a string to be dumped on the screen, the following cookies can be inserted into that string or file to use information the server has internally: %T - current date and time %U - username of the user connecting. set to before login. %C - Current working directory, relitive to a user's root directory. Only avaliable after user is logged in. %E - The email address set in the configuration file. (See 1.1.2.14 for more info) %M - The maximum number of users that may exist in the current virtual server the user is connected to, or main server (before login) or maxiumun number of users a group can allow in. %N - The number of users currently in a group just after the user has logged in. It is not set before login. %L - The hostname of the server. Can be overridden. (see 1.1.2.28 for more information) %R - The hostname of the client obtained by reverse host lookup. %f - The number of files a user has downloaded. %F - The number of files a user has uploaded. %b - The number of bytes the user has downloaded in file transfers. %B - The number of bytes the user has uploaded in file transfers. %I - The number of bytes the user has downloaded in listings. %i - The number of listings the user has performed. %D - The total number of bytes the user has downloaded over data connections. %t - The total number of bytes the user has transfered over data connections (both upload and downloads) %c - The total number of data transfers the user has made. (for listing, downloads and uploads) %d - The total number of data transfers the user has made for downloading (listing and downloading) %v - The section name of the virtual server the user is connected to (or main if no virtual servers are declared) If the user is using ratios, the following are also avaliable. %a - The number of download byte credits a user has. %A - The number of download file credits a user has. 2.0 Authentication modules 2.0.1 Overview. Muddleftpd uses authentication modules to determine the following: - whether a user will be authenticated within a particular group. - is the username and password the user supplied correct. - what parameters are associated with that user (home directory, uid, gid, ...) Authentication modules under muddleftpd come in two flavours: - Static modules. These modules are already compiled into muddleftpd and can be accessed using a keyword for the authmethod. These modules are documented in 2.1 - Dynamic modules. These modules are not built with muddleftpd, but are dynamicly linked in while muddleftpd is authenticating an user. These are distributed separately from muddleftpd, and don't require muddleftpd to be recompiled to use. They can even be added while muddleftpd is still running. All modules are able to probe the configuration file for settings. They will often add several configuration options of their own, and the following cookies will work on them: %U - The username the user gave the server. %v - The section name of the virtual server the user is logged into. Set to "main" if no virtual servers are defined. %V - The hostname of the virtual server the user is logged into. If no virtual servers are defined, this is set the the hostname provided by the main section, or by the machines hostname. When a module has finished, the following cookies may be used on other options (see 1.2.2 for more info). Each individual module may or may provide information to set the following cookies: %u - The uid of the user. %g - The gid of the user. %h - The home directory of the user. %r - The root directory of the user. %G - A comma delimited list of supplementary gids for the user. You must check the documentation for the particular module you are going to use as to whether these options are set. 2.1 Static modules in muddleftpd The following modules are compiled into muddleftpd. 2.1.1 "unix" authentication module. This authentication module authenticates using the unix system passwords. It will automaticly detect shadow passwords and use them. It fully supports account and password expiry with shadow passwords. It requires root access to authenticate against shadow password files. To use this module in a group section, set the following directive: authmethod unix The following options may also be set in the same group section to configure the "unix" module: unix_passwdtype This forces what type of passwords are used by the module. If set to normal, shadow passwords will never be used. If set to shadow, normal passwords will never be acceped. All cookies described in 2.0 are set by the unix authentication module. The unix module will affect group selection by accepting any user found in the password file and authenticated them. If the user is not found in the password file, authentication will continue to the next group. Note: If muddleftpd is compiled when shadow passwords are not installed, and you wish to use shadow passwords, you will need to compile muddleftpd again after installing shadow passwords to enable the use of shadow passwords. 2.1.2 "anonymous" authentication module. The anonymous authentication module will authenticate users for anonymous access to the server. It will accept any username, using any password. It will log the password the user uses. The usernames this module will accept can be limited using the nameacl directive (see 1.1.2.41). Any users authenticated by this module will access files as user nobody in group nogroup. The module will set the users root directory to the home directory of the user "ftp". The users home directory will be set to /. To use this module in a group section, set the following directive: authmethod anonymous These directives can be used to tune the anonymous module: anonymous_user This changes the user muddleftpd probes to determine the root directory for the anonymous user. By default it is the user "ftp" This module will set all cookies described in 2.0 except for the suplementary groups cookie(%G) This module affects group selection by accepting all usernames presented to the module. You can limit what usernames it accepts by using the nameacl directive. However, if the username specified in anonymous_user (or "ftp" if anonymous_user isn't specified) cannot be read the module will cancel authentication. 2.1.3 "internal" authentication module. This module will use a separate password file in muddleftpd's own format to authenticate users. It is designed to provide password protection for authentication when users don't need an associated uid/gid. The password file consistes of one or more lines with the following format, one user per line. :: eg: rugger NvAdfesdaesEr:/home/rugger/:/ These password files may be modified using the external program mudpasswd. See mudpasswd.txt for more information on this program. To use the internal module, set the following directive in the relevent group section: authmethod internal The following directives may be set to configure the internal password module: internal_passfile This sets the path to the password file that the internal authentication module will read passwords and user info from. This file must be owned by the user running the server and must not be group or world writable, otherwise the module will refuse to use it. The internal authentication module will set the root directory (%r) and home directory (%h) cookies only. This module affects group selection by accepting any usernames defined in the given password file. If it isn't defined in the password file, the user is then passed onto the next group. If the password file cannot be loaded, or the password file is not safe, then authentication of the user is cancelled. Note: If the users in the separate password file map to the users in the main password file, and you want each user to use their own uid, you can set: uid %U to accomplish this. 2.1.4 "disabled" authentication module This built in module will cancel the authentication of anyone passed to the module. You need to use nameacl to restrict what usernames get canceled by this module. To use the disabled module in a group, use the following directive in that group: authmethod disabled This module does not set any of the cookies described in 2.0.1 This module affects group selection by canceling any username it is allowed to authenticate. 2.1.5 "pam" authentication module. This module allows muddleftpd to authenticate using PAM and PAM modules. This module also uses the password file to determine the session information the user will have. PAM is useful for systems where password encryption is not provided by regular crypt. To use the pam module, set the following directive in the relevent group sections: authmethod pam 3.0 FTP commands. 3.1 Non-site commands.muddleftpd-1.3.13.1/examples/0040755000175000017500000000000007751444665014730 5ustar joergjoergmuddleftpd-1.3.13.1/examples/mudlogd.conf0100644000175000017500000000033107544536576017227 0ustar joergjoerg # this is an example configuration of mudlogd [section] logger # log to /var/log/muddleftpd.log logfile /var/log/muddleftpd.log # communicate to muddleftpd using this fifoname /etc/muddleftpd/muddleftpd.fifo muddleftpd-1.3.13.1/examples/README0100644000175000017500000000255007544536576015612 0ustar joergjoergMUDDLEFTPD EXAMPLE CONFIGURATIONS There are a couple of example configurations included in this directory: standard.conf : This file contains a usable configuration for muddleftpd. It is very similar to the setup of an original system, and prevents root logins. It is a good place to start when configuring your system. It locks users into their home dir too. anon-only.conf : This file contains an anonymous only setup that does not allow user logins. If you want to set such a server up, this is a good place to start. It maps all usernames to the anonymous user. anon-region.conf : This configuration demonstrates how to set up muddleftpd to choose a group for a user given the host they arrived from. vserver.conf : This configuration shows how vservers are configured in muddleftpd. vserverbig.conf : This is a configuration that shows muddleftpd using 150 virtual servers, and the include directive. It actually runs fine on my computer. ratios.conf : This is showing how a theoretical mp3 server could be set up, showing off the latest features muddleftpd offers, like ratios, download speed limiters, and advanced ACL's verser-host.conf : This demonstrates the new single ip based virtual server setup. mudlogd.conf : This configuration is an example for the mudlogd program. muddleftpd-1.3.13.1/examples/anon-only.conf0100644000175000017500000000403507544536576017513 0ustar joergjoerg#---------------------------------------------------------- # This is the main server configuration [section] main # allow connections from port 21 ftpport 21 # set maximum users to 200 maxusers 200 # log everything execpt debugging logs logstrength 63 # set logfile logfile /var/log/anon-ftpd.log # set default timeout to 300 seconds timeout 300 # set the file displayed on login logindump /etc/issue.ftp # allow anyhost to connect ipacl A:* # set admin email address email user@hostname # set groups to run through. Only need one in anonymous set up group anonymous # set scratchfile for inetd operation scratchfile /var/lock/muddleftpd.scratch # set hostname of the server hostname testserver #---------------------------------------------------------- # This configures the anonymous user # Note: if the following doesn't work, then your computer # needs the ftp user to be set. [section] anonymous # tell the server to accept people from any hostname ipacl A:* # tell the server to accept any username for this group nameacl A:* # tell the server to use chroot to the anonymous rootdir chroot 1 # tell the server to use the ftp user as the anonymous rootdir # and uid/gid authparams ftp # tell the server to use the anonymous authenticator, and # accept any password. authmethod anonymous # disallow any changes to file permissions or upload umask chmoding 0 # print out this file when the user logs in. It is not relative # to anonymous's rootdir welcome /home/ftp/welcome.msg # display this file when a user changes into a new directory cddump .message # display this file when too many users are logged on busydump /etc/msgs/msg.toomany # set the umask files are uploaded with umask 077 # give anonymous user read/list access everywhere and add/list access # to the incoming folder. The / on the end of the second directive # tells muddleftpd to apply ACL to a directory rather than a file. access /:RLC # uncomment the following line to allow uploads of file to the # /incoming dir # access /incoming/:ALC muddleftpd-1.3.13.1/examples/anon-reigon.conf0100644000175000017500000000704607544536576020022 0ustar joergjoerg#---------------------------------------------------------- # This is the main server configuration [section] main # allow connections from port 21 ftpport 21 # set maximum users to 200 maxusers 200 # log everything execpt debugging logs logstrength 63 # set logfile logfile /var/log/anon-ftpd.log # set default timeout to 300 seconds timeout 300 # set the file displayed on login logindump /etc/issue.ftp # allow anyhost to connect ipacl A:* # set admin email address email user@hostname # set groups to run through. one group is for users in edu domains, # the other for normal anonymous users group anonymous-edu group anonymous-normal # set scratchfile for inetd operation scratchfile /var/lock/muddleftpd.scratch # set the greeting greeting Welcome. Enter a username. #---------------------------------------------------------- # This configures the anonymous user for edu domains # Note: if the following doesn't work, then your computer # needs the ftp user to be set. [section] anonymous-edu # tell the group that is can accept any user that ends in .edu or # with .edu. and a two letter country code ipacl A:(*.edu) ipacl A:(*.edu.??) # tell the server to accept any username for this group nameacl A:* # tell the server to use chroot to the anonymous rootdir chroot 1 # tell the server to use the ftp user as the anonymous rootdir # and uid/gid authparams ftp # tell the server to use the anonymous authenticator, and # accept any password. authmethod anonymous # disallow any changes to file permissions or upload umask chmoding 0 # print out this file when the user logs in. It is not relative # to anonymous's rootdir welcome /home/ftp/welcome.msg # display this file when a user changes into a new directory cddump .message # display this file when too many users are logged on busydump /etc/msgs/msg.toomany # set the umask files are uploaded with umask 077 # give anonymous user read/list access everywhere and add/list access # to the incoming folder. The / on the end of the second directive # tells muddleftpd to apply ACL to a directory rather than a file. access /:RLC access /incoming/:ALC #---------------------------------------------------------- # This configures the anonymous user or other areas. It is more # restrictive than edu configuration # Note: if the following doesn't work, then your computer # needs the ftp user to be set. [section] anonymous-normal # tell the group that it can accept any host that the last group # didn't get ipacl A:* # tell the server to accept any username for this group nameacl A:* # tell the server to use chroot to the anonymous rootdir chroot 1 # tell the server to use the ftp user as the anonymous rootdir # and uid/gid authparams ftp # tell the server to use the anonymous authenticator, and # accept any password. authmethod anonymous # disallow any changes to file permissions or upload umask chmoding 0 # print out this file when the user logs in. It is not relative # to anonymous's rootdir welcome /home/ftp/welcome.msg # display this file when a user changes into a new directory cddump .message # display this file when too many users are logged on busydump /etc/msgs/msg.toomany # set the umask files are uploaded with umask 077 # give anonymous user read/list access everywhere. No upload access # for non-edu anonymous users. access /:RLC # set this group to allow a maximum of 20 users. Keeps the server # free maxusers 20 # for this group, have all sessions reniced to 15 so that other # users have more priority nice 15 muddleftpd-1.3.13.1/examples/ratios.conf0100644000175000017500000000572707544536576017113 0ustar joergjoerg#---------------------------------------------------------- # This is the main server configuration. This configuration # shows the use of ratios and bandwith limiters. [section] main # allow connections from port 21 ftpport 21 # set maximum users to 200 maxusers 200 # log everything execpt debugging logs logstrength 63 # set logfile logfile /var/log/muddleftpd.log # set default timeout to 300 seconds timeout 300 # set the file displayed on login logindump /etc/issue.ftp # allow anyhost to connect ipacl A:* # set admin email address email user@hostname # set groups to run through. one group is to catch invalid usernames # like root and uucp. The next catches anyone else and sees if they # are a person that has a ratio. group badusers group ratiogroup # set scratchfile for inetd operation scratchfile /var/lock/muddleftpd.scratch # set hostname to something reasonable hostname testserver # set the greeting greeting Welcome to the ratio Test server. #---------------------------------------------------------- # This configures badusers. It catches any bad usernames that # should not be logged into [section] badusers # tell it to accept the usernames root, uucp and news nameacl A:root nameacl A:uucp nameacl A:news # accept these usernames from any host. ipacl A:* # tell the server these usernames are disabled authmethod disabled # set the maxuser count of this group to 0 so it isn't # added to the stats maxusers 0 #---------------------------------------------------------- # This configures the users that will use ratios. [section] ratiogroup # tell the group that it can accept any host that the last group # didn't get ipacl A:* # tell the server to accept any username for this group nameacl A:* # tell the server to use chroot to the user's rootdir. Also # drop root privledges. chroot 1 droproot 1 # set the root directory to /home/mp3s rootdir /home/mp3s # set the users homedir to /, so he ends up in his own homedir homedir / # tell the server to use the unix authenticator, useful against # normal password files authmethod unix uid mp3 gid mp3 # only allow users to list and change directories. access /:LC # the first option only lets users upload mp3's to the upload # directory. The second allows downloads of mp3 from anywhere else. fnaccess /upload/*.mp3:A fnaccess *.mp3:R # now set ratios up. Give no credits to start off with. Setup # so user gets 5 files for 1 upload and 10 bytes for every byte # uploaded ratios 1 ratiofile /etc/ratios fileratios 5:1 byteratios 10:1 initalbytes 0 initalfiles 0 # now set up file download/upload limits to 16K per second per # connection. maxspeed 16384 # now specify a line showing ratios whenever a user chdir's cddumpdata You have %A file credits/nYou have %a byte credits quitdumpdata You have downloaded %f file for %b bytes/nYou have uploaded %F files for %B bytes./nYou have %A file credits./nYou have %a byte credits./n/nThank you for using this archive./n muddleftpd-1.3.13.1/examples/standard.conf0100644000175000017500000000714107544536576017402 0ustar joergjoerg#---------------------------------------------------------- # This is the main server configuration [section] main # allow connections from port 21 ftpport 21 # set maximum users to 200 maxusers 200 # log everything execpt debugging logs logstrength 63 # set logfile logfile /var/log/muddleftpd.log # set default timeout to 300 seconds timeout 300 # set the file displayed on login logindump /etc/issue.ftp # allow anyhost to connect ipacl A:* # set admin email address email user@hostname # set groups to run through. one group is to catch invalid usernames # like root and uucp. The next catches anonymous users, the last one # for normal users group badusers group anonymous group localusers # set scratchfile for inetd operation scratchfile /var/lock/muddleftpd.scratch # set hostname to something reasonable hostname testserver # set the greeting greeting Welcome. Enter a username. Use 'anonymous' to access software archive. #---------------------------------------------------------- # This configures badusers. It catches any bad usernames that # should not be logged into [section] badusers # tell it to accept the usernames root, uucp and news nameacl A:root nameacl A:uucp nameacl A:news # accept these usernames from any host. ipacl A:* # tell the server these usernames are disabled authmethod disabled # set the maxuser count of this group to 0 so it isn't # added to the stats maxusers 0 #---------------------------------------------------------- # This configures the anonymous user. # Note: if the following doesn't work, then your computer # needs the ftp user to be set. [section] anonymous # tell the group that is can accept any host ipacl A:* # tell the server to accept anonymous or ftp for this group nameacl A:anonymous nameacl A:ftp # tell the server to use chroot to the anonymous rootdir chroot 1 # tell the server to use the ftp user as the anonymous rootdir # and uid/gid authparams ftp # tell the server to use the anonymous authenticator, and # accept any password. authmethod anonymous # disallow any changes to file permissions or upload umask chmoding 0 # print out this file when the user logs in. It is not relative # to anonymous's rootdir welcome /home/ftp/welcome.msg # display this file when a user changes into a new directory cddump .message # display this file when too many users are logged on busydump /etc/msgs/msg.toomany # set the umask files are uploaded with umask 077 # give anonymous user read/list access everywhere and add/list access # to the incoming folder. The / on the end of the second directive # tells muddleftpd to apply ACL to a directory rather than a file. access /:RLC # uncomment this line to enable upload area. Can only add files. # access /incoming/:ALC # limit the size of this group so localusers can log in too maxusers 100 # set the niceness of anonymous users to 10 nice 10 #---------------------------------------------------------- # This configures the normal users. [section] localusers # tell the group that it can accept any host that the last group # didn't get ipacl A:* # tell the server to accept any username for this group nameacl A:* # tell the server to use chroot to the user's rootdir chroot 1 # set the users rootdir to their homedir, to lock them in there rootdir %h # set the users homedir to /, so he ends up in his own homedir homedir / # tell the server to use the unix authenticator, useful against # normal password files authmethod unix # give normal users full access to their userspace access /:ALL # allow server-server transfers with localusers fxpallow 1 muddleftpd-1.3.13.1/examples/vserver-host.conf0100644000175000017500000001124607544536576020252 0ustar joergjoerg#---------------------------------------------------------- # This is the main server configuration [section] main # allow connections from port 21 ftpport 21 # set maximum users to 200 maxusers 200 # log everything execpt debugging logs logstrength 63 # set logfile logfile /var/log/muddleftpd.log # set default timeout to 300 seconds timeout 300 # set the file displayed on login logindump /etc/issue.ftp # allow anyhost to connect ipacl A:* # set admin email address email user@hostname # set scratchfile for inetd operation scratchfile /var/lock/muddleftpd.scratch # set the list of vserver muddleftpd is to use vserver external vserver internal # tell the server to use virtual servers on single ip, and use main section # to get what ports to listen to vserverhost 1 # set the default virtual server if the user does not supply one vserverdefault external # set the port to listen to connections on ftpport 21 # set the server to use smartbind, which can significantly reduce # the number of file descriptors needed by the server smartbind 1 #---------------------------------------------------------- # This configures vserver external. This handles users from # outside. [section] external # accept users from anywhere ipacl A:* # set the groups this vserver will run through. Since the external # vserver is only for connections from outside, only allow anonymous # logins group anonymous # Set an approprate login greeting Anonymous FTPD ready. Enter 'anonymous' as username. # Set maxusers to 50 to pervent external users flooding server maxusers 50 # set the hostname to what we want hostname external.somewhere.net #---------------------------------------------------------- # This configures vserver internal. This handles users from # the internal network [section] external # allow users from local network only ipacl A:10.1.1.0/255.255.255.0 ipacl A:127.0.0.1/255.255.255.255 # set the groups this vserver will run through. group badusers group anonymous group localusers # set the hostname to what we want hostname internal.somewhere.net #---------------------------------------------------------- # This configures badusers. It catches any bad usernames that # should not be logged into [section] badusers # tell it to accept the usernames root, uucp and news nameacl A:root nameacl A:uucp nameacl A:news # accept these usernames from any host. ipacl A:* # tell the server these usernames are disabled authmethod disabled # set the maxuser count of this group to 0 so it isn't # added to the stats maxusers 0 #---------------------------------------------------------- # This configures the anonymous user. # Note: if the following doesn't work, then your computer # needs the ftp user to be set. [section] anonymous # tell the group that is can accept any host ipacl A:* # tell the server to accept anonymous or ftp for this group nameacl A:anonymous nameacl A:ftp # tell the server to use chroot to the anonymous rootdir chroot 1 # tell the server to use the ftp user as the anonymous rootdir # and uid/gid authparams ftp # tell the server to use the anonymous authenticator, and # accept any password. authmethod anonymous # disallow any changes to file permissions or upload umask chmoding 0 # print out this file when the user logs in. It is not relative # to anonymous's rootdir welcome /home/ftp/welcome.msg # display this file when a user changes into a new directory cddump .message # display this file when too many users are logged on busydump /etc/msgs/msg.toomany # set the umask files are uploaded with umask 077 # give anonymous user read/list access everywhere and add/list access # to the incoming folder. The / on the end of the second directive # tells muddleftpd to apply ACL to a directory rather than a file. access /:RLC access /incoming/:ALC # limit the size of this group so localusers can log in too maxusers 100 # set the niceness of anonymous users to 10 nice 10 #---------------------------------------------------------- # This configures the normal users. [section] localusers # tell the group that it can accept any host that the last group # didn't get ipacl A:* # tell the server to accept any username for this group nameacl A:* # tell the server to use chroot to the user's rootdir chroot 1 # set the users rootdir to their homedir, to lock them in there rootdir %h # set the users homedir to /, so he ends up in his own homedir homedir / # tell the server to use the unix authenticator, useful against # normal password files authmethod unix # give normal users full access to their userspace access /:ALL # allow server-server transfers with localusers fxpallow 1 muddleftpd-1.3.13.1/examples/vserver.conf0100644000175000017500000001133607544536576017277 0ustar joergjoerg#---------------------------------------------------------- # This is the main server configuration [section] main # allow connections from port 21 ftpport 21 # set maximum users to 200 maxusers 200 # log everything execpt debugging logs logstrength 63 # set logfile logfile /var/log/muddleftpd.log # set default timeout to 300 seconds timeout 300 # set the file displayed on login logindump /etc/issue.ftp # allow anyhost to connect ipacl A:* # set admin email address email user@hostname # set scratchfile for inetd operation scratchfile /var/lock/muddleftpd.scratch # set the list of vserver muddleftpd is to use vserver external vserver internal # set the server to use smartbind, which can significantly reduce # the number of file descriptors needed by the server smartbind 1 #---------------------------------------------------------- # This configures vserver external. This handles users from # outside. [section] external # accept users from anywhere ipacl A:* # this vserver will bind to port 21. It can be told to bind to # a specific device using ftpport 21/ # eg ftpport 21/10.1.1.1 ftpport 21 # set the groups this vserver will run through. Since the external # vserver is only for connections from outside, only allow anonymous # logins group anonymous # Set an approprate login greeting Anonymous FTPD ready. Enter 'anonymous' as username. # Set maxusers to 50 to pervent external users flooding server maxusers 50 # set the hostname to what we want hostname external.somewhere.net #---------------------------------------------------------- # This configures vserver internal. This handles users from # the internal network [section] external # allow users from local network only ipacl A:10.1.1.0/255.255.255.0 ipacl A:127.0.0.1/255.255.255.255 # this vserver will bind to port 2100. It can be told to bind to # a specific device using ftpport 2100/ # eg ftpport 2100/10.1.1.1 ftpport 2100 # set the groups this vserver will run through. group badusers group anonymous group localusers # set the hostname to what we want hostname internal.somewhere.net #---------------------------------------------------------- # This configures badusers. It catches any bad usernames that # should not be logged into [section] badusers # tell it to accept the usernames root, uucp and news nameacl A:root nameacl A:uucp nameacl A:news # accept these usernames from any host. ipacl A:* # tell the server these usernames are disabled authmethod disabled # set the maxuser count of this group to 0 so it isn't # added to the stats maxusers 0 #---------------------------------------------------------- # This configures the anonymous user. # Note: if the following doesn't work, then your computer # needs the ftp user to be set. [section] anonymous # tell the group that is can accept any host ipacl A:* # tell the server to accept anonymous or ftp for this group nameacl A:anonymous nameacl A:ftp # tell the server to use chroot to the anonymous rootdir chroot 1 # tell the server to use the ftp user as the anonymous rootdir # and uid/gid authparams ftp # tell the server to use the anonymous authenticator, and # accept any password. authmethod anonymous # disallow any changes to file permissions or upload umask chmoding 0 # print out this file when the user logs in. It is not relative # to anonymous's rootdir welcome /home/ftp/welcome.msg # display this file when a user changes into a new directory cddump .message # display this file when too many users are logged on busydump /etc/msgs/msg.toomany # set the umask files are uploaded with umask 077 # give anonymous user read/list access everywhere and add/list access # to the incoming folder. The / on the end of the second directive # tells muddleftpd to apply ACL to a directory rather than a file. access /:RLC access /incoming/:ALC # limit the size of this group so localusers can log in too maxusers 100 # set the niceness of anonymous users to 10 nice 10 #---------------------------------------------------------- # This configures the normal users. [section] localusers # tell the group that it can accept any host that the last group # didn't get ipacl A:* # tell the server to accept any username for this group nameacl A:* # tell the server to use chroot to the user's rootdir chroot 1 # set the users rootdir to their homedir, to lock them in there rootdir %h # set the users homedir to /, so he ends up in his own homedir homedir / # tell the server to use the unix authenticator, useful against # normal password files authmethod unix # give normal users full access to their userspace access /:ALL # allow server-server transfers with localusers fxpallow 1 muddleftpd-1.3.13.1/examples/vserverbig.conf0100644000175000017500000004563207544536576017767 0ustar joergjoerg#---------------------------------------------------------- # this config file shows off muddleftpd running with 150 # virtual servers. It isn't really practical, it just shows # what can be done. It also uses includes [section] main # allow connections from port 21 ftpport 21 # set maximum users to 200 maxusers 200 # log everything execpt debugging logs logstrength 63 # set logfile logfile /var/log/muddleftpd.log # set default timeout to 300 seconds timeout 300 # set the file displayed on login logindump /etc/issue.ftp # allow anyhost to connect ipacl A:* # set admin email address email user@hostname # set scratchfile for inetd operation scratchfile /var/lock/muddleftpd.scratch # set the list of vserver muddleftpd is to use vserver a1 vserver a2 vserver a3 vserver a4 vserver a5 vserver a6 vserver a7 vserver a8 vserver a9 vserver a10 vserver a11 vserver a12 vserver a13 vserver a14 vserver a15 vserver a16 vserver a17 vserver a18 vserver a19 vserver a20 vserver a21 vserver a22 vserver a23 vserver a24 vserver a25 vserver a26 vserver a27 vserver a28 vserver a29 vserver a30 vserver a31 vserver a32 vserver a33 vserver a34 vserver a35 vserver a36 vserver a37 vserver a38 vserver a39 vserver a40 vserver a41 vserver a42 vserver a43 vserver a44 vserver a45 vserver a46 vserver a47 vserver a48 vserver a49 vserver a50 vserver a51 vserver a52 vserver a53 vserver a54 vserver a55 vserver a56 vserver a57 vserver a58 vserver a59 vserver a60 vserver a61 vserver a62 vserver a63 vserver a64 vserver a65 vserver a66 vserver a67 vserver a68 vserver a69 vserver a70 vserver a71 vserver a72 vserver a73 vserver a74 vserver a75 vserver a76 vserver a77 vserver a78 vserver a79 vserver a80 vserver a81 vserver a82 vserver a83 vserver a84 vserver a85 vserver a86 vserver a87 vserver a88 vserver a89 vserver a90 vserver a91 vserver a92 vserver a93 vserver a94 vserver a95 vserver a96 vserver a97 vserver a98 vserver a99 vserver a100 vserver b1 vserver b2 vserver b3 vserver b4 vserver b5 vserver b6 vserver b7 vserver b8 vserver b9 vserver b10 vserver b11 vserver b12 vserver b13 vserver b14 vserver b15 vserver b16 vserver b17 vserver b18 vserver b19 vserver b20 vserver b21 vserver b22 vserver b23 vserver b24 vserver b25 vserver b26 vserver b27 vserver b28 vserver b29 vserver b30 vserver b31 vserver b32 vserver b33 vserver b34 vserver b35 vserver b36 vserver b37 vserver b38 vserver b39 vserver b40 # set the server to use smartbind, which can significantly reduce # the number of file descriptors needed by the server smartbind 1 greeting Welcome to %V (%v). Enter username to continue. #---------------------------------------------------------- # This is a simple template for each virtual server. [section] vserver_template ipacl A:* group badusers group anonymous group realusers maxusers 100 #---------------------------------------------------------- # This is the virtual server diffinitions [section] a1 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.50 [section] a2 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.51 [section] a3 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.52 [section] a4 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.53 [section] a5 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.54 [section] a6 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.55 [section] a7 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.56 [section] a8 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.57 [section] a9 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.58 [section] a10 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.59 [section] a11 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.60 [section] a12 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.61 [section] a13 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.62 [section] a14 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.63 [section] a15 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.64 [section] a16 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.65 [section] a17 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.66 [section] a18 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.67 [section] a19 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.68 [section] a20 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.69 [section] a21 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.70 [section] a22 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.71 [section] a23 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.72 [section] a24 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.73 [section] a25 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.74 [section] a26 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.75 [section] a27 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.76 [section] a28 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.77 [section] a29 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.78 [section] a30 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.79 [section] a31 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.80 [section] a32 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.81 [section] a33 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.82 [section] a34 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.83 [section] a35 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.84 [section] a36 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.85 [section] a37 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.86 [section] a38 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.87 [section] a39 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.88 [section] a40 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.89 [section] a41 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.90 [section] a42 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.91 [section] a43 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.92 [section] a44 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.93 [section] a45 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.94 [section] a46 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.95 [section] a47 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.96 [section] a48 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.97 [section] a49 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.98 [section] a50 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.99 [section] a51 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.100 [section] a52 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.101 [section] a53 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.102 [section] a54 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.103 [section] a55 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.104 [section] a56 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.105 [section] a57 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.106 [section] a58 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.107 [section] a59 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.108 [section] a60 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.109 [section] a61 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.110 [section] a62 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.111 [section] a63 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.112 [section] a64 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.113 [section] a65 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.114 [section] a66 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.115 [section] a67 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.116 [section] a68 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.117 [section] a69 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.118 [section] a70 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.119 [section] a71 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.120 [section] a72 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.121 [section] a73 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.122 [section] a74 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.123 [section] a75 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.124 [section] a76 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.125 [section] a77 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.126 [section] a78 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.127 [section] a79 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.128 [section] a80 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.129 [section] a81 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.130 [section] a82 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.131 [section] a83 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.132 [section] a84 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.133 [section] a85 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.134 [section] a86 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.135 [section] a87 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.136 [section] a88 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.137 [section] a89 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.138 [section] a90 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.139 [section] a91 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.140 [section] a92 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.141 [section] a93 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.142 [section] a94 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.143 [section] a95 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.144 [section] a96 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.145 [section] a97 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.146 [section] a98 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.147 [section] a99 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.148 [section] a100 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.149 [section] b1 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.150 [section] b2 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.151 [section] b3 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.152 [section] b4 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.153 [section] b5 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.154 [section] b6 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.155 [section] b7 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.156 [section] b8 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.157 [section] b9 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.158 [section] b10 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.159 [section] b11 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.160 [section] b12 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.161 [section] b13 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.162 [section] b14 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.163 [section] b15 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.164 [section] b16 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.165 [section] b17 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.166 [section] b18 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.167 [section] b19 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.168 [section] b20 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.169 [section] b21 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.170 [section] b22 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.171 [section] b23 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.172 [section] b24 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.173 [section] b25 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.174 [section] b26 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.175 [section] b27 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.176 [section] b28 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.177 [section] b29 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.178 [section] b30 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.179 [section] b31 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.180 [section] b32 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.181 [section] b33 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.182 [section] b34 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.183 [section] b35 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.184 [section] b36 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.185 [section] b37 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.186 [section] b38 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.187 [section] b39 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.188 [section] b40 include vserver_template hostname external.somewhere.net ftpport 21/10.1.1.189 #---------------------------------------------------------- # This configures badusers. It catches any bad usernames that # should not be logged into [section] badusers # tell it to accept the usernames root, uucp and news nameacl A:realuser-root nameacl A:realuser-uucp nameacl A:realuser-news # accept these usernames from any host. ipacl A:* # tell the server these usernames are disabled authmethod disabled # set the maxuser count of this group to 0 so it isn't # added to the stats maxusers 0 #---------------------------------------------------------- # This configures the anonymous user. # Note: if the following doesn't work, then your computer # needs the ftp user to be set. [section] anonymous # tell the group that is can accept any host ipacl A:* # tell the server to accept anonymous or ftp for this group nameacl A:anonymous nameacl A:ftp # tell the server to use chroot to the anonymous rootdir chroot 1 # tell the server to use the ftp user as the anonymous rootdir # and uid/gid authparams ftp # tell the server to use the anonymous authenticator, and # accept any password. authmethod anonymous # use rootdir with vserver component rootdir %r/%v # disallow any changes to file permissions or upload umask chmoding 0 # print out this file when the user logs in. It is not relative # to anonymous's rootdir welcome /home/ftp/welcome.msg # display this file when a user changes into a new directory cddump .message # display this file when too many users are logged on busydump /etc/msgs/msg.toomany # set the umask files are uploaded with umask 077 # give anonymous user read/list access everywhere and add/list access # to the incoming folder. The / on the end of the second directive # tells muddleftpd to apply ACL to a directory rather than a file. access /:RLC access /incoming/:ALC # limit the size of this group so localusers can log in too maxusers 100 # set the niceness of anonymous users to 10 nice 10 #---------------------------------------------------------- # This configures the normal users. [section] realusers # tell the group that it can accept any host that the last group # didn't get ipacl A:* # tell the server to accept any username for this group nameacl A:realuser-* # tell the server to use chroot to the user's rootdir chroot 1 # set the users rootdir to their homedir, to lock them in there rootdir %h # set the users homedir to /, so he ends up in his own homedir homedir / # tell the server to use the unix authenticator, useful against # normal password files authuser %(9,100)U authmethod unix # give normal users full access to their userspace access /:ALL # allow server-server transfers with localusers fxpallow 1 muddleftpd-1.3.13.1/modules/0040755000175000017500000000000007751444665014562 5ustar joergjoergmuddleftpd-1.3.13.1/modules/auth/0040755000175000017500000000000007751444665015523 5ustar joergjoergmuddleftpd-1.3.13.1/modules/auth/authlibexample/0040755000175000017500000000000007751444672020525 5ustar joergjoergmuddleftpd-1.3.13.1/modules/auth/authlibexample/Makefile.in0100644000175000017500000000122107751443715022560 0ustar joergjoerg DEFS=@DEFS@ CFLAGS=@CFLAGS@ CC=@CC@ LIBS=@LIBS@ SRC=authunix.c OBJ=$(SRC:.c=.o) prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@/muddleftpd LIBNAME=libauthunix.so DOCDIR=@datadir@ all: $(OBJ) $(CC) $(CFLAGS) $(LIBS) -shared -fPIC -Xlinker -x -o $(LIBNAME) $(OBJ) clean: rm -fr autom4te.cache rm -f *.o *~ DEADJOE $(LIBNAME) install: all mkdir -p $(libdir) mkdir -p $(DOCDIR)/doc/muddleftpd install README -m 644 $(DOCDIR)/doc/muddleftpd/README.authexample install $(LIBNAME) -m 644 $(libdir) distclean: clean rm -f config.h Makefile config.log config.cache config.status maintainer-clean: distclean rm -f configure config.h.in muddleftpd-1.3.13.1/modules/auth/authlibexample/CHANGES0100644000175000017500000000014307554515351021505 0ustar joergjoergVersion 0.2 * Updated interfaces and code for muddleftpd 1.3.4. Version 0.1 * Inital release. muddleftpd-1.3.13.1/modules/auth/authlibexample/COPYING0100644000175000017500000000022607554772745021563 0ustar joergjoergWritten by Beau Kuiper Use, modification and distribution is allowed without limitation, warranty, or liability of any kind. muddleftpd-1.3.13.1/modules/auth/authlibexample/authunix.c0100644000175000017500000000641707554515351022535 0ustar joergjoerg/* Written by Beau Kuiper Use, modification and distribution is allowed without limitation, warranty, or liability of any kind. */ #include "config.h" #include "auth.h" #include #include #include #ifdef HAVE_GETSPNAM #include #endif /* This file contains code to autheticate against unix password files */ typedef struct { struct passwd *passent; #ifdef HAVE_GETSPNAM struct spwd *sppassent; #endif } PASSWDSTRUCT; int getday(void) { time_t currenttime = time(NULL); struct tm *currenttm = localtime(¤ttime); int yeardif = currenttm->tm_year - 70; int days; days = yeardif * 365 + currenttm->tm_yday; /* THIS STUFF IS Y2K COMPLIANT */ days += (yeardif + 1) / 4; /* I don't ever expect this code to be used beyond 2100, but so did too many cobol programmers in the 1970's !! */ if (currenttm->tm_year > 200) /* simple algorithm */ { yeardif -= 31; days -= (yeardif) / 100; /* take centaries off */ days += (yeardif) / 400; /* add on 400 year leapyears */ } return(days); } void *gethandle(void *peer, void *tset, char *username, int *err) { PASSWDSTRUCT *newhandle; char *passwdmode; newhandle = mallocwrapper(sizeof(PASSWDSTRUCT)); passwdmode = mktokconfstr(tset, auth_getcursectionid(peer), "passwdmode", ""); newhandle->passent = getpwnam(username); if (newhandle->passent == NULL) goto error; #ifdef HAVE_GETSPNAM /* this will try to autodetect shadow passwordness */ if ((strcasecmp(passwdmode, "shadow") == 0) || (strcmp(newhandle->passent->pw_passwd, "x") == 0)) { if (strcasecmp(passwdmode, "normal") == 0) newhandle->sppassent = NULL; else { newhandle->sppassent = getspnam(username); if (newhandle->sppassent == NULL) goto error; } } else newhandle->sppassent = NULL; #endif freewrapper(passwdmode); *err = AUTH_OK; return(newhandle); error: freewrapper(passwdmode); *err = AUTH_USERNKNOW; freewrapper(newhandle); return(NULL); } void freehandle(void *handle) { freewrapper(handle); } int chkpasswd(void *h, char *password, char **errmsg) { PASSWDSTRUCT *handle = (PASSWDSTRUCT *)h; #ifdef HAVE_GETSPNAM if (handle->sppassent) { int days = getday(); int expiredate = handle->sppassent->sp_max + handle->sppassent->sp_lstchg + + handle->sppassent->sp_inact; /* do the account expiration checking! */ if ((days > handle->sppassent->sp_expire) && (handle->sppassent->sp_expire != -1)) { *errmsg = safe_snprintf("Account has expired"); return(FALSE); } if ((handle->sppassent->sp_inact != -1) && (handle->sppassent->sp_max != -1) && (handle->sppassent->sp_lstchg != -1) && (days > expiredate)) { *errmsg = safe_snprintf("Account disabled, needs new password"); return(FALSE); } return(chkpassword(handle->sppassent->sp_pwdp, password)); } #endif return(chkpassword(handle->passent->pw_passwd, password)); } char *gethomedir(void *h) { return(((PASSWDSTRUCT *)h)->passent->pw_dir); } char *getrootdir(void *h) { return("/"); } uid_t getuseruid(void *h) { return(((PASSWDSTRUCT *)h)->passent->pw_uid); } gid_t getusergid(void *h) { return(((PASSWDSTRUCT *)h)->passent->pw_gid); } gid_t *getusersupgid(void *h) { return(getusergrouplist(((PASSWDSTRUCT *)h)->passent->pw_name)); } muddleftpd-1.3.13.1/modules/auth/authlibexample/README0100644000175000017500000000070307554515351021374 0ustar joergjoergAUTHLIBEXAMPLE VERSION 0.2 This is an example library showing how to implement an external authentication module for muddleftpd (version 1.3.4 and above) This module is not fully documented yet. :-) I have given a virtually public domain license on this example code. I anticipate that muddleftpd authentication modules will have source and binary compatibility between various releases of muddleftpd. Have fun Beau Kuiper support@muddleftpd.cx muddleftpd-1.3.13.1/modules/auth/authlibexample/auth.h0100644000175000017500000001240607751235071021626 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Includes */ #include #include #include #include #ifndef INT_MAX #define INT_MAX 0x7FFFFFFF #endif /* Inportant Constants */ /* yep, true and false */ #define FALSE 0 #define TRUE !FALSE /* constants declaring various log levels. */ #define MYLOG_DACCESS 1 /* denied access to server because of ip */ #define MYLOG_FTRANS 2 /* file transfer */ #define MYLOG_COMMAND 4 /* command from client */ #define MYLOG_RESPONSE 8 /* respone to client commands */ #define MYLOG_INFO 16 /* informational logs */ #define MYLOG_LOGIN 32 /* login information */ #define MYLOG_DEBUG 64 /* debug log */ /* set err to this to tell the server the result of getting an auth handle */ #define AUTH_OK 0 /* got handle, everything good */ #define AUTH_USERNKNOW 1 /* This module is not responsible for current user, move to next module */ #define AUTH_ERROR 2 /* A bad error occured, stop attempting to authenticate user */ /* a couple of macros to help :-) */ #define MAXIMUM(x, y) (x) > (y) ? (x) : (y) #define MINIMUM(x, y) (x) > (y) ? (y) : (x) /* Typedefs */ /* NEWFILE is a structure used with muddleftpd special text file handling routines. Don't directly modify its structure */ typedef struct { int fd; void *buffer; int eof; } NEWFILE; /* here as some prototypes for functions you can use */ /* MEMORY FUNCTIONS */ /* Just like malloc, but it checks for out of memory */ extern void *mallocwrapper(int size); /* Almost same a realloc, execpt supply double pointer of memory area(inarea) * and the new size */ void reallocwrapper(int size, void **inarea); /* Same as strdup, but checks for out of memory result */ char *strdupwrapper(char *s); /* to free areas created by strdupwrapper and mallocwrapper, It also updates * counters used to determine memory leakage, so you should use this instead * of plain free() */ void freewrapper(void *tofree); /* just memmove because muddleftpd will supply a replacement if the system * doesn't supply one */ #ifndef HAVE_MEMMOVE char *memmove(void *dest, void *src, int n); #endif /* STRING FUNCTIONS */ /* This drops all characaters with a code < 32 in the string suppled. This is * done in place */ void strtrimspace(char *string); /* This counts to number of occurences of char tok in the supplied string */ int strchrcount(char *string, char tok); /* this is vsprintf except the result is given as a string allocated using * mallocwrapper. Use freewrapper to reclaim the space it uses */ char *safe_vsnprintf(char *format, va_list ap); /* this is the same as sprintf execpt the result is given as a string allocated * in dynamic memory using mallocwrapper. Use freewrapper to free it */ char *safe_snprintf(char *format, ...); /* gets suplementary gids of user */ gid_t *getusergrouplist(char *username); /* these are for really bad errors. Don't use either errormsg or errormsgfatal. * Use the ERRORMSG and ERRORMSGFATAL macros instead. BTW, ONLY USE THESE * FOR ERRORS THAT CANNOT BE SOLVED ANYWAY ELSE */ void errormsg( char *errmessage, char *file, int line ); void errormsgfatal( char *errmessage, char *file, int line ); #define ERRORMSGFATAL(x) errormsgfatal(x, __FILE__, __LINE__) #define ERRORMSG(x) errormsg(x, __FILE__, __LINE__) /* LOG OPERATIONS */ /* Adds a log entry to muddleftpd's logs. type is one of the constants * specified above. peer is the same peer pointer passed to the gethandle * function. desc is the string to add to the log */ extern void log_addentry(int type, void *peer, char *desc); /* Exactly the same a log_addentry, but muddleftpd will use freewrapper * on desc so you can use safe_snprintf for desc */ extern void log_giveentry(int type, void *peer, char *desc); /* the debug log */ extern void debuglog(char *format, ...); /* CONFIF FILE OPERATIONS */ char *strsplit(char *, char *, char *); void substitute(char **inputstr, char *strin, char *strout); int loadconfigfile(char *filename, int (* confighandler)(char *, char *, int, void *), void *configdata); void *loadconfigcache(char *filename); char *mktokconfstr(void *tset, int section, char *setting, char *defaul); void loadintfromconfig(void *cache, int section, char *setting, int *to, int def); void loadstrfromconfig(void *cache, int section, char *setting, char **to, char *def); void freeconfigcache(void *cache); char **makeconfiglist(void *cache, char *section, char *label); extern NEWFILE *nfopen(char *filename); extern NEWFILE *nfdopen(int fd); extern char *nfgetcs(NEWFILE *file, char testchar); extern void nfclose(NEWFILE *file); extern int chkpassword(char *, char *); muddleftpd-1.3.13.1/modules/auth/authlibexample/configure.ac0100644000175000017500000000074707554515351023012 0ustar joergjoergdnl Process this file with autoconf to produce a configure script. AC_INIT AC_PREREQ(2.54) AC_CONFIG_SRCDIR([authunix.c]) AC_CONFIG_HEADER(config.h) dnl Checks for programs. AC_PROG_CC dnl Checks for libraries. dnl Checks for header files. AC_CHECK_HEADERS(unistd.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_STRUCT_TM dnl Checks for library functions. AC_HEADER_STDC dnl Check functions AC_CHECK_FUNCS(getspnam) AC_CONFIG_FILES([Makefile]) AC_OUTPUT muddleftpd-1.3.13.1/modules/auth/authlibexample/configure0100755000175000017500000035420407751444671022440 0ustar joergjoerg#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57. # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="authunix.c" # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd "$ac_popdir" done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6 if test "${ac_cv_struct_tm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct tm *tp; tp->tm_sec; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_struct_tm=time.h else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_struct_tm=sys/time.h fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 echo "${ECHO_T}$ac_cv_struct_tm" >&6 if test $ac_cv_struct_tm = sys/time.h; then cat >>confdefs.h <<\_ACEOF #define TM_IN_SYS_TIME 1 _ACEOF fi echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi for ac_func in getspnam do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by $as_me, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi muddleftpd-1.3.13.1/modules/auth/authlibexample/config.h.in0100644000175000017500000000264407751444672022553 0ustar joergjoerg/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the `getspnam' function. */ #undef HAVE_GETSPNAM /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME muddleftpd-1.3.13.1/modules/auth/authlibmsql/0040755000175000017500000000000007751444675020051 5ustar joergjoergmuddleftpd-1.3.13.1/modules/auth/authlibmsql/Makefile.in0100644000175000017500000000117007751443724022104 0ustar joergjoerg DEFS=@DEFS@ CFLAGS=@CFLAGS@ CC=@CC@ LIBS=@LIBS@ SRC=authmsql.c OBJ=$(SRC:.c=.o) prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@/muddleftpd LIBNAME=libauthmsql.so DOCDIR=@datadir@ all: $(OBJ) $(CC) $(CFLAGS) -shared -fPIC -Xlinker -x -o $(LIBNAME) $(OBJ) $(LIBS) install: all mkdir -p $(libdir) mkdir -p $(DOCDIR)/doc/muddleftpd install README -m 644 $(DOCDIR)/doc/muddleftpd/README.authmsql install $(LIBNAME) -m 644 $(libdir) clean: rm -f *.o *~ DEADJOE $(LIBNAME) distclean: clean rm -f config.h Makefile config.log config.cache config.status maintainer-clean: distclean rm -f config.h.in configure muddleftpd-1.3.13.1/modules/auth/authlibmsql/CHANGES0100644000175000017500000000013607554515351021030 0ustar joergjoergVersion 0.2 1) Changed authmodule to authmethod in README Version 0.1 1) Inital release. muddleftpd-1.3.13.1/modules/auth/authlibmsql/authmsql.c0100644000175000017500000001336207554515351022044 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #include "auth.h" #include #include #include #include /* This file contains code to autheticate against msql servers */ #define ENCRYPTED_NONE 0 #define ENCRYPTED_CRYPT 1 typedef struct { char *password; char *homedir; char *rootdir; int uid; int gid; int encrypted; } PASSWDSTRUCT; void *gethandle(void *peer, void *tset, char *username, int *err) { int sqlhandle = -1; m_result *result = NULL; m_row row = NULL; PASSWDSTRUCT *newhandle; int section; char *sqlserver; char *sqlencryption; char *sqldatabase; int sqlport; char *sqltable; char *sqlquery, *query = NULL; section = auth_getcursectionid(peer); newhandle = (PASSWDSTRUCT *)mallocwrapper(sizeof(PASSWDSTRUCT)); /* read info from config file */ sqlserver = mktokconfstr(tset, section, "msql_host", NULL); sqldatabase = mktokconfstr(tset, section, "msql_database", NULL); sqltable = mktokconfstr(tset, section, "msql_table", "users"); sqlport = mktokconfint(tset, section, "msql_port", "%d", NULL, 0); sqlencryption = mktokconfstr(tset, section, "msql_encryption", "crypt"); sqlquery = mktokconfstr(tset, section, "msql_query", NULL); if (!sqldatabase) { log_addentry(MYLOG_INFO, NULL, "libauthmsql REQUIRES msql_database to connect to sql server"); goto error; } if (strcasecmp(sqlencryption, "plaintext") == 0) newhandle->encrypted = ENCRYPTED_NONE; else if (strcasecmp(sqlencryption, "crypt") == 0) newhandle->encrypted = ENCRYPTED_CRYPT; else { log_addentry(MYLOG_INFO, NULL, "libauthmsql REQUIRES msql_encryption to be set to either plaintext or crypt"); goto error; } if (!sqlquery) query = safe_snprintf("SELECT password,homedir,rootdir,uid,gid FROM %s WHERE username='%s'", sqltable, username); else query = strdupwrapper(sqlquery); /* connect to sql server */ if ((sqlhandle = msqlConnect(sqlserver)) == -1) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("libauthmsql could not connect to SQL server: %s", msqlErrMsg)); goto error; } if (msqlSelectDB(sqlhandle, sqldatabase) == -1) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("libauthmsql could not connect to SQL database '%s': %s", sqldatabase, msqlErrMsg)); goto error; } /* perform sql query */ if (msqlQuery(sqlhandle, query) == -1) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("libauthmsql could not perform query on SQL server: %s", msqlErrMsg)); goto error; } /* get result data */ result = msqlStoreResult(); if (msqlNumFields(result) != 5) { log_addentry(MYLOG_INFO, NULL, "libauthmsql, msql_query setting incorrectly set"); goto error; } /* if we got no rows, then the user does not exist */ if (msqlNumRows(result) == 0) { freewrapper(newhandle); newhandle = NULL; *err = AUTH_USERNKNOW; goto cleanup; } if (msqlNumRows(result) > 1) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("libauthmsql got more than 1 result for query on user '%s'", username)); goto error; } /* decode row */ row = msqlFetchRow(result); if (!row[0] || !row[1] || !row[2] || !row[3] || !row[4]) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("libauthmsql found NULL values in SQL result for user '%s'", username)); goto error; } if (sscanf(row[3], "%d", &(newhandle->uid)) != 1) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("libauthmsql could not decode uid of user '%s'", username)); goto error; } if (sscanf(row[4], "%d", &(newhandle->gid)) != 1) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("libauthmsql could not decode gid of user '%s'", username)); goto error; } newhandle->password = strdupwrapper(row[0]); newhandle->homedir = strdupwrapper(row[1]); newhandle->rootdir = strdupwrapper(row[2]); /* we are FINALLY DONE!, clean up and go home! */ *err = AUTH_OK; goto cleanup; error: *err = AUTH_ERROR; freewrapper(newhandle); newhandle = NULL; cleanup: if (query) freewrapper(query); if (result) msqlFreeResult(result); if (sqlhandle != -1) msqlClose(sqlhandle); if (sqlserver) freewrapper(sqlserver); if (sqldatabase) freewrapper(sqldatabase); freewrapper(sqltable); freewrapper(sqlencryption); if (sqlquery) freewrapper(sqlquery); return(newhandle); } void freehandle(void *handle) { PASSWDSTRUCT *h = (PASSWDSTRUCT *)handle; size_t sl = strlen(h->password); /* destroy record of password */ memset(h->password, 0, sl); freewrapper(h->password); freewrapper(h->homedir); freewrapper(h->rootdir); freewrapper(h); } int chkpasswd(void *handle, char *password, char **errmsg) { PASSWDSTRUCT *h = (PASSWDSTRUCT *)handle; switch(h->encrypted) { case ENCRYPTED_NONE: return(strcmp(password, h->password) == 0); case ENCRYPTED_CRYPT: return(chkpassword(h->password, password)); default: return(FALSE); } return(FALSE); } char *gethomedir(void *h) { return(((PASSWDSTRUCT *)h)->homedir); } char *getrootdir(void *h) { return(((PASSWDSTRUCT *)h)->rootdir); } uid_t getuseruid(void *h) { return(((PASSWDSTRUCT *)h)->uid); } gid_t getusergid(void *h) { return(((PASSWDSTRUCT *)h)->gid); } muddleftpd-1.3.13.1/modules/auth/authlibmsql/README0100644000175000017500000001266507751246442020730 0ustar joergjoergmSQL authentication Module. (authlibmsql) Version 0.1 This module allows muddleftpd 1.3.4 and above authenticate using a mSQL server. This module will read client information from a supplied table/database within mSQL. It does not modify any data on the server. It supports: * Password encryption: Passwords can be encrypted on the mSQL server in either plaintext (no encryption) or crypt based methods. * Support for custom SELECT query strings. This allows tremendous flexibility for choosing the structure of the tables muddleftpd retreive data from. Note: This server is based very heavily off the mysql authentication module. Please excuse any reference to mysql I may make here as most of this module is copied directly from the mysql module. DEPENDANCIES: mSQL 2.0.11 or better. This module may compile and work on earlier versions, but it hasn't been tested for any older version. Unless you specify a custom query for authlibmsql to perform, the table containing user data must have the following fields, with these names: username The username password The password for the username homedir The home directory for the user. rootdir The root directory for the user. uid The uid of the user. gid The gid of the user. BUILDING: To build, execute the following in the authlibmsql source directory: ./configure [--with-msql=] make Or simply build it with the rest of muddleftpd, add --with-authmsql to the configuration options of that configure script. If mSQL is not installed in the default location (/usr/local/Hughes), you need to supply the --with-msql option with the path to the base directory of your mSQL setup. After you have run make, the file libauthmsql.so can be copied to the directory you wish to store muddleftpd modules in. This directory must be secure, so users cannot overwrite the module with a cracked version. By default it is put into @prefix@/lib from configure, if you dont set prefix this is /usr/local/lib/muddleftpd. USAGE: In the groups that you wish authlibmsql to authenticate, you need to use the following to tell muddleftpd to use the authlibmsql module, replacing the directory here with the directory the authentication module is stored in: (If unsure a locate libauthmsql.so may help). authmethod /usr/local/lib/muddleftpd/libauthmsql.so To configure authlibmsql, the following directives have been added. You must specify these in the group section that is being configured. msql_host This specifies the host the mSQL server is located on. If you do not specify this value, authlibmsql will assume the host is 'localhost'. (the same computer as the ftp server) msql_port This specifies what TCP port number to connect to the mSQL server using. If it is not supplied, the default mSQL port is used. msql_database This specifies what database to use on the mSQL server. It is advisable not to use the master database. You must specify this value for authlibmsql to work. msql_table This specifies the table to read user password data from. By default, this is 'users'. This is not used if you specify a custom query string. msql_encryption This specifies the type of encryption to use on passwords. There are two options avaliable: a) 'plaintext' Passwords are stored with no encryption at all. Anybody with read access to the database can steal the passwords. You should set muddleftpd.conf to 600 permissions if you use this setting. b) 'crypt' Use the standard unix crypt() call to test passwords, so they typically end up as the same format as the password file The default option for msql_encryption is 'crypt' msql_query (ADVANCED OPTION) This specifies the query to use to get data from the database. It should be a SELECT query that returns data in the following order: 1) password: The password of the user, in the selected encrypted form. 2) home directory: The home directory of the user. 3) root directory: The root directory of the user. 4) uid: An integer value for the user's uid. 5) gid: An integer value for the user's gid. This SELECT query should only return 1 result if the user exists, or no results if the user does not exist. You can use this option if the field names do not match the ones documented above. An example (must be entered on a single line in the config file): mysql_query SELECT pass,home,root,useruid,usergid FROM usertable WHERE user='%U' You can also use this option if data is spread among multiple tables. Another example (must still be on a single line in the config file!): mysql_query SELECT P.pass,C.home,C.root,C.uid,C.gid FROM passwd P, credtable C WHERE P.user=C.user AND P.user='%U' This gets data from the password table, and joins it with data from the credentials table to provide data for authlibmsql. GROUP EFFECTS: If authlibmsql finds a single result for a query, and the data checks out ok, then it will accept the username, and authenticate for it. If it finds no result for the query, then it will pass the username onto the next group section. If more than one result is returned, or an error occured along the way, authlibmsql will cancel authentication for that user. FURTHER NOTES: * You should avoid using plaintext stored passwords, especially since anyone who can read the configuration file can steal all the passwords in the mSQL database. AUTHORS: Beau Kuiper (support@muddleftpd.cx) muddleftpd-1.3.13.1/modules/auth/authlibmsql/auth.h0100644000175000017500000001240607751235226021151 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Includes */ #include #include #include #include #ifndef INT_MAX #define INT_MAX 0x7FFFFFFF #endif /* Inportant Constants */ /* yep, true and false */ #define FALSE 0 #define TRUE !FALSE /* constants declaring various log levels. */ #define MYLOG_DACCESS 1 /* denied access to server because of ip */ #define MYLOG_FTRANS 2 /* file transfer */ #define MYLOG_COMMAND 4 /* command from client */ #define MYLOG_RESPONSE 8 /* respone to client commands */ #define MYLOG_INFO 16 /* informational logs */ #define MYLOG_LOGIN 32 /* login information */ #define MYLOG_DEBUG 64 /* debug log */ /* set err to this to tell the server the result of getting an auth handle */ #define AUTH_OK 0 /* got handle, everything good */ #define AUTH_USERNKNOW 1 /* This module is not responsible for current user, move to next module */ #define AUTH_ERROR 2 /* A bad error occured, stop attempting to authenticate user */ /* a couple of macros to help :-) */ #define MAXIMUM(x, y) (x) > (y) ? (x) : (y) #define MINIMUM(x, y) (x) > (y) ? (y) : (x) /* Typedefs */ /* NEWFILE is a structure used with muddleftpd special text file handling routines. Don't directly modify its structure */ typedef struct { int fd; void *buffer; int eof; } NEWFILE; /* here as some prototypes for functions you can use */ /* MEMORY FUNCTIONS */ /* Just like malloc, but it checks for out of memory */ extern void *mallocwrapper(int size); /* Almost same a realloc, execpt supply double pointer of memory area(inarea) * and the new size */ void reallocwrapper(int size, void **inarea); /* Same as strdup, but checks for out of memory result */ char *strdupwrapper(char *s); /* to free areas created by strdupwrapper and mallocwrapper, It also updates * counters used to determine memory leakage, so you should use this instead * of plain free() */ void freewrapper(void *tofree); /* just memmove because muddleftpd will supply a replacement if the system * doesn't supply one */ #ifndef HAVE_MEMMOVE char *memmove(void *dest, void *src, int n); #endif /* STRING FUNCTIONS */ /* This drops all characaters with a code < 32 in the string suppled. This is * done in place */ void strtrimspace(char *string); /* This counts to number of occurences of char tok in the supplied string */ int strchrcount(char *string, char tok); /* this is vsprintf except the result is given as a string allocated using * mallocwrapper. Use freewrapper to reclaim the space it uses */ char *safe_vsnprintf(char *format, va_list ap); /* this is the same as sprintf execpt the result is given as a string allocated * in dynamic memory using mallocwrapper. Use freewrapper to free it */ char *safe_snprintf(char *format, ...); /* gets suplementary gids of user */ gid_t *getusergrouplist(char *username); /* these are for really bad errors. Don't use either errormsg or errormsgfatal. * Use the ERRORMSG and ERRORMSGFATAL macros instead. BTW, ONLY USE THESE * FOR ERRORS THAT CANNOT BE SOLVED ANYWAY ELSE */ void errormsg( char *errmessage, char *file, int line ); void errormsgfatal( char *errmessage, char *file, int line ); #define ERRORMSGFATAL(x) errormsgfatal(x, __FILE__, __LINE__) #define ERRORMSG(x) errormsg(x, __FILE__, __LINE__) /* LOG OPERATIONS */ /* Adds a log entry to muddleftpd's logs. type is one of the constants * specified above. peer is the same peer pointer passed to the gethandle * function. desc is the string to add to the log */ extern void log_addentry(int type, void *peer, char *desc); /* Exactly the same a log_addentry, but muddleftpd will use freewrapper * on desc so you can use safe_snprintf for desc */ extern void log_giveentry(int type, void *peer, char *desc); /* the debug log */ extern void debuglog(char *format, ...); /* CONFIF FILE OPERATIONS */ char *strsplit(char *, char *, char *); void substitute(char **inputstr, char *strin, char *strout); int loadconfigfile(char *filename, int (* confighandler)(char *, char *, int, void *), void *configdata); void *loadconfigcache(char *filename); char *mktokconfstr(void *tset, int section, char *setting, char *defaul); void loadintfromconfig(void *cache, int section, char *setting, int *to, int def); void loadstrfromconfig(void *cache, int section, char *setting, char **to, char *def); void freeconfigcache(void *cache); char **makeconfiglist(void *cache, char *section, char *label); extern NEWFILE *nfopen(char *filename); extern NEWFILE *nfdopen(int fd); extern char *nfgetcs(NEWFILE *file, char testchar); extern void nfclose(NEWFILE *file); extern int chkpassword(char *, char *); muddleftpd-1.3.13.1/modules/auth/authlibmsql/configure.ac0100644000175000017500000000200307554515351022316 0ustar joergjoergdnl Process this file with autoconf to produce a configure script. AC_INIT AC_PREREQ(2.54) AC_CONFIG_SRCDIR([authmsql.c]) AC_CONFIG_HEADER(config.h) dnl Checks for programs. AC_PROG_CC dnl Checks for libraries. dnl Checks for header files. AC_CHECK_HEADERS(unistd.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_STRUCT_TM dnl Checks for library functions. AC_HEADER_STDC dnl Check functions AC_CHECK_FUNCS(memmove) AC_ARG_WITH(msqlpath, AC_HELP_STRING([--with-msqlpath], [specify the top level of the msql installation tree. (default is /usr/local/Hughes)]), msqltop=$withval, msqltop=/usr/local/Hughes ) AC_MSG_CHECKING([for msql in directory $msqltop]) if test "X$msqltop" = "X" then AC_MSG_RESULT([no]) AC_MSG_ERROR([msql directory not specified]) fi if test -d $msqltop then AC_MSG_RESULT([yes]) CFLAGS="$CFLAGS -I$msqltop/include" LIBS="$LIBS $msqltop/lib/libmsql.a" else AC_MSG_RESULT([no]) AC_MSG_ERROR([msql directory not found!]) fi AC_CONFIG_FILES([Makefile]) AC_OUTPUT muddleftpd-1.3.13.1/modules/auth/authlibmsql/configure0100755000175000017500000035653307751444674021773 0ustar joergjoerg#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57. # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="authmsql.c" # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-msqlpath specify the top level of the msql installation tree. (default is /usr/local/Hughes) Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd "$ac_popdir" done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6 if test "${ac_cv_struct_tm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct tm *tp; tp->tm_sec; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_struct_tm=time.h else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_struct_tm=sys/time.h fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 echo "${ECHO_T}$ac_cv_struct_tm" >&6 if test $ac_cv_struct_tm = sys/time.h; then cat >>confdefs.h <<\_ACEOF #define TM_IN_SYS_TIME 1 _ACEOF fi echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi for ac_func in memmove do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # Check whether --with-msqlpath or --without-msqlpath was given. if test "${with_msqlpath+set}" = set; then withval="$with_msqlpath" msqltop=$withval else msqltop=/usr/local/Hughes fi; echo "$as_me:$LINENO: checking for msql in directory $msqltop" >&5 echo $ECHO_N "checking for msql in directory $msqltop... $ECHO_C" >&6 if test "X$msqltop" = "X" then echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: msql directory not specified" >&5 echo "$as_me: error: msql directory not specified" >&2;} { (exit 1); exit 1; }; } fi if test -d $msqltop then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 CFLAGS="$CFLAGS -I$msqltop/include" LIBS="$LIBS $msqltop/lib/libmsql.a" else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: msql directory not found!" >&5 echo "$as_me: error: msql directory not found!" >&2;} { (exit 1); exit 1; }; } fi ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by $as_me, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi muddleftpd-1.3.13.1/modules/auth/authlibmsql/config.h.in0100644000175000017500000000264207751444675022075 0ustar joergjoerg/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME muddleftpd-1.3.13.1/modules/auth/authlibmud/0040755000175000017500000000000007751444677017664 5ustar joergjoergmuddleftpd-1.3.13.1/modules/auth/authlibmud/Makefile.in0100644000175000017500000000121207751443735021714 0ustar joergjoerg DEFS=@DEFS@ CFLAGS=@CFLAGS@ CC=@CC@ LIBS=@LIBS@ SRC=authmud.c OBJ=$(SRC:.c=.o) prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@/muddleftpd LIBNAME=libauthmud.so DOCDIR=@datadir@ all: $(OBJ) $(CC) $(CFLAGS) $(LIBS) -shared -fPIC -Xlinker -x -o $(LIBNAME) $(OBJ) install: all mkdir -p $(libdir) mkdir -p $(DOCDIR)/doc/muddleftpd install README -m 644 $(DOCDIR)/doc/muddleftpd/README.authmud install $(LIBNAME) -m 644 $(libdir) clean: rm -fr autom4te.cache rm -f *.o *~ DEADJOE $(LIBNAME) distclean: clean rm -f config.h Makefile config.log config.cache config.status maintainer-clean: distclean rm -f configure config.h.in muddleftpd-1.3.13.1/modules/auth/authlibmud/CHANGES0100644000175000017500000000013607554515351020641 0ustar joergjoergVersion 0.2 1) Documentation: Authmethod. not authmodule. Version 0.1 1) Inital release. muddleftpd-1.3.13.1/modules/auth/authlibmud/authmud.c0100644000175000017500000000461207554515351021464 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #include "auth.h" /* This file contains code to autheticate for mud users */ /* any level higher than this will successfully authenticate. */ #define MINLEVEL 20 typedef struct { char *password; int level; } PASSWDSTRUCT; int mudauth_config(char *cmd, char *data, int line, void *h) { PASSWDSTRUCT *handle = (PASSWDSTRUCT *)h; if (strcmp(cmd, "Level") == 0) sscanf(data, "%d", &(handle->level)); else if ((strcmp(cmd, "Password") == 0) && (strlen(data) > 2)) { handle->password = strdupwrapper(data + 1); handle->password[strlen(handle->password) - 1] = 0; } return(FALSE); } void *gethandle(void *peer, void *tset, char *username, int *err) { PASSWDSTRUCT *newhandle; int result, error, line; char *userfile; userfile = mktokconfstr(tset, auth_getcursectionid(peer), "playerfile", NULL); if (userfile == NULL) { log_addentry(MYLOG_INFO, NULL, "authmud requires playerfile to specify player file"); *err = AUTH_ERROR; return(NULL); } newhandle = mallocwrapper(sizeof(PASSWDSTRUCT)); newhandle->password = NULL; newhandle->level = 0; result = loadconfigfile(userfile, mudauth_config, newhandle, FALSE, &error, &line); *err = AUTH_OK; if (result != 0) *err = AUTH_USERNKNOW; if (newhandle->level <= MINLEVEL) { if (newhandle->password) freewrapper(newhandle->password); newhandle = NULL; *err = AUTH_ERROR; } freewrapper(userfile); return(newhandle); } void freehandle(void *h) { PASSWDSTRUCT *handle = (PASSWDSTRUCT *)h; freewrapper(handle->password); freewrapper(handle); } int chkpasswd(void *h, char *password, char **errmsg) { PASSWDSTRUCT *handle = (PASSWDSTRUCT *)h; return(chkpassword(handle->password, password)); } muddleftpd-1.3.13.1/modules/auth/authlibmud/README0100644000175000017500000000540607751246756020544 0ustar joergjoergMud authentication Module. (authlibmud) Version 0.1 This module allows muddleftpd 1.3.4 and above authenticate against player files on a mud server. Note: This module is designed to run on a non-root execution of muddleftpd. It does not provide uid, gid information about a user. Note: This module does not provide any information other than the success of authenticating a user. No home or root directory information is passed on. You will need to configure these things in the config file. Note: You may need to modify the code to get this to work on your mud. YMMV. Contact me if you have any difficulties. DEPENDANCIES: None. However this module is useless unless you are using muddleftpd 1.3.4 or better. Without modifing the code, authlibmud assumes: * People level 21 and above are wizards and can login. * Passwords in the player files are encrypted using the unix crypt() call. * The fields for the level and password in the player file are labeled "Level" and "Password" in the same order. BUILDING: To build, execute the following in the authlibmud source directory: ./configure make Or simply build it with the rest of muddleftpd, add --with-authmud to the configuration options of that configure script. Then the file libauthmud.so can be copied to the directory you with to store muddleftpd modules in. This directory must be secure, so users cannot overwrite the module with a cracked version. By default it is put into @prefix@/lib from configure, if you dont set prefix this is /usr/local/lib/muddleftpd. USAGE: In the groups that you wish authlibmud to authenticate, you need to use the following to tell muddleftpd to use the authlibmud module, replacing the directory with the directory the authentication module is stored in: (If unsure a locate libauthmud.so may help). authmethod /usr/local/lib/muddleftpd/libauthmud.so To configure libauthmud, the following directives have been added. You must specify these in the group section that is being configured. playerfile This is the path and filename of the user filename. You should construct this using the %U token, so it changes depending on who is logging in. For example if player files are stored in /usr/local/mud/players//.passwd then you would use in the config file: playerfile /usr/local/mud/players/%(0,0)U/%U.passwd GROUP EFFECTS: If the player file is found, and the player has a level greater than 20, then authlibmud will accept the username and authenticate for it. If the player file is found, but the player has a level less than or equal to 20, then authentication is cancelled. If the player file is not found, authlibmud will pass the username to the next group section. AUTHORS: Beau Kuiper (support@muddleftpd.cx) muddleftpd-1.3.13.1/modules/auth/authlibmud/auth.h0100644000175000017500000001246607751235246020772 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Includes */ #include #include #include #include #ifndef INT_MAX #define INT_MAX 0x7FFFFFFF #endif /* Inportant Constants */ /* yep, true and false */ #define FALSE 0 #define TRUE !FALSE /* constants declaring various log levels. */ #define MYLOG_DACCESS 1 /* denied access to server because of ip */ #define MYLOG_FTRANS 2 /* file transfer */ #define MYLOG_COMMAND 4 /* command from client */ #define MYLOG_RESPONSE 8 /* respone to client commands */ #define MYLOG_INFO 16 /* informational logs */ #define MYLOG_LOGIN 32 /* login information */ #define MYLOG_DEBUG 64 /* debug log */ /* set err to this to tell the server the result of getting an auth handle */ #define AUTH_OK 0 /* got handle, everything good */ #define AUTH_USERNKNOW 1 /* This module is not responsible for current user, move to next module */ #define AUTH_ERROR 2 /* A bad error occured, stop attempting to authenticate user */ /* a couple of macros to help :-) */ #define MAXIMUM(x, y) (x) > (y) ? (x) : (y) #define MINIMUM(x, y) (x) > (y) ? (y) : (x) /* Typedefs */ /* NEWFILE is a structure used with muddleftpd special text file handling routines. Don't directly modify its structure */ typedef struct { int fd; void *buffer; int eof; } NEWFILE; /* here as some prototypes for functions you can use */ /* MEMORY FUNCTIONS */ /* Just like malloc, but it checks for out of memory */ extern void *mallocwrapper(int size); /* Almost same a realloc, execpt supply double pointer of memory area(inarea) * and the new size */ void reallocwrapper(int size, void **inarea); /* Same as strdup, but checks for out of memory result */ char *strdupwrapper(char *s); /* to free areas created by strdupwrapper and mallocwrapper, It also updates * counters used to determine memory leakage, so you should use this instead * of plain free() */ void freewrapper(void *tofree); /* just memmove because muddleftpd will supply a replacement if the system * doesn't supply one */ #ifndef HAVE_MEMMOVE char *memmove(void *dest, void *src, int n); #endif /* STRING FUNCTIONS */ /* This drops all characaters with a code < 32 in the string suppled. This is * done in place */ void strtrimspace(char *string); /* This counts to number of occurences of char tok in the supplied string */ int strchrcount(char *string, char tok); /* this is vsprintf except the result is given as a string allocated using * mallocwrapper. Use freewrapper to reclaim the space it uses */ char *safe_vsnprintf(char *format, va_list ap); /* this is the same as sprintf execpt the result is given as a string allocated * in dynamic memory using mallocwrapper. Use freewrapper to free it */ char *safe_snprintf(char *format, ...); /* gets suplementary gids of user */ gid_t *getusergrouplist(char *username); /* these are for really bad errors. Don't use either errormsg or errormsgfatal. * Use the ERRORMSG and ERRORMSGFATAL macros instead. BTW, ONLY USE THESE * FOR ERRORS THAT CANNOT BE SOLVED ANYWAY ELSE */ void errormsg( char *errmessage, char *file, int line ); void errormsgfatal( char *errmessage, char *file, int line ); #define ERRORMSGFATAL(x) errormsgfatal(x, __FILE__, __LINE__) #define ERRORMSG(x) errormsg(x, __FILE__, __LINE__) /* LOG OPERATIONS */ /* Adds a log entry to muddleftpd's logs. type is one of the constants * specified above. peer is the same peer pointer passed to the gethandle * function. desc is the string to add to the log */ extern void log_addentry(int type, void *peer, char *desc); /* Exactly the same a log_addentry, but muddleftpd will use freewrapper * on desc so you can use safe_snprintf for desc */ extern void log_giveentry(int type, void *peer, char *desc); /* the debug log */ extern void debuglog(char *format, ...); /* CONFIF FILE OPERATIONS */ char *strsplit(char *, char *, char *); void substitute(char **inputstr, char *strin, char *strout); int loadconfigfile(char *filename, int (* confighandler)(char *, char *, int, void *), void *configdata, int besecure, int *hendlererror, int *linenum); void *loadconfigcache(char *filename); char *mktokconfstr(void *tset, int section, char *setting, char *defaul); void loadintfromconfig(void *cache, int section, char *setting, int *to, int def); void loadstrfromconfig(void *cache, int section, char *setting, char **to, char *def); void freeconfigcache(void *cache); char **makeconfiglist(void *cache, char *section, char *label); extern NEWFILE *nfopen(char *filename); extern NEWFILE *nfdopen(int fd); extern char *nfgetcs(NEWFILE *file, char testchar); extern void nfclose(NEWFILE *file); extern int chkpassword(char *, char *); muddleftpd-1.3.13.1/modules/auth/authlibmud/configure.ac0100644000175000017500000000071507554515351022137 0ustar joergjoergdnl Process this file with autoconf to produce a configure script. AC_INIT AC_PREREQ(2.54) AC_CONFIG_SRCDIR([authmud.c]) AC_CONFIG_HEADER(config.h) dnl Checks for programs. AC_PROG_CC dnl Checks for libraries. dnl Checks for header files. AC_CHECK_HEADERS(unistd.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_STRUCT_TM dnl Checks for library functions. AC_HEADER_STDC dnl Check functions AC_CONFIG_FILES([Makefile]) AC_OUTPUT muddleftpd-1.3.13.1/modules/auth/authlibmud/configure0100755000175000017500000034762307751444676021606 0ustar joergjoerg#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57. # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="authmud.c" # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd "$ac_popdir" done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6 if test "${ac_cv_struct_tm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct tm *tp; tp->tm_sec; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_struct_tm=time.h else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_struct_tm=sys/time.h fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 echo "${ECHO_T}$ac_cv_struct_tm" >&6 if test $ac_cv_struct_tm = sys/time.h; then cat >>confdefs.h <<\_ACEOF #define TM_IN_SYS_TIME 1 _ACEOF fi echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by $as_me, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi muddleftpd-1.3.13.1/modules/auth/authlibmud/config.h.in0100644000175000017500000000252707751444677021712 0ustar joergjoerg/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME muddleftpd-1.3.13.1/modules/auth/authlibmysql/0040755000175000017500000000000007751444702020231 5ustar joergjoergmuddleftpd-1.3.13.1/modules/auth/authlibmysql/Makefile.in0100644000175000017500000000117007751443747022302 0ustar joergjoerg DEFS=@DEFS@ CFLAGS=@CFLAGS@ CC=@CC@ LIBS=@LIBS@ SRC=authmysql.c OBJ=$(SRC:.c=.o) prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@/muddleftpd LIBNAME=libauthmysql.so DOCDIR=@datadir@ all: $(OBJ) $(CC) $(CFLAGS) -shared -fPIC -Xlinker $(OBJ) $(LIBS) -o $(LIBNAME) install: all mkdir -p $(libdir) mkdir -p $(DOCDIR)/doc/muddleftpd install README -m 644 $(DOCDIR)/doc/muddleftpd/README.authmysql install $(LIBNAME) -m 644 $(libdir) clean: rm -f *.o *~ DEADJOE $(LIBNAME) distclean: clean rm -f config.h Makefile config.log config.cache config.status maintainer-clean: distclean rm -f configure config.h.in muddleftpd-1.3.13.1/modules/auth/authlibmysql/CHANGES0100644000175000017500000000020407554515351021215 0ustar joergjoergVersion 0.2 1) Documentation: authmethod and mysql_password are documented correctly now. Version 0.1 1) Inital release. muddleftpd-1.3.13.1/modules/auth/authlibmysql/authmysql.c0100644000175000017500000001512007751237732022423 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #include "auth.h" #include #include #include #include /* This file contains code to autheticate against mysql servers */ #define ENCRYPTED_NONE 0 #define ENCRYPTED_MYSQL 1 #define ENCRYPTED_CRYPT 2 typedef struct { char *password; char *homedir; char *rootdir; int uid; int gid; int encrypted; } PASSWDSTRUCT; void *gethandle(void *peer, void *tset, char *username, int *err) { MYSQL *sql = NULL; MYSQL_RES *result = NULL; MYSQL_ROW row = NULL; PASSWDSTRUCT *newhandle; int section; char *sqlserver; char *sqlencryption; char *sqlusername; char *sqlpassword; char *sqldatabase; int sqlport; char *sqltable; char *sqlquery, *query = NULL; section = auth_getcursectionid(peer); newhandle = (PASSWDSTRUCT *)mallocwrapper(sizeof(PASSWDSTRUCT)); /* read info from config file */ sqlserver = mktokconfstr(tset, section, "mysql_host", "localhost"); sqlusername = mktokconfstr(tset, section, "mysql_user", NULL); sqlpassword = mktokconfstr(tset, section, "mysql_password", NULL); sqldatabase = mktokconfstr(tset, section, "mysql_database", NULL); sqltable = mktokconfstr(tset, section, "mysql_table", "users"); sqlport = mktokconfint(tset, section, "mysql_port", "%d", NULL, 0); sqlencryption = mktokconfstr(tset, section, "mysql_encryption", "mysql"); sqlquery = mktokconfstr(tset, section, "mysql_query", NULL); if (!sqlusername) { log_addentry(MYLOG_INFO, NULL, "libauthmysql REQUIRES mysql_user to connect to sql server"); goto error; } if (!sqlpassword) { log_addentry(MYLOG_INFO, NULL, "libauthmysql REQUIRES mysql_password to connect to sql server"); goto error; } if (!sqldatabase) { log_addentry(MYLOG_INFO, NULL, "libauthmysql REQUIRES mysql_database to connect to sql server"); goto error; } if (strcasecmp(sqlencryption, "mysql") == 0) newhandle->encrypted = ENCRYPTED_MYSQL; else if (strcasecmp(sqlencryption, "plaintext") == 0) newhandle->encrypted = ENCRYPTED_NONE; else if (strcasecmp(sqlencryption, "crypt") == 0) newhandle->encrypted = ENCRYPTED_CRYPT; else { log_addentry(MYLOG_INFO, NULL, "libauthmysql REQUIRES mysql_encryption to be set to either plaintext, mysql, crypt"); goto error; } if (!sqlquery) query = safe_snprintf("SELECT password,homedir,rootdir,uid,gid FROM %s WHERE username='%s'", sqltable, username); else query = strdupwrapper(sqlquery); /* connect to sql server */ sql = mysql_init(NULL); if (!mysql_real_connect(sql, sqlserver, sqlusername, sqlpassword, sqldatabase, sqlport, NULL, 0)) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("libauthmysql could not connect to SQL server: %s", mysql_error(sql))); goto error; } /* perform sql query */ if (mysql_query(sql, query) != 0) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("libauthmysql could not perform query on SQL server: %s", mysql_error(sql))); goto error; } if (mysql_field_count(sql) != 5) { log_addentry(MYLOG_INFO, NULL, "libauthmysql, mysql_query setting incorrectly set"); goto error; } /* get result data */ if ((result = mysql_store_result(sql)) == NULL) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("libauthmysql could not get results from SQL query: %s", mysql_error(sql))); goto error; } /* if we got no rows, then the user does not exist */ if (mysql_num_rows(result) == 0) { freewrapper(newhandle); newhandle = NULL; *err = AUTH_USERNKNOW; goto cleanup; } if (mysql_num_rows(result) > 1) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("libauthmysql got more than 1 result for query on user '%s'", username)); goto error; } /* decode row */ row = mysql_fetch_row(result); if (!row[0] || !row[1] || !row[2] || !row[3] || !row[4]) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("libauthmysql found NULL values in SQL result for user '%s'", username)); goto error; } if (sscanf(row[3], "%d", &(newhandle->uid)) != 1) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("libauthmysql could not decode uid of user '%s'", username)); goto error; } if (sscanf(row[4], "%d", &(newhandle->gid)) != 1) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("libauthmysql could not decode gid of user '%s'", username)); goto error; } newhandle->password = strdupwrapper(row[0]); newhandle->homedir = strdupwrapper(row[1]); newhandle->rootdir = strdupwrapper(row[2]); /* we are FINALLY DONE!, clean up and go home! */ *err = AUTH_OK; goto cleanup; error: *err = AUTH_ERROR; freewrapper(newhandle); newhandle = NULL; cleanup: if (query) freewrapper(query); if (result) mysql_free_result(result); if (sql) mysql_close(sql); freewrapper(sqlserver); if (sqlusername) freewrapper(sqlusername); if (sqlpassword) freewrapper(sqlpassword); if (sqldatabase) freewrapper(sqldatabase); freewrapper(sqltable); freewrapper(sqlencryption); if (sqlquery) freewrapper(sqlquery); return(newhandle); } void freehandle(void *handle) { PASSWDSTRUCT *h = (PASSWDSTRUCT *)handle; size_t sl = strlen(h->password); /* destroy record of password */ memset(h->password, 0, sl); freewrapper(h->password); freewrapper(h->homedir); freewrapper(h->rootdir); freewrapper(h); } int chkpasswd(void *handle, char *password, char **errmsg) { PASSWDSTRUCT *h = (PASSWDSTRUCT *)handle; char pass2[1024]; switch(h->encrypted) { case ENCRYPTED_NONE: return(strcmp(password, h->password) == 0); case ENCRYPTED_CRYPT: return(chkpassword(h->password, password)); case ENCRYPTED_MYSQL: make_scrambled_password(pass2, password); return(strcmp(h->password, pass2) == 0); default: return(FALSE); } return(FALSE); } char *gethomedir(void *h) { return(((PASSWDSTRUCT *)h)->homedir); } char *getrootdir(void *h) { return(((PASSWDSTRUCT *)h)->rootdir); } uid_t getuseruid(void *h) { return(((PASSWDSTRUCT *)h)->uid); } gid_t getusergid(void *h) { return(((PASSWDSTRUCT *)h)->gid); } muddleftpd-1.3.13.1/modules/auth/authlibmysql/README0100644000175000017500000001314107751246664021115 0ustar joergjoergMySQL authentication Module. (authlibmysql) Version 0.1 This module allows muddleftpd 1.3.4 and above authenticate using a MySQL server. This module will read client information from a supplied table/database within MySQL. It does not modify any data on the server. It supports: * Password encryption: Passwords can be encrypted on the MySQL server in either plaintext (no encryption), crypt based, or the portable mysql password format. * Support for custom SELECT query strings. This allows tremendous flexibility for choosing the structure of the tables muddleftpd retreive data from. DEPENDANCIES: MySQL 3.22.32 or better. This module may compile and work on earlier versions, but it hasn't been tested for any older version. Unless you specify a custom query for authlibmysql to perform, the table containing user data must have the following fields, with these names: username The username password The password for the username homedir The home directory for the user. rootdir The root directory for the user. uid The uid of the user. gid The gid of the user. BUILDING: To build, execute the following in the authlibmysql source directory: ./configure [--with-mysql=] make Or simply build it with the rest of muddleftpd, add --with-authmysql to the configuration options of that configure script. When you have run make, the file libauthmysql.so can be copied to the directory you wish to store muddleftpd modules in. This directory must be secure, so users cannot overwrite the module with a cracked version. By default it is put into @prefix@/lib from configure, if you dont set prefix this is /usr/local/lib/muddleftpd. USAGE: In the groups that you wish authlibmysql to authenticate, you need to use the following to tell muddleftpd to use the authlibmysql module, replacing the directory here with the directory the authentication module is stored in: (If unsure a locate libauthmysql.so may help). authmethod /usr/local/lib/muddleftpd/libauthmysql.so To configure authlibmysql, the following directives have been added. You must specify these in the group section that is being configured. mysql_host This specifies the host the MySQL server is located on. If you do not specify this value, authlibmysql will assume the host is 'localhost'. (the same computer as the ftp server) mysql_port This specifies what TCP port number to connect to the MySQL server using. If it is not supplied, the default MySQL port is used. mysql_database This specifies what database to use on the MySQL server. It is advisable not to use the master database. You must specify this value for authlibmysql to work. mysql_user This specifies the username to access the MySQL server as. This user should only require read access. You must specify this value, otherwise authlibmysql will refuse to work. mysql_password This specifies the password paired to the username used to access the MySQL server. You must specify this value. mysql_table This specifies the table to read user password data from. By default, this is 'users'. This is not used if you specify a custom query string. mysql_encryption This specifies the type of encryption to use on passwords. There are three options avaliable: a) 'plaintext' Passwords are stored with no encryption at all. Anybody with read access to the database can steal the passwords. You should set muddleftpd.conf to 600 permissions if you use this setting. b) 'crypt' Use the standard unix crypt() call to test passwords, so they typically end up as the same format as the password file c) 'mysql' Use MySQL's builtin function password() to test passwords. This is portable, and is easy to use within MySQL scripts. The default option for mysql_encryption is 'mysql' mysql_query (ADVANCED OPTION) This specifies the query to use to get data from the database. It should be a SELECT query that returns data in the following order: 1) password: The password of the user, in the selected encrypted form. 2) home directory: The home directory of the user. 3) root directory: The root directory of the user. 4) uid: An integer value for the user's uid. 5) gid: An integer value for the user's gid. This SELECT query should only return 1 result if the user exists, or no results if the user does not exist. You can use this option if the field names do not match the ones documented above. An example (must be entered on a single line in the config file): mysql_query SELECT pass,home,root,useruid,usergid FROM usertable WHERE user='%U' You can also use this option if data is spread among multiple tables. Another example (must still be on a single line in the config file!): mysql_query SELECT P.pass,C.home,C.root,C.uid,C.gid FROM passwd P, credtable C WHERE P.user=C.user AND P.user='%U' This gets data from the password table, and joins it with data from the credentials table to provide data for authlibmysql. GROUP EFFECTS: If authlibmysql finds a single result for a query, and the data checks out ok, then it will accept the username, and authenticate for it. If it finds no result for the query, then it will pass the username onto the next group section. If more than one result is returned, or an error occured along the way, authlibmysql will cancel authentication for that user. FURTHER NOTES: * You should avoid using plaintext stored passwords, especially since anyone who can read the configuration file can steal all the passwords in the MySQL database. AUTHORS: Beau Kuiper (support@muddleftpd.cx) muddleftpd-1.3.13.1/modules/auth/authlibmysql/auth.h0100644000175000017500000001240607751235260021340 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Includes */ #include #include #include #include #ifndef INT_MAX #define INT_MAX 0x7FFFFFFF #endif /* Inportant Constants */ /* yep, true and false */ #define FALSE 0 #define TRUE !FALSE /* constants declaring various log levels. */ #define MYLOG_DACCESS 1 /* denied access to server because of ip */ #define MYLOG_FTRANS 2 /* file transfer */ #define MYLOG_COMMAND 4 /* command from client */ #define MYLOG_RESPONSE 8 /* respone to client commands */ #define MYLOG_INFO 16 /* informational logs */ #define MYLOG_LOGIN 32 /* login information */ #define MYLOG_DEBUG 64 /* debug log */ /* set err to this to tell the server the result of getting an auth handle */ #define AUTH_OK 0 /* got handle, everything good */ #define AUTH_USERNKNOW 1 /* This module is not responsible for current user, move to next module */ #define AUTH_ERROR 2 /* A bad error occured, stop attempting to authenticate user */ /* a couple of macros to help :-) */ #define MAXIMUM(x, y) (x) > (y) ? (x) : (y) #define MINIMUM(x, y) (x) > (y) ? (y) : (x) /* Typedefs */ /* NEWFILE is a structure used with muddleftpd special text file handling routines. Don't directly modify its structure */ typedef struct { int fd; void *buffer; int eof; } NEWFILE; /* here as some prototypes for functions you can use */ /* MEMORY FUNCTIONS */ /* Just like malloc, but it checks for out of memory */ extern void *mallocwrapper(int size); /* Almost same a realloc, execpt supply double pointer of memory area(inarea) * and the new size */ void reallocwrapper(int size, void **inarea); /* Same as strdup, but checks for out of memory result */ char *strdupwrapper(char *s); /* to free areas created by strdupwrapper and mallocwrapper, It also updates * counters used to determine memory leakage, so you should use this instead * of plain free() */ void freewrapper(void *tofree); /* just memmove because muddleftpd will supply a replacement if the system * doesn't supply one */ #ifndef HAVE_MEMMOVE char *memmove(void *dest, void *src, int n); #endif /* STRING FUNCTIONS */ /* This drops all characaters with a code < 32 in the string suppled. This is * done in place */ void strtrimspace(char *string); /* This counts to number of occurences of char tok in the supplied string */ int strchrcount(char *string, char tok); /* this is vsprintf except the result is given as a string allocated using * mallocwrapper. Use freewrapper to reclaim the space it uses */ char *safe_vsnprintf(char *format, va_list ap); /* this is the same as sprintf execpt the result is given as a string allocated * in dynamic memory using mallocwrapper. Use freewrapper to free it */ char *safe_snprintf(char *format, ...); /* gets suplementary gids of user */ gid_t *getusergrouplist(char *username); /* these are for really bad errors. Don't use either errormsg or errormsgfatal. * Use the ERRORMSG and ERRORMSGFATAL macros instead. BTW, ONLY USE THESE * FOR ERRORS THAT CANNOT BE SOLVED ANYWAY ELSE */ void errormsg( char *errmessage, char *file, int line ); void errormsgfatal( char *errmessage, char *file, int line ); #define ERRORMSGFATAL(x) errormsgfatal(x, __FILE__, __LINE__) #define ERRORMSG(x) errormsg(x, __FILE__, __LINE__) /* LOG OPERATIONS */ /* Adds a log entry to muddleftpd's logs. type is one of the constants * specified above. peer is the same peer pointer passed to the gethandle * function. desc is the string to add to the log */ extern void log_addentry(int type, void *peer, char *desc); /* Exactly the same a log_addentry, but muddleftpd will use freewrapper * on desc so you can use safe_snprintf for desc */ extern void log_giveentry(int type, void *peer, char *desc); /* the debug log */ extern void debuglog(char *format, ...); /* CONFIF FILE OPERATIONS */ char *strsplit(char *, char *, char *); void substitute(char **inputstr, char *strin, char *strout); int loadconfigfile(char *filename, int (* confighandler)(char *, char *, int, void *), void *configdata); void *loadconfigcache(char *filename); char *mktokconfstr(void *tset, int section, char *setting, char *defaul); void loadintfromconfig(void *cache, int section, char *setting, int *to, int def); void loadstrfromconfig(void *cache, int section, char *setting, char **to, char *def); void freeconfigcache(void *cache); char **makeconfiglist(void *cache, char *section, char *label); extern NEWFILE *nfopen(char *filename); extern NEWFILE *nfdopen(int fd); extern char *nfgetcs(NEWFILE *file, char testchar); extern void nfclose(NEWFILE *file); extern int chkpassword(char *, char *); muddleftpd-1.3.13.1/modules/auth/authlibmysql/configure.ac0100644000175000017500000000637707751243375022534 0ustar joergjoergdnl Process this file with autoconf to produce a configure script. AC_INIT AC_PREREQ(2.54) AC_CONFIG_SRCDIR([authmysql.c]) AC_CONFIG_HEADER(config.h) dnl Checks for programs. AC_PROG_CC dnl Checks for libraries. dnl Checks for header files. AC_CHECK_HEADERS(unistd.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_STRUCT_TM dnl Checks for library functions. AC_HEADER_STDC dnl Check functions AC_CHECK_FUNCS(memmove) default_directory="/usr /usr/local" AC_DEFUN(FAIL_MESSAGE,[ echo echo echo "**********************************************" echo " ERROR: unable to find" $1 echo " checked in the following places" for i in `echo $2`; do echo " $i" done echo "**********************************************" echo exit ]) AC_ARG_WITH(authmysql, AC_HELP_STRING([--with-authmysql=DIR],[Create MySQL authentication module, optionally specify dir of mysql files]), [ with_mysql="$withval" ], [ with_mysql=no ]) if test "$with_mysql" != "no"; then if test "$with_mysql" = "yes"; then mysql_directory="$default_directory"; mysql_fail="yes" elif test -d $withval; then mysql_directory="$withval" mysql_fail="no" elif test "$with_mysql" = ""; then mysql_directory="$default_directory"; mysql_fail="no" fi AC_MSG_CHECKING(for mysql) for i in $mysql_directory; do if test -r $i/include/mysql/mysql.h; then MYSQL_DIR=$i MYSQL_INC_DIR=$i/include/mysql elif test -r $i/include/mysql.h; then MYSQL_DIR=$i MYSQL_INC_DIR=$i/include fi done if test -z "$MYSQL_DIR"; then if test "$mysql_fail" != "no"; then tmp="" for i in $mysql_directory; do tmp="$tmp $i/include $i/include/mysql" done FAIL_MESSAGE("mysql headers (mysql.h)", $tmp) else AC_MSG_RESULT(no) fi else for i in lib lib/mysql; do str="$MYSQL_DIR/$i/libmysqlclient.*" for j in `echo $str`; do if test -r $j; then MYSQL_LIB_DIR="$MYSQL_DIR/$i" break 2 fi done done if test -z "$MYSQL_LIB_DIR"; then if test "$mysql_fail" != "no"; then FAIL_MESSAGE("mysqlclient library", "$MYSQL_DIR/lib $MYSQL_DIR/lib/mysql") else AC_MSG_RESULT(no) fi else AC_MSG_RESULT(yes) CFLAGS="$CFLAGS -I${MYSQL_INC_DIR}" LDFLAGS="${LDFLAGS} -L${MYSQL_LIB_DIR}" dnl CPPFLAGS="${CPPFLAGS} -I${MYSQL_INC_DIR} -DENABLE_MYSQL" LIBS="-lmysqlclient ${LIBS}" fi fi fi dnl CFLAGS="$CFLAGS -I$mysqltop/include" dnl LIBS="$LIBS $mysqltop/lib/libmysqlclient.a" dnl AC_ARG_WITH(mysqlpath, dnl AC_HELP_STRING([--with-mysqlpath], [specify the top level of the mysql installation tree. (default is /usr/local/mysql)]), dnl mysqltop=$withval, mysqltop=/usr/local/mysql dnl ) dnl AC_MSG_CHECKING([for mysql in directory $mysqltop]) dnl if test "X$mysqltop" = "X" dnl then dnl AC_MSG_RESULT([no]) dnl AC_MSG_ERROR([msql directory not specified]) dnl fi dnl if test -d $mysqltop dnl then dnl AC_MSG_RESULT([yes]) dnl CFLAGS="$CFLAGS -I$mysqltop/include" dnl LIBS="$LIBS $mysqltop/lib/libmysqlclient.a" dnl else dnl AC_MSG_RESULT([no]) dnl AC_MSG_ERROR([mysql directory not found!]) dnl fi AC_CONFIG_FILES([Makefile]) AC_OUTPUT muddleftpd-1.3.13.1/modules/auth/authlibmysql/configure0100755000175000017500000036140607751444701022146 0ustar joergjoerg#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57. # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="authmysql.c" # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-authmysql=DIR Create MySQL authentication module, optionally specify dir of mysql files Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd "$ac_popdir" done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6 if test "${ac_cv_struct_tm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct tm *tp; tp->tm_sec; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_struct_tm=time.h else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_struct_tm=sys/time.h fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 echo "${ECHO_T}$ac_cv_struct_tm" >&6 if test $ac_cv_struct_tm = sys/time.h; then cat >>confdefs.h <<\_ACEOF #define TM_IN_SYS_TIME 1 _ACEOF fi echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi for ac_func in memmove do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done default_directory="/usr /usr/local" # Check whether --with-authmysql or --without-authmysql was given. if test "${with_authmysql+set}" = set; then withval="$with_authmysql" with_mysql="$withval" else with_mysql=no fi; if test "$with_mysql" != "no"; then if test "$with_mysql" = "yes"; then mysql_directory="$default_directory"; mysql_fail="yes" elif test -d $withval; then mysql_directory="$withval" mysql_fail="no" elif test "$with_mysql" = ""; then mysql_directory="$default_directory"; mysql_fail="no" fi echo "$as_me:$LINENO: checking for mysql" >&5 echo $ECHO_N "checking for mysql... $ECHO_C" >&6 for i in $mysql_directory; do if test -r $i/include/mysql/mysql.h; then MYSQL_DIR=$i MYSQL_INC_DIR=$i/include/mysql elif test -r $i/include/mysql.h; then MYSQL_DIR=$i MYSQL_INC_DIR=$i/include fi done if test -z "$MYSQL_DIR"; then if test "$mysql_fail" != "no"; then tmp="" for i in $mysql_directory; do tmp="$tmp $i/include $i/include/mysql" done echo echo echo "**********************************************" echo " ERROR: unable to find" "mysql headers (mysql.h)" echo " checked in the following places" for i in `echo $tmp`; do echo " $i" done echo "**********************************************" echo exit else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi else for i in lib lib/mysql; do str="$MYSQL_DIR/$i/libmysqlclient.*" for j in `echo $str`; do if test -r $j; then MYSQL_LIB_DIR="$MYSQL_DIR/$i" break 2 fi done done if test -z "$MYSQL_LIB_DIR"; then if test "$mysql_fail" != "no"; then echo echo echo "**********************************************" echo " ERROR: unable to find" "mysqlclient library" echo " checked in the following places" for i in `echo "$MYSQL_DIR/lib $MYSQL_DIR/lib/mysql"`; do echo " $i" done echo "**********************************************" echo exit else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi else echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 CFLAGS="$CFLAGS -I${MYSQL_INC_DIR}" LDFLAGS="${LDFLAGS} -L${MYSQL_LIB_DIR}" LIBS="-lmysqlclient ${LIBS}" fi fi fi ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by $as_me, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi muddleftpd-1.3.13.1/modules/auth/authlibmysql/config.h.in0100644000175000017500000000264207751444702022255 0ustar joergjoerg/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME muddleftpd-1.3.13.1/modules/auth/authlibsmb/0040755000175000017500000000000007751444705017650 5ustar joergjoergmuddleftpd-1.3.13.1/modules/auth/authlibsmb/Makefile.in0100644000175000017500000000130707751443764021717 0ustar joergjoerg DEFS=@DEFS@ CFLAGS=@CFLAGS@ CC=@CC@ LIBS=@LIBS@ SRC=authsmb.c OBJ=$(SRC:.c=.o) prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@/muddleftpd LIBNAME=libauthsmb.so DOCDIR=@datadir@ all: $(OBJ) smbvalid $(CC) $(CFLAGS) $(LIBS) -shared -fPIC -Xlinker -x -o $(LIBNAME) $(OBJ) smbval/smbvalid.a smbvalid: $(MAKE) -C smbval install: all mkdir -p $(libdir) mkdir -p $(DOCDIR)/doc/muddleftpd install README -m 644 $(DOCDIR)/doc/muddleftpd/README.authsmb install $(LIBNAME) -m 644 $(libdir) clean: $(MAKE) -C smbval clean rm -f *.o *~ DEADJOE $(LIBNAME) distclean: clean rm -f config.h Makefile config.log config.cache config.status maintainer-clean: distclean rm -f configure config.h.in muddleftpd-1.3.13.1/modules/auth/authlibsmb/CHANGES0100644000175000017500000000004107554515351020630 0ustar joergjoergVersion 0.1 1) Inital release. muddleftpd-1.3.13.1/modules/auth/authlibsmb/authsmb.c0100644000175000017500000000721007554515351021451 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #include "auth.h" #include #include #include #include "valid.h" /* This file contains code to autheticate against smb servers */ typedef struct { struct passwd *passent; char *domainname; char *primaryname; char *secondaryname; } PASSWDSTRUCT; void freehandle(void *handle) { PASSWDSTRUCT *h = (PASSWDSTRUCT *)handle; if (h->domainname) freewrapper(h->domainname); if (h->primaryname) freewrapper(h->primaryname); if (h->secondaryname) freewrapper(h->secondaryname); freewrapper(handle); } void *gethandle(void *peer, void *tset, char *username, int *err) { PASSWDSTRUCT *newhandle; int section, localpwd; char *authuser = NULL; section = auth_getcursectionid(peer); newhandle = (PASSWDSTRUCT *)mallocwrapper(sizeof(PASSWDSTRUCT)); newhandle->domainname = mktokconfstr(tset, section, "smb_domain", NULL); newhandle->primaryname = mktokconfstr(tset, section, "smb_primary", NULL); newhandle->secondaryname = mktokconfstr(tset, section, "smb_secondary", NULL); if (newhandle->domainname == NULL) { log_addentry(MYLOG_INFO, NULL, "libauthsmb REQUIRES smb_domain to supply domain to authenticate against!"); goto error; } if (newhandle->primaryname == NULL) { log_addentry(MYLOG_INFO, NULL, "libauthsmb REQUIRES smb_primary to supply host to authenticate against!"); goto error; } if (newhandle->secondaryname == NULL) newhandle->secondaryname = strdupwrapper(newhandle->primaryname); authuser = mktokconfstr(tset, section, "smb_localuser", NULL); if (authuser) { newhandle->passent = getpwnam(authuser); if (newhandle->passent == NULL) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("libauthsmb couldn't find local username '%s'", authuser)); goto error; } } else { newhandle->passent = getpwnam(username); if (newhandle->passent == NULL) goto errornouser; } if (authuser) freewrapper(authuser); *err = AUTH_OK; return(newhandle); error: *err = AUTH_ERROR; goto cleanuperror; errornouser: *err = AUTH_USERNKNOW; cleanuperror: freehandle((void *)newhandle); if (authuser) freewrapper(authuser); return(NULL); } int chkpasswd(void *handle, char *password, char **errmsg) { PASSWDSTRUCT *h = (PASSWDSTRUCT *)handle; int result; result = Valid_User(h->passent->pw_name, password, h->primaryname, h->secondaryname, h->domainname); switch (result) { case 0: return(TRUE); case 1: case 2: log_giveentry(MYLOG_INFO, NULL, safe_snprintf("smbauth - Domain '%s' unavailable", h->domainname)); case 3: default: return(FALSE); } return(FALSE); } char *gethomedir(void *h) { return(((PASSWDSTRUCT *)h)->passent->pw_dir); } char *getrootdir(void *h) { return("/"); } uid_t getuseruid(void *h) { return(((PASSWDSTRUCT *)h)->passent->pw_uid); } gid_t getusergid(void *h) { return(((PASSWDSTRUCT *)h)->passent->pw_gid); } gid_t *getusersupgid(void *h) { return(getusergrouplist(((PASSWDSTRUCT *)h)->passent->pw_name)); } muddleftpd-1.3.13.1/modules/auth/authlibsmb/README0100644000175000017500000000613007751246516020525 0ustar joergjoergSMB authentication Module. (authlibsmb) Version 0.1 This module allows muddleftpd 1.3.4 and above authenticate against SMB servers. This module will authenticate against the user list on any SMB domain server, including both windows NT and Samba. Note: This code is heavily dirived from the smb pam module. It is essentually a front end for the smb pam module backend. Kudos to the maintainers smb pam module for the good work. Note: Although this code is dirived from the smb pam module, It does not require pam to operate. DEPENDANCIES: A smb server somewhere available. Also, authlibsmb requires that each user you wish to authenticate has a local password entry. (unless you use the smb_localuser directive, where all smb users use the same local username) BUILDING: To build, execute the following in the authlibsmb source directory: ./configure make Or simply build it with the rest of muddleftpd, add --with-authsmb to the configuration options of that configure script. Then the file libauthsmb.so can be copied to the directory you with to store muddleftpd modules in. This directory must be secure, so users cannot overwrite the module with a cracked version. By default it is put into @prefix@/lib from configure, if you dont set prefix this is /usr/local/lib/muddleftpd. USAGE: In the groups that you wish authlibsmb to authenticate, you need to use the following to tell muddleftpd to use the authlibsmb module, replacing the directory with the directory the authentication module is stored in: (If unsure a locate libauthsmb.so may help). authmodule /usr/local/lib/muddleftpd/libauthsmb.so To configure libauthsmb, the following directives have been added. You must specify these in the group section that is being configured. smb_domain This specifies is the domain/workgroup that contains the domain server to authenticate against. THIS PARAMTER IS REQUIRED smb_primary This specifies the netbios name of the domain server, that is used to authenticate against. THIS PARAMETER IS REQUIRED smb_secondary This specifies the netbios name of the secondary domain server, that is used to authenticate against. THIS PARAMETER IS OPTIONAL smb_localuser This specifies the local user on the system (from the password file) that smb users will access the system ass. If omitted, authlibsmb will use the login username. GROUP EFFECTS: If smb_localuser is specified, authlibsmb will accept any username given to it, regardless of whether or not it exists on the SMB server. This does not mean it will log the user in, it will simply not pass the username onto the next group section. You will have to use nameacl to limit this if required. If smb_localuser is not specified, authlibsmb will only accept usernames that also exist in the local password file. Users not found in the local password file will be passed onto the next muddleftpd group section. FURTHER NOTES: * authlibsmb cannot detect the difference between a username not existing on a domain server and the password being incorrect. AUTHORS: Beau Kuiper (support@muddleftpd.cx) muddleftpd-1.3.13.1/modules/auth/authlibsmb/auth.h0100644000175000017500000001240607751235026020754 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Includes */ #include #include #include #include #ifndef INT_MAX #define INT_MAX 0x7FFFFFFF #endif /* Inportant Constants */ /* yep, true and false */ #define FALSE 0 #define TRUE !FALSE /* constants declaring various log levels. */ #define MYLOG_DACCESS 1 /* denied access to server because of ip */ #define MYLOG_FTRANS 2 /* file transfer */ #define MYLOG_COMMAND 4 /* command from client */ #define MYLOG_RESPONSE 8 /* respone to client commands */ #define MYLOG_INFO 16 /* informational logs */ #define MYLOG_LOGIN 32 /* login information */ #define MYLOG_DEBUG 64 /* debug log */ /* set err to this to tell the server the result of getting an auth handle */ #define AUTH_OK 0 /* got handle, everything good */ #define AUTH_USERNKNOW 1 /* This module is not responsible for current user, move to next module */ #define AUTH_ERROR 2 /* A bad error occured, stop attempting to authenticate user */ /* a couple of macros to help :-) */ #define MAXIMUM(x, y) (x) > (y) ? (x) : (y) #define MINIMUM(x, y) (x) > (y) ? (y) : (x) /* Typedefs */ /* NEWFILE is a structure used with muddleftpd special text file handling routines. Don't directly modify its structure */ typedef struct { int fd; void *buffer; int eof; } NEWFILE; /* here as some prototypes for functions you can use */ /* MEMORY FUNCTIONS */ /* Just like malloc, but it checks for out of memory */ extern void *mallocwrapper(int size); /* Almost same a realloc, execpt supply double pointer of memory area(inarea) * and the new size */ void reallocwrapper(int size, void **inarea); /* Same as strdup, but checks for out of memory result */ char *strdupwrapper(char *s); /* to free areas created by strdupwrapper and mallocwrapper, It also updates * counters used to determine memory leakage, so you should use this instead * of plain free() */ void freewrapper(void *tofree); /* just memmove because muddleftpd will supply a replacement if the system * doesn't supply one */ #ifndef HAVE_MEMMOVE char *memmove(void *dest, void *src, int n); #endif /* STRING FUNCTIONS */ /* This drops all characaters with a code < 32 in the string suppled. This is * done in place */ void strtrimspace(char *string); /* This counts to number of occurences of char tok in the supplied string */ int strchrcount(char *string, char tok); /* this is vsprintf except the result is given as a string allocated using * mallocwrapper. Use freewrapper to reclaim the space it uses */ char *safe_vsnprintf(char *format, va_list ap); /* this is the same as sprintf execpt the result is given as a string allocated * in dynamic memory using mallocwrapper. Use freewrapper to free it */ char *safe_snprintf(char *format, ...); /* gets suplementary gids of user */ gid_t *getusergrouplist(char *username); /* these are for really bad errors. Don't use either errormsg or errormsgfatal. * Use the ERRORMSG and ERRORMSGFATAL macros instead. BTW, ONLY USE THESE * FOR ERRORS THAT CANNOT BE SOLVED ANYWAY ELSE */ void errormsg( char *errmessage, char *file, int line ); void errormsgfatal( char *errmessage, char *file, int line ); #define ERRORMSGFATAL(x) errormsgfatal(x, __FILE__, __LINE__) #define ERRORMSG(x) errormsg(x, __FILE__, __LINE__) /* LOG OPERATIONS */ /* Adds a log entry to muddleftpd's logs. type is one of the constants * specified above. peer is the same peer pointer passed to the gethandle * function. desc is the string to add to the log */ extern void log_addentry(int type, void *peer, char *desc); /* Exactly the same a log_addentry, but muddleftpd will use freewrapper * on desc so you can use safe_snprintf for desc */ extern void log_giveentry(int type, void *peer, char *desc); /* the debug log */ extern void debuglog(char *format, ...); /* CONFIF FILE OPERATIONS */ char *strsplit(char *, char *, char *); void substitute(char **inputstr, char *strin, char *strout); int loadconfigfile(char *filename, int (* confighandler)(char *, char *, int, void *), void *configdata); void *loadconfigcache(char *filename); char *mktokconfstr(void *tset, int section, char *setting, char *defaul); void loadintfromconfig(void *cache, int section, char *setting, int *to, int def); void loadstrfromconfig(void *cache, int section, char *setting, char **to, char *def); void freeconfigcache(void *cache); char **makeconfiglist(void *cache, char *section, char *label); extern NEWFILE *nfopen(char *filename); extern NEWFILE *nfdopen(int fd); extern char *nfgetcs(NEWFILE *file, char testchar); extern void nfclose(NEWFILE *file); extern int chkpassword(char *, char *); muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/0040755000175000017500000000000007751444665021141 5ustar joergjoergmuddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/Makefile.in0100644000175000017500000000113207554515351023170 0ustar joergjoerg# makefile for smblib # Type make system, where system is ULTRIX, DU, DECOSF1, Solaris etc AR = ar INCLUDES = smblib.h smblib-priv.h RFCNB = session.o rfcnb-util.o rfcnb-io.o OBJS = smblib.o smblib-util.o file.o smb-errors.o exper.o smblib-api.o smbencrypt.o smbdes.o md4.o VALIDATE = valid.o session.o rfcnb-util.o \ rfcnb-io.o smblib-util.o smblib.o smbencrypt.o smbdes.o md4.o .SUFFIXES: .c .o .h dummy: all smbvalid.a: $(VALIDATE) $(AR) rcs smbvalid.a $(VALIDATE) all: smbvalid.a .c.o: $(INCLUDES) @echo Compiling $*.c $(CC) $(CFLAGS) -c $*.c clean: rm -f *.o smbvalid.a muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/byteorder.h0100644000175000017500000000565007554515351023304 0ustar joergjoerg/* Unix SMB/Netbios implementation. Version 1.9. SMB Byte handling Copyright (C) Andrew Tridgell 1992-1995 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* This file implements macros for machine independent short and int manipulation */ #undef CAREFUL_ALIGNMENT /* we know that the 386 can handle misalignment and has the "right" byteorder */ #ifdef __i386__ #define CAREFUL_ALIGNMENT 0 #endif #ifndef CAREFUL_ALIGNMENT #define CAREFUL_ALIGNMENT 1 #endif #define CVAL(buf,pos) (((unsigned char *)(buf))[pos]) #define PVAL(buf,pos) ((unsigned)CVAL(buf,pos)) #define SCVAL(buf,pos,val) (CVAL(buf,pos) = (val)) #if CAREFUL_ALIGNMENT #define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8) #define IVAL(buf,pos) (SVAL(buf,pos)|SVAL(buf,(pos)+2)<<16) #define SSVALX(buf,pos,val) (CVAL(buf,pos)=(val)&0xFF,CVAL(buf,pos+1)=(val)>>8) #define SIVALX(buf,pos,val) (SSVALX(buf,pos,val&0xFFFF),SSVALX(buf,pos+2,val>>16)) #define SVALS(buf,pos) ((int16)SVAL(buf,pos)) #define IVALS(buf,pos) ((int32)IVAL(buf,pos)) #define SSVAL(buf,pos,val) SSVALX((buf),(pos),((uint16)(val))) #define SIVAL(buf,pos,val) SIVALX((buf),(pos),((uint32)(val))) #define SSVALS(buf,pos,val) SSVALX((buf),(pos),((int16)(val))) #define SIVALS(buf,pos,val) SIVALX((buf),(pos),((int32)(val))) #else /* this handles things for architectures like the 386 that can handle alignment errors */ /* WARNING: This section is dependent on the length of int16 and int32 being correct */ #define SVAL(buf,pos) (*(uint16 *)((char *)(buf) + (pos))) #define IVAL(buf,pos) (*(uint32 *)((char *)(buf) + (pos))) #define SVALS(buf,pos) (*(int16 *)((char *)(buf) + (pos))) #define IVALS(buf,pos) (*(int32 *)((char *)(buf) + (pos))) #define SSVAL(buf,pos,val) SVAL(buf,pos)=((uint16)(val)) #define SIVAL(buf,pos,val) IVAL(buf,pos)=((uint32)(val)) #define SSVALS(buf,pos,val) SVALS(buf,pos)=((int16)(val)) #define SIVALS(buf,pos,val) IVALS(buf,pos)=((int32)(val)) #endif /* now the reverse routines - these are used in nmb packets (mostly) */ #define SREV(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF)) #define IREV(x) ((SREV(x)<<16) | (SREV((x)>>16))) #define RSVAL(buf,pos) SREV(SVAL(buf,pos)) #define RIVAL(buf,pos) IREV(IVAL(buf,pos)) #define RSSVAL(buf,pos,val) SSVAL(buf,pos,SREV(val)) #define RSIVAL(buf,pos,val) SIVAL(buf,pos,IREV(val)) muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/md4.c0100644000175000017500000001040007554515351021751 0ustar joergjoerg/* Unix SMB/Netbios implementation. Version 1.9. a implementation of MD4 designed for use in the SMB authentication protocol Copyright (C) Andrew Tridgell 1997 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* NOTE: This code makes no attempt to be fast! It assumes that a int is at least 32 bits long */ #include typedef unsigned int uint32; static uint32 A, B, C, D; static uint32 F(uint32 X, uint32 Y, uint32 Z) { return (X&Y) | ((~X)&Z); } static uint32 G(uint32 X, uint32 Y, uint32 Z) { return (X&Y) | (X&Z) | (Y&Z); } static uint32 H(uint32 X, uint32 Y, uint32 Z) { return X^Y^Z; } static uint32 lshift(uint32 x, int s) { x &= 0xFFFFFFFF; return ((x<>(32-s)); } #define ROUND1(a,b,c,d,k,s) a = lshift(a + F(b,c,d) + X[k], s) #define ROUND2(a,b,c,d,k,s) a = lshift(a + G(b,c,d) + X[k] + (uint32)0x5A827999,s) #define ROUND3(a,b,c,d,k,s) a = lshift(a + H(b,c,d) + X[k] + (uint32)0x6ED9EBA1,s) /* this applies md4 to 64 byte chunks */ static void mdfour64(uint32 *M) { int j; uint32 AA, BB, CC, DD; uint32 X[16]; for (j=0;j<16;j++) X[j] = M[j]; AA = A; BB = B; CC = C; DD = D; ROUND1(A,B,C,D, 0, 3); ROUND1(D,A,B,C, 1, 7); ROUND1(C,D,A,B, 2, 11); ROUND1(B,C,D,A, 3, 19); ROUND1(A,B,C,D, 4, 3); ROUND1(D,A,B,C, 5, 7); ROUND1(C,D,A,B, 6, 11); ROUND1(B,C,D,A, 7, 19); ROUND1(A,B,C,D, 8, 3); ROUND1(D,A,B,C, 9, 7); ROUND1(C,D,A,B, 10, 11); ROUND1(B,C,D,A, 11, 19); ROUND1(A,B,C,D, 12, 3); ROUND1(D,A,B,C, 13, 7); ROUND1(C,D,A,B, 14, 11); ROUND1(B,C,D,A, 15, 19); ROUND2(A,B,C,D, 0, 3); ROUND2(D,A,B,C, 4, 5); ROUND2(C,D,A,B, 8, 9); ROUND2(B,C,D,A, 12, 13); ROUND2(A,B,C,D, 1, 3); ROUND2(D,A,B,C, 5, 5); ROUND2(C,D,A,B, 9, 9); ROUND2(B,C,D,A, 13, 13); ROUND2(A,B,C,D, 2, 3); ROUND2(D,A,B,C, 6, 5); ROUND2(C,D,A,B, 10, 9); ROUND2(B,C,D,A, 14, 13); ROUND2(A,B,C,D, 3, 3); ROUND2(D,A,B,C, 7, 5); ROUND2(C,D,A,B, 11, 9); ROUND2(B,C,D,A, 15, 13); ROUND3(A,B,C,D, 0, 3); ROUND3(D,A,B,C, 8, 9); ROUND3(C,D,A,B, 4, 11); ROUND3(B,C,D,A, 12, 15); ROUND3(A,B,C,D, 2, 3); ROUND3(D,A,B,C, 10, 9); ROUND3(C,D,A,B, 6, 11); ROUND3(B,C,D,A, 14, 15); ROUND3(A,B,C,D, 1, 3); ROUND3(D,A,B,C, 9, 9); ROUND3(C,D,A,B, 5, 11); ROUND3(B,C,D,A, 13, 15); ROUND3(A,B,C,D, 3, 3); ROUND3(D,A,B,C, 11, 9); ROUND3(C,D,A,B, 7, 11); ROUND3(B,C,D,A, 15, 15); A += AA; B += BB; C += CC; D += DD; A &= 0xFFFFFFFF; B &= 0xFFFFFFFF; C &= 0xFFFFFFFF; D &= 0xFFFFFFFF; for (j=0;j<16;j++) X[j] = 0; } static void copy64(uint32 *M, unsigned char *in) { int i; for (i=0;i<16;i++) M[i] = (in[i*4+3]<<24) | (in[i*4+2]<<16) | (in[i*4+1]<<8) | (in[i*4+0]<<0); } static void copy4(unsigned char *out,uint32 x) { out[0] = x&0xFF; out[1] = (x>>8)&0xFF; out[2] = (x>>16)&0xFF; out[3] = (x>>24)&0xFF; } /* produce a md4 message digest from data of length n bytes */ void mdfour(unsigned char *out, unsigned char *in, int n) { unsigned char buf[128]; uint32 M[16]; uint32 b = n * 8; int i; A = 0x67452301; B = 0xefcdab89; C = 0x98badcfe; D = 0x10325476; while (n > 64) { copy64(M, in); mdfour64(M); in += 64; n -= 64; } for (i=0;i<128;i++) buf[i] = 0; memcpy(buf, in, n); buf[n] = 0x80; if (n <= 55) { copy4(buf+56, b); copy64(M, buf); mdfour64(M); } else { copy4(buf+120, b); copy64(M, buf); mdfour64(M); copy64(M, buf+64); mdfour64(M); } for (i=0;i<128;i++) buf[i] = 0; copy64(M, buf); copy4(out, A); copy4(out+4, B); copy4(out+8, C); copy4(out+12, D); A = B = C = D = 0; } muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/rfcnb-common.h0100644000175000017500000000177407554515351023670 0ustar joergjoerg/* UNIX RFCNB (RFC1001/RFC1002) NetBIOS implementation Version 1.0 RFCNB Common Structures etc Defines Copyright (C) Richard Sharpe 1996 */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* A data structure we need */ typedef struct RFCNB_Pkt { char * data; /* The data in this portion */ int len; struct RFCNB_Pkt *next; } RFCNB_Pkt; muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/rfcnb-error.h0100644000175000017500000000650107554515351023522 0ustar joergjoerg/* UNIX RFCNB (RFC1001/RFC1002) NetBIOS implementation Version 1.0 RFCNB Error Response Defines Copyright (C) Richard Sharpe 1996 */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Error responses */ #define RFCNBE_Bad -1 /* Bad response */ #define RFCNBE_OK 0 /* these should follow the spec ... is there one ?*/ #define RFCNBE_NoSpace 1 /* Could not allocate space for a struct */ #define RFCNBE_BadName 2 /* Could not translate a name */ #define RFCNBE_BadRead 3 /* Read sys call failed */ #define RFCNBE_BadWrite 4 /* Write Sys call failed */ #define RFCNBE_ProtErr 5 /* Protocol Error */ #define RFCNBE_ConGone 6 /* Connection dropped */ #define RFCNBE_BadHandle 7 /* Handle passed was bad */ #define RFCNBE_BadSocket 8 /* Problems creating socket */ #define RFCNBE_ConnectFailed 9 /* Connect failed */ #define RFCNBE_CallRejNLOCN 10 /* Call rejected, not listening on CN */ #define RFCNBE_CallRejNLFCN 11 /* Call rejected, not listening for CN */ #define RFCNBE_CallRejCNNP 12 /* Call rejected, called name not present */ #define RFCNBE_CallRejInfRes 13/* Call rejetced, name ok, no resources */ #define RFCNBE_CallRejUnSpec 14/* Call rejected, unspecified error */ #define RFCNBE_BadParam 15/* Bad parameters passed ... */ #define RFCNBE_Timeout 16/* IO Timed out */ /* Text strings for the error responses */ static char *RFCNB_Error_Strings[] = { "RFCNBE_OK: Routine completed successfully.", "RFCNBE_NoSpace: No space available for a malloc call.", "RFCNBE_BadName: NetBIOS name could not be translated to IP address.", "RFCNBE_BadRead: Read system call returned an error. Check errno.", "RFCNBE_BadWrite: Write system call returned an error. Check errno.", "RFCNBE_ProtErr: A protocol error has occurred.", "RFCNBE_ConGone: Connection dropped during a read or write system call.", "RFCNBE_BadHandle: Bad connection handle passed.", "RFCNBE_BadSocket: Problems creating socket.", "RFCNBE_ConnectFailed: Connection failed. See errno.", "RFCNBE_CallRejNLOCN: Call rejected. Not listening on called name.", "RFCNBE_CallRejNLFCN: Call rejected. Not listening for called name.", "RFCNBE_CallRejCNNP: Call rejected. Called name not present.", "RFCNBE_CallRejInfRes: Call rejected. Name present, but insufficient resources.", "RFCNBE_CallRejUnSpec: Call rejected. Unspecified error.", "RFCNBE_BadParam: Bad parameters passed to a routine.", "RFCNBE_Timeout: IO Operation timed out ..." }; muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/rfcnb-io.c0100644000175000017500000002275307554515351023002 0ustar joergjoerg/* UNIX RFCNB (RFC1001/RFC1002) NEtBIOS implementation Version 1.0 RFCNB IO Routines ... Copyright (C) Richard Sharpe 1996 */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* #include */ #include "std-includes.h" #include "rfcnb-priv.h" #include "rfcnb-util.h" #include "rfcnb-io.h" #include #include #include int RFCNB_Timeout = 0; /* Timeout in seconds ... */ void rfcnb_alarm(int sig) { fprintf(stderr, "IO Timed out ...\n"); } /* Set timeout value and setup signal handling */ int RFCNB_Set_Timeout(int seconds) { int temp; /* If we are on a Bezerkeley system, use sigvec, else sigaction */ #ifndef SA_RESTART struct sigvec invec, outvec; #else struct sigaction inact, outact; #endif RFCNB_Timeout = seconds; if (RFCNB_Timeout > 0) { /* Set up handler to ignore but not restart */ #ifndef SA_RESTART invec.sv_handler = (void (*)())rfcnb_alarm; invec.sv_mask = 0; invec.sv_flags = SV_INTERRUPT; if (sigvec(SIGALRM, &invec, &outvec) < 0) return(-1); #else inact.sa_handler = (void (*)())rfcnb_alarm; sigemptyset(&inact.sa_mask); inact.sa_flags = 0; /* Don't restart */ if (sigaction(SIGALRM, &inact, &outact) < 0) return(-1); #endif } return(0); } /* Discard the rest of an incoming packet as we do not have space for it in the buffer we allocated or were passed ... */ int RFCNB_Discard_Rest(struct RFCNB_Con *con, int len) { char temp[100]; /* Read into here */ int rest, this_read, bytes_read; /* len is the amount we should read */ #ifdef RFCNB_DEBUG fprintf(stderr, "Discard_Rest called to discard: %i\n", len); #endif rest = len; while (rest > 0) { this_read = (rest > sizeof(temp)?sizeof(temp):rest); bytes_read = read(con -> fd, temp, this_read); if (bytes_read <= 0) { /* Error so return */ if (bytes_read < 0) RFCNB_errno = RFCNBE_BadRead; else RFCNB_errno = RFCNBE_ConGone; RFCNB_saved_errno = errno; return(RFCNBE_Bad); } rest = rest - bytes_read; } return(0); } /* Send an RFCNB packet to the connection. We just send each of the blocks linked together ... If we can, try to send it as one iovec ... */ int RFCNB_Put_Pkt(struct RFCNB_Con *con, struct RFCNB_Pkt *pkt, int len) { int len_sent, tot_sent, this_len; struct RFCNB_Pkt *pkt_ptr; char *this_data; int i; struct iovec io_list[10]; /* We should never have more */ /* If we do, this will blow up ...*/ /* Try to send the data ... We only send as many bytes as len claims */ /* We should try to stuff it into an IOVEC and send as one write */ pkt_ptr = pkt; len_sent = tot_sent = 0; /* Nothing sent so far */ i = 0; while ((pkt_ptr != NULL) & (i < 10)) { /* Watch that magic number! */ this_len = pkt_ptr -> len; this_data = pkt_ptr -> data; if ((tot_sent + this_len) > len) this_len = len - tot_sent; /* Adjust so we don't send too much */ /* Now plug into the iovec ... */ io_list[i].iov_len = this_len; io_list[i].iov_base = this_data; i++; tot_sent += this_len; if (tot_sent == len) break; /* Let's not send too much */ pkt_ptr = pkt_ptr -> next; } #ifdef RFCNB_DEBUG fprintf(stderr, "Frags = %i, tot_sent = %i\n", i, tot_sent); #endif /* Set up an alarm if timeouts are set ... */ if (RFCNB_Timeout > 0) alarm(RFCNB_Timeout); if ((len_sent = writev(con -> fd, io_list, i)) < 0) { /* An error */ con -> rfc_errno = errno; if (errno == EINTR) /* We were interrupted ... */ RFCNB_errno = RFCNBE_Timeout; else RFCNB_errno = RFCNBE_BadWrite; RFCNB_saved_errno = errno; return(RFCNBE_Bad); } if (len_sent < tot_sent) { /* Less than we wanted */ if (errno == EINTR) /* We were interrupted */ RFCNB_errno = RFCNBE_Timeout; else RFCNB_errno = RFCNBE_BadWrite; RFCNB_saved_errno = errno; return(RFCNBE_Bad); } if (RFCNB_Timeout > 0) alarm(0); /* Reset that sucker */ #ifdef RFCNB_DEBUG fprintf(stderr, "Len sent = %i ...\n", len_sent); RFCNB_Print_Pkt(stderr, "sent", pkt, len_sent); /* Print what send ... */ #endif return(len_sent); } /* Read an RFCNB packet off the connection. We read the first 4 bytes, that tells us the length, then read the rest. We should implement a timeout, but we don't just yet */ int RFCNB_Get_Pkt(struct RFCNB_Con *con, struct RFCNB_Pkt *pkt, int len) { int read_len, pkt_len; char hdr[RFCNB_Pkt_Hdr_Len]; /* Local space for the header */ struct RFCNB_Pkt *pkt_frag; int more, this_time, offset, frag_len, this_len; BOOL seen_keep_alive = TRUE; /* Read that header straight into the buffer */ if (len < RFCNB_Pkt_Hdr_Len) { /* What a bozo */ #ifdef RFCNB_DEBUG fprintf(stderr, "Trying to read less than a packet:"); perror(""); #endif RFCNB_errno = RFCNBE_BadParam; return(RFCNBE_Bad); } /* We discard keep alives here ... */ if (RFCNB_Timeout > 0) alarm(RFCNB_Timeout); while (seen_keep_alive) { if ((read_len = read(con -> fd, hdr, sizeof(hdr))) < 0) { /* Problems */ #ifdef RFCNB_DEBUG fprintf(stderr, "Reading the packet, we got:"); perror(""); #endif if (errno == EINTR) RFCNB_errno = RFCNBE_Timeout; else RFCNB_errno = RFCNBE_BadRead; RFCNB_saved_errno = errno; return(RFCNBE_Bad); } /* Now we check out what we got */ if (read_len == 0) { /* Connection closed, send back eof? */ #ifdef RFCNB_DEBUG fprintf(stderr, "Connection closed reading\n"); #endif if (errno == EINTR) RFCNB_errno = RFCNBE_Timeout; else RFCNB_errno = RFCNBE_ConGone; RFCNB_saved_errno = errno; return(RFCNBE_Bad); } if (RFCNB_Pkt_Type(hdr) == RFCNB_SESSION_KEEP_ALIVE) { #ifdef RFCNB_DEBUG fprintf(stderr, "RFCNB KEEP ALIVE received\n"); #endif } else { seen_keep_alive = FALSE; } } /* What if we got less than or equal to a hdr size in bytes? */ if (read_len < sizeof(hdr)) { /* We got a small packet */ /* Now we need to copy the hdr portion we got into the supplied packet */ memcpy(pkt -> data, hdr, read_len); /*Copy data */ #ifdef RFCNB_DEBUG RFCNB_Print_Pkt(stderr, "rcvd", pkt, read_len); #endif return(read_len); } /* Now, if we got at least a hdr size, alloc space for rest, if we need it */ pkt_len = RFCNB_Pkt_Len(hdr); #ifdef RFCNB_DEBUG fprintf(stderr, "Reading Pkt: Length = %i\n", pkt_len); #endif /* Now copy in the hdr */ memcpy(pkt -> data, hdr, sizeof(hdr)); /* Get the rest of the packet ... first figure out how big our buf is? */ /* And make sure that we handle the fragments properly ... Sure should */ /* use an iovec ... */ if (len < pkt_len) /* Only get as much as we have space for */ more = len - RFCNB_Pkt_Hdr_Len; else more = pkt_len; this_time = 0; /* We read for each fragment ... */ if (pkt -> len == read_len){ /* If this frag was exact size */ pkt_frag = pkt -> next; /* Stick next lot in next frag */ offset = 0; /* then we start at 0 in next */ } else { pkt_frag = pkt; /* Otherwise use rest of this frag */ offset = RFCNB_Pkt_Hdr_Len; /* Otherwise skip the header */ } frag_len = pkt_frag -> len; if (more <= frag_len) /* If len left to get less than frag space */ this_len = more; /* Get the rest ... */ else this_len = frag_len - offset; while (more > 0) { if ((this_time = read(con -> fd, (pkt_frag -> data) + offset, this_len)) <= 0) { /* Problems */ if (errno == EINTR) { RFCNB_errno = RFCNB_Timeout; } else { if (this_time < 0) RFCNB_errno = RFCNBE_BadRead; else RFCNB_errno = RFCNBE_ConGone; } RFCNB_saved_errno = errno; return(RFCNBE_Bad); } #ifdef RFCNB_DEBUG fprintf(stderr, "Frag_Len = %i, this_time = %i, this_len = %i, more = %i\n", frag_len, this_time, this_len, more); #endif read_len = read_len + this_time; /* How much have we read ... */ /* Now set up the next part */ if (pkt_frag -> next == NULL) break; /* That's it here */ pkt_frag = pkt_frag -> next; this_len = pkt_frag -> len; offset = 0; more = more - this_time; } #ifdef RFCNB_DEBUG fprintf(stderr,"Pkt Len = %i, read_len = %i\n", pkt_len, read_len); RFCNB_Print_Pkt(stderr, "rcvd", pkt, read_len + sizeof(hdr)); #endif if (read_len < (pkt_len + sizeof(hdr))) { /* Discard the rest */ return(RFCNB_Discard_Rest(con, (pkt_len + sizeof(hdr)) - read_len)); } if (RFCNB_Timeout > 0) alarm(0); /* Reset that sucker */ return(read_len + sizeof(RFCNB_Hdr)); } muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/rfcnb-io.h0100644000175000017500000000174607554515351023006 0ustar joergjoerg/* UNIX RFCNB (RFC1001/RFC1002) NetBIOS implementation Version 1.0 RFCNB IO Routines Defines Copyright (C) Richard Sharpe 1996 */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ int RFCNB_Put_Pkt(struct RFCNB_Con *con, struct RFCNB_Pkt *pkt, int len); int RFCNB_Get_Pkt(struct RFCNB_Con *con, struct RFCNB_Pkt *pkt, int len); muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/rfcnb-priv.h0100644000175000017500000000771507554515351023361 0ustar joergjoerg/* UNIX RFCNB (RFC1001/RFC1002) NetBIOS implementation Version 1.0 RFCNB Defines Copyright (C) Richard Sharpe 1996 */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Defines we need */ typedef unsigned short uint16; #define GLOBAL extern #include "rfcnb-error.h" #include "rfcnb-common.h" #include "byteorder.h" #ifdef RFCNB_PORT #define RFCNB_Default_Port RFCNB_PORT #else #define RFCNB_Default_Port 139 #endif #define RFCNB_MAX_STATS 1 /* Protocol defines we need */ #define RFCNB_SESSION_MESSAGE 0 #define RFCNB_SESSION_REQUEST 0x81 #define RFCNB_SESSION_ACK 0x82 #define RFCNB_SESSION_REJ 0x83 #define RFCNB_SESSION_RETARGET 0x84 #define RFCNB_SESSION_KEEP_ALIVE 0x85 /* Structures */ typedef struct redirect_addr * redirect_ptr; struct redirect_addr { struct in_addr ip_addr; int port; redirect_ptr next; }; typedef struct RFCNB_Con { int fd; /* File descripter for TCP/IP connection */ int rfc_errno; /* last error */ int timeout; /* How many milli-secs before IO times out */ int redirects; /* How many times we were redirected */ struct redirect_addr *redirect_list; /* First is first address */ struct redirect_addr *last_addr; } RFCNB_Con; typedef char RFCNB_Hdr[4]; /* The header is 4 bytes long with */ /* char[0] as the type, char[1] the */ /* flags, and char[2..3] the length */ /* Macros to extract things from the header. These are for portability between architecture types where we are worried about byte order */ #define RFCNB_Pkt_Hdr_Len 4 #define RFCNB_Pkt_Sess_Len 72 #define RFCNB_Pkt_Retarg_Len 10 #define RFCNB_Pkt_Nack_Len 5 #define RFCNB_Pkt_Type_Offset 0 #define RFCNB_Pkt_Flags_Offset 1 #define RFCNB_Pkt_Len_Offset 2 /* Length is 2 bytes plus a flag bit */ #define RFCNB_Pkt_N1Len_Offset 4 #define RFCNB_Pkt_Called_Offset 5 #define RFCNB_Pkt_N2Len_Offset 38 #define RFCNB_Pkt_Calling_Offset 39 #define RFCNB_Pkt_Error_Offset 4 #define RFCNB_Pkt_IP_Offset 4 #define RFCNB_Pkt_Port_Offset 8 /* The next macro isolates the length of a packet, including the bit in the flags */ #define RFCNB_Pkt_Len(p) (PVAL(p, 3) | (PVAL(p, 2) << 8) | \ ((PVAL(p, RFCNB_Pkt_Flags_Offset) & 0x01) << 16)) #define RFCNB_Put_Pkt_Len(p, v) (p[1] = ((v >> 16) & 1)); \ (p[2] = ((v >> 8) & 0xFF)); \ (p[3] = (v & 0xFF)); #define RFCNB_Pkt_Type(p) (CVAL(p, RFCNB_Pkt_Type_Offset)) /*typedef struct RFCNB_Hdr { unsigned char type; unsigned char flags; int16 len; } RFCNB_Hdr; typedef struct RFCNB_Sess_Pkt { unsigned char type; unsigned char flags; int16 length; unsigned char n1_len; char called_name[33]; unsigned char n2_len; char calling_name[33]; } RFCNB_Sess_Pkt; typedef struct RFCNB_Nack_Pkt { struct RFCNB_Hdr hdr; unsigned char error; } RFCNB_Nack_Pkt; typedef struct RFCNB_Retarget_Pkt { struct RFCNB_Hdr hdr; int dest_ip; unsigned char port; } RFCNB_Redir_Pkt; */ /* Static variables */ /* Only declare this if not defined */ #ifndef RFCNB_ERRNO extern int RFCNB_errno; extern int RFCNB_saved_errno; /* Save this from point of error */ #endif muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/rfcnb-util.c0100644000175000017500000002556707554515351023356 0ustar joergjoerg/* UNIX RFCNB (RFC1001/RFC1002) NetBIOS implementation Version 1.0 RFCNB Utility Routines ... Copyright (C) Richard Sharpe 1996 */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include "std-includes.h" #include "rfcnb-priv.h" #include "rfcnb-util.h" #include "rfcnb-io.h" extern void (*Prot_Print_Routine)(); /* Pointer to protocol print routine */ /* Convert name and pad to 16 chars as needed */ /* Name 1 is a C string with null termination, name 2 may not be */ /* If SysName is true, then put a <00> on end, else space> */ void RFCNB_CvtPad_Name(char *name1, char *name2) { char c, c1, c2; int i, len; len = strlen(name1); for (i = 0; i < 16; i++) { if (i >= len) { c1 = 'C'; c2 = 'A'; /* CA is a space */ } else { c = name1[i]; c1 = (char)((int)c/16 + (int)'A'); c2 = (char)((int)c%16 + (int)'A'); } name2[i*2] = c1; name2[i*2+1] = c2; } name2[32] = 0; /* Put in the nll ...*/ } /* Converts an Ascii NB Name (16 chars) to an RFCNB Name (32 chars) Uses the encoding in RFC1001. Each nibble of byte is added to 'A' to produce the next byte in the name. This routine assumes that AName is 16 bytes long and that NBName has space for 32 chars, so be careful ... */ void RFCNB_AName_To_NBName(char *AName, char *NBName) { char c, c1, c2; int i; for (i=0; i < 16; i++) { c = AName[i]; c1 = (char)((c >> 4) + 'A'); c2 = (char)((c & 0xF) + 'A'); NBName[i*2] = c1; NBName[i*2+1] = c2; } NBName[32] = 0; /* Put in a null */ } /* Do the reverse of the above ... */ void RFCNB_NBName_To_AName(char *NBName, char *AName) { char c, c1, c2; int i; for (i=0; i < 16; i++) { c1 = NBName[i*2]; c2 = NBName[i*2+1]; c = (char)(((int)c1 - (int)'A') * 16 + ((int)c2 - (int)'A')); AName[i] = c; } AName[i] = 0; /* Put a null on the end ... */ } /* Print a string of bytes in HEX etc */ void RFCNB_Print_Hex(FILE *fd, struct RFCNB_Pkt *pkt, int Offset, int Len) { char c1, c2, outbuf1[33]; unsigned char c; int i, j; struct RFCNB_Pkt *pkt_ptr = pkt; static char Hex_List[17] = "0123456789ABCDEF"; j = 0; /* We only want to print as much as sepcified in Len */ while (pkt_ptr != NULL) { for (i = 0; i < ((Len > (pkt_ptr -> len)?pkt_ptr -> len:Len) - Offset); i++) { c = pkt_ptr -> data[i + Offset]; c1 = Hex_List[c >> 4]; c2 = Hex_List[c & 0xF]; outbuf1[j++] = c1; outbuf1[j++] = c2; if (j == 32){ /* Print and reset */ outbuf1[j] = 0; fprintf(fd, " %s\n", outbuf1); j = 0; } } Offset = 0; Len = Len - pkt_ptr -> len; /* Reduce amount by this much */ pkt_ptr = pkt_ptr -> next; } /* Print last lot in the buffer ... */ if (j > 0) { outbuf1[j] = 0; fprintf(fd, " %s\n", outbuf1); } fprintf(fd, "\n"); } /* Get a packet of size n */ struct RFCNB_Pkt *RFCNB_Alloc_Pkt(int n) { RFCNB_Pkt *pkt; if ((pkt = (struct RFCNB_Pkt *)malloc(sizeof(struct RFCNB_Pkt))) == NULL) { RFCNB_errno = RFCNBE_NoSpace; RFCNB_saved_errno = errno; return(NULL); } pkt -> next = NULL; pkt -> len = n; if (n == 0) return(pkt); if ((pkt -> data = (char *)malloc(n)) == NULL) { RFCNB_errno = RFCNBE_NoSpace; RFCNB_saved_errno = errno; free(pkt); return(NULL); } return(pkt); } /* Free up a packet */ int RFCNB_Free_Pkt(struct RFCNB_Pkt *pkt) { struct RFCNB_Pkt *pkt_next; char *data_ptr; while (pkt != NULL) { pkt_next = pkt -> next; data_ptr = pkt -> data; if (data_ptr != NULL) free(data_ptr); free(pkt); pkt = pkt_next; } } /* Print an RFCNB packet */ void RFCNB_Print_Pkt(FILE *fd, char *dirn, struct RFCNB_Pkt *pkt, int len) { char lname[17]; /* We assume that the first fragment is the RFCNB Header */ /* We should loop through the fragments printing them out */ fprintf(fd, "RFCNB Pkt %s:", dirn); switch (RFCNB_Pkt_Type(pkt -> data)) { case RFCNB_SESSION_MESSAGE: fprintf(fd, "SESSION MESSAGE: Length = %i\n", RFCNB_Pkt_Len(pkt -> data)); RFCNB_Print_Hex(fd, pkt, RFCNB_Pkt_Hdr_Len, #ifdef RFCNB_PRINT_DATA RFCNB_Pkt_Len(pkt -> data) - RFCNB_Pkt_Hdr_Len); #else 40); #endif if (Prot_Print_Routine != 0) { /* Print the rest of the packet */ Prot_Print_Routine(fd, strcmp(dirn, "sent"), pkt, RFCNB_Pkt_Hdr_Len, RFCNB_Pkt_Len(pkt -> data) - RFCNB_Pkt_Hdr_Len); } break; case RFCNB_SESSION_REQUEST: fprintf(fd, "SESSION REQUEST: Length = %i\n", RFCNB_Pkt_Len(pkt -> data)); RFCNB_NBName_To_AName((char *)(pkt -> data + RFCNB_Pkt_Called_Offset), lname); fprintf(fd, " Called Name: %s\n", lname); RFCNB_NBName_To_AName((char *)(pkt -> data + RFCNB_Pkt_Calling_Offset), lname); fprintf(fd, " Calling Name: %s\n", lname); break; case RFCNB_SESSION_ACK: fprintf(fd, "RFCNB SESSION ACK: Length = %i\n", RFCNB_Pkt_Len(pkt -> data)); break; case RFCNB_SESSION_REJ: fprintf(fd, "RFCNB SESSION REJECT: Length = %i\n", RFCNB_Pkt_Len(pkt -> data)); if (RFCNB_Pkt_Len(pkt -> data) < 1) { fprintf(fd, " Protocol Error, short Reject packet!\n"); } else { fprintf(fd, " Error = %x\n", CVAL(pkt -> data, RFCNB_Pkt_Error_Offset)); } break; case RFCNB_SESSION_RETARGET: fprintf(fd, "RFCNB SESSION RETARGET: Length = %i\n", RFCNB_Pkt_Len(pkt -> data)); /* Print out the IP address etc and the port? */ break; case RFCNB_SESSION_KEEP_ALIVE: fprintf(fd, "RFCNB SESSION KEEP ALIVE: Length = %i\n", RFCNB_Pkt_Len(pkt -> data)); break; default: break; } } /* Resolve a name into an address */ int RFCNB_Name_To_IP(char *host, struct in_addr *Dest_IP) { int addr; /* Assumes IP4, 32 bit network addresses */ struct hostent *hp; /* Use inet_addr to try to convert the address */ if ((addr = inet_addr(host)) == INADDR_NONE) { /* Oh well, a good try :-) */ /* Now try a name look up with gethostbyname */ if ((hp = gethostbyname(host)) == NULL) { /* Not in DNS */ /* Try NetBIOS name lookup, how the hell do we do that? */ RFCNB_errno = RFCNBE_BadName; /* Is this right? */ RFCNB_saved_errno = errno; return(RFCNBE_Bad); } else { /* We got a name */ memcpy((void *)Dest_IP, (void *)hp -> h_addr_list[0], sizeof(struct in_addr)); } } else { /* It was an IP address */ memcpy((void *)Dest_IP, (void *)&addr, sizeof(struct in_addr)); } return 0; } /* Disconnect the TCP connection to the server */ int RFCNB_Close(int socket) { close(socket); /* If we want to do error recovery, here is where we put it */ return 0; } /* Connect to the server specified in the IP address. Not sure how to handle socket options etc. */ int RFCNB_IP_Connect(struct in_addr Dest_IP, int port) { struct sockaddr_in Socket; int fd; /* Create a socket */ if ((fd = socket(PF_INET, SOCK_STREAM, 0)) < 0) { /* Handle the error */ RFCNB_errno = RFCNBE_BadSocket; RFCNB_saved_errno = errno; return(RFCNBE_Bad); } bzero((char *)&Socket, sizeof(Socket)); memcpy((char *)&Socket.sin_addr, (char *)&Dest_IP, sizeof(Dest_IP)); Socket.sin_port = htons(port); Socket.sin_family = PF_INET; /* Now connect to the destination */ if (connect(fd, (struct sockaddr *)&Socket, sizeof(Socket)) < 0) { /* Error */ close(fd); RFCNB_errno = RFCNBE_ConnectFailed; RFCNB_saved_errno = errno; return(RFCNBE_Bad); } return(fd); } /* handle the details of establishing the RFCNB session with remote end */ int RFCNB_Session_Req(struct RFCNB_Con *con, char *Called_Name, char *Calling_Name, BOOL *redirect, struct in_addr *Dest_IP, int * port) { char *sess_pkt; /* Response packet should be no more than 9 bytes, make 16 jic */ char ln1[16], ln2[16], n1[32], n2[32], resp[16]; int len; struct RFCNB_Pkt *pkt, res_pkt; /* We build and send the session request, then read the response */ pkt = RFCNB_Alloc_Pkt(RFCNB_Pkt_Sess_Len); if (pkt == NULL) { return(RFCNBE_Bad); /* Leave the error that RFCNB_Alloc_Pkt gives) */ } sess_pkt = pkt -> data; /* Get pointer to packet proper */ sess_pkt[RFCNB_Pkt_Type_Offset] = RFCNB_SESSION_REQUEST; RFCNB_Put_Pkt_Len(sess_pkt, RFCNB_Pkt_Sess_Len-RFCNB_Pkt_Hdr_Len); sess_pkt[RFCNB_Pkt_N1Len_Offset] = 32; sess_pkt[RFCNB_Pkt_N2Len_Offset] = 32; RFCNB_CvtPad_Name(Called_Name, (sess_pkt + RFCNB_Pkt_Called_Offset)); RFCNB_CvtPad_Name(Calling_Name, (sess_pkt + RFCNB_Pkt_Calling_Offset)); /* Now send the packet */ #ifdef RFCNB_DEBUG fprintf(stderr, "Sending packet: "); #endif if ((len = RFCNB_Put_Pkt(con, pkt, RFCNB_Pkt_Sess_Len)) < 0) { return(RFCNBE_Bad); /* Should be able to write that lot ... */ } #ifdef RFCNB_DEBUG fprintf(stderr, "Getting packet.\n"); #endif res_pkt.data = resp; res_pkt.len = sizeof(resp); res_pkt.next = NULL; if ((len = RFCNB_Get_Pkt(con, &res_pkt, sizeof(resp))) < 0) { return(RFCNBE_Bad); } /* Now analyze the packet ... */ switch (RFCNB_Pkt_Type(resp)) { case RFCNB_SESSION_REJ: /* Didnt like us ... too bad */ /* Why did we get rejected ? */ switch (CVAL(resp,RFCNB_Pkt_Error_Offset)) { case 0x80: RFCNB_errno = RFCNBE_CallRejNLOCN; break; case 0x81: RFCNB_errno = RFCNBE_CallRejNLFCN; break; case 0x82: RFCNB_errno = RFCNBE_CallRejCNNP; break; case 0x83: RFCNB_errno = RFCNBE_CallRejInfRes; break; case 0x8F: RFCNB_errno = RFCNBE_CallRejUnSpec; break; default: RFCNB_errno = RFCNBE_ProtErr; break; } return(RFCNBE_Bad); break; case RFCNB_SESSION_ACK: /* Got what we wanted ... */ return(0); break; case RFCNB_SESSION_RETARGET: /* Go elsewhere */ *redirect = TRUE; /* Copy port and ip addr */ memcpy(Dest_IP, (resp + RFCNB_Pkt_IP_Offset), sizeof(struct in_addr)); *port = SVAL(resp, RFCNB_Pkt_Port_Offset); return(0); break; default: /* A protocol error */ RFCNB_errno = RFCNBE_ProtErr; return(RFCNBE_Bad); break; } } muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/rfcnb-util.h0100644000175000017500000000277507554515351023357 0ustar joergjoerg/* UNIX RFCNB (RFC1001/RFC1002) NetBIOS implementation Version 1.0 RFCNB Utility Defines Copyright (C) Richard Sharpe 1996 */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ void RFCNB_CvtPad_Name(char *name1, char *name2); void RFCNB_AName_To_NBName(char *AName, char *NBName); void RFCNB_NBName_To_AName(char *NBName, char *AName); void RFCNB_Print_Hex(FILE *fd, struct RFCNB_Pkt *pkt, int Offset, int Len); struct RFCNB_Pkt *RFCNB_Alloc_Pkt(int n); void RFCNB_Print_Pkt(FILE *fd, char *dirn, struct RFCNB_Pkt *pkt, int len); int RFCNB_Name_To_IP(char *host, struct in_addr *Dest_IP); int RFCNB_Close(int socket); int RFCNB_IP_Connect(struct in_addr Dest_IP, int port); int RFCNB_Session_Req(struct RFCNB_Con *con, char *Called_Name, char *Calling_Name, BOOL *redirect, struct in_addr *Dest_IP, int * port); muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/rfcnb.h0100644000175000017500000000256207554515351022376 0ustar joergjoerg/* UNIX RFCNB (RFC1001/RFC1002) NetBIOS implementation Version 1.0 RFCNB Defines Copyright (C) Richard Sharpe 1996 */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Error responses */ #include "rfcnb-error.h" #include "rfcnb-common.h" /* Defines we need */ #define RFCNB_Default_Port 139 /* Definition of routines we define */ void *RFCNB_Call(char *Called_Name, char *Calling_Name, char *Called_Address, int port); int RFCNB_Send(void *Con_Handle, struct RFCNB_Pkt *Data, int Length); int RFCNB_Recv(void *Con_Handle, struct RFCNB_Pkt *Data, int Length); int RFCNB_Hangup(void *con_Handle); void *RFCNB_Listen(); void RFCNB_Get_Error(char *buffer, int buf_len); struct RFCNB_Pkt *RFCNB_Alloc_Pkt(int n); muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/session.c0100644000175000017500000002062607554515351022763 0ustar joergjoerg/* UNIX RFCNB (RFC1001/RFC1002) NetBIOS implementation Version 1.0 Session Routines ... Copyright (C) Richard Sharpe 1996 */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include int RFCNB_errno = 0; int RFCNB_saved_errno = 0; #define RFCNB_ERRNO #include "std-includes.h" #include #include "rfcnb-priv.h" #include "rfcnb-util.h" int RFCNB_Stats[RFCNB_MAX_STATS]; void (*Prot_Print_Routine)() = NULL; /* Pointer to print routine */ /* Set up a session with a remote name. We are passed Called_Name as a string which we convert to a NetBIOS name, ie space terminated, up to 16 characters only if we need to. If Called_Address is not empty, then we use it to connect to the remote end, but put in Called_Name ... Called Address can be a DNS based name, or a TCP/IP address ... */ void *RFCNB_Call(char *Called_Name, char *Calling_Name, char *Called_Address, int port) { struct RFCNB_Con *con; struct in_addr Dest_IP; int Client; BOOL redirect; struct redirect_addr *redir_addr; char *Service_Address; /* Now, we really should look up the port in /etc/services ... */ if (port == 0) port = RFCNB_Default_Port; /* Create a connection structure first */ if ((con = (struct RFCNB_Con *)malloc(sizeof(struct RFCNB_Con))) == NULL) { /* Error in size */ RFCNB_errno = RFCNBE_NoSpace; RFCNB_saved_errno = errno; return(NULL); } con -> fd = -0; /* no descriptor yet */ con -> rfc_errno = 0; /* no error yet */ con -> timeout = 0; /* no timeout */ con -> redirects = 0; con -> redirect_list = NULL; /* Fix bug still in version 0.50 */ /* Resolve that name into an IP address */ Service_Address = Called_Name; if (strcmp(Called_Address, "") != 0) { /* If the Called Address = "" */ Service_Address = Called_Address; } if ((errno = RFCNB_Name_To_IP(Service_Address, &Dest_IP)) < 0) { /* Error */ /* No need to modify RFCNB_errno as it was done by RFCNB_Name_To_IP */ return(NULL); } /* Now connect to the remote end */ redirect = TRUE; /* Fudge this one so we go once through */ while (redirect) { /* Connect and get session info etc */ redirect = FALSE; /* Assume all OK */ /* Build the redirect info. First one is first addr called */ /* And tack it onto the list of addresses we called */ if ((redir_addr = (struct redirect_addr *)malloc(sizeof(struct redirect_addr))) == NULL) { /* Could not get space */ RFCNB_errno = RFCNBE_NoSpace; RFCNB_saved_errno = errno; return(NULL); } memcpy((char *)&(redir_addr -> ip_addr), (char *)&Dest_IP, sizeof(Dest_IP)); redir_addr -> port = port; redir_addr -> next = NULL; if (con -> redirect_list == NULL) { /* Stick on head */ con -> redirect_list = con -> last_addr = redir_addr; } else { con -> last_addr -> next = redir_addr; con -> last_addr = redir_addr; } /* Now, make that connection */ if ((Client = RFCNB_IP_Connect(Dest_IP, port)) < 0) { /* Error */ /* No need to modify RFCNB_errno as it was done by RFCNB_IP_Connect */ return(NULL); } con -> fd = Client; /* Now send and handle the RFCNB session request */ /* If we get a redirect, we will comeback with redirect true and a new IP address in DEST_IP */ if ((errno = RFCNB_Session_Req(con, Called_Name, Calling_Name, &redirect, &Dest_IP, &port)) < 0) { /* No need to modify RFCNB_errno as it was done by RFCNB_Session.. */ return(NULL); } if (redirect) { /* We have to close the connection, and then try again */ (con -> redirects)++; RFCNB_Close(con -> fd); /* Close it */ } } return(con); } /* We send a packet to the other end ... for the moment, we treat the data as a series of pointers to blocks of data ... we should check the length ... */ int RFCNB_Send(struct RFCNB_Con *Con_Handle, struct RFCNB_Pkt *udata, int Length) { struct RFCNB_Pkt *pkt; char *hdr; int len; /* Plug in the header and send the data */ pkt = RFCNB_Alloc_Pkt(RFCNB_Pkt_Hdr_Len); if (pkt == NULL) { RFCNB_errno = RFCNBE_NoSpace; RFCNB_saved_errno = errno; return(RFCNBE_Bad); } pkt -> next = udata; /* The user data we want to send */ hdr = pkt -> data; /* Following crap is for portability across multiple UNIX machines */ *(hdr + RFCNB_Pkt_Type_Offset) = RFCNB_SESSION_MESSAGE; RFCNB_Put_Pkt_Len(hdr, Length); #ifdef RFCNB_DEBUG fprintf(stderr, "Sending packet: "); #endif if ((len = RFCNB_Put_Pkt(Con_Handle, pkt, Length + RFCNB_Pkt_Hdr_Len)) < 0) { /* No need to change RFCNB_errno as it was done by put_pkt ... */ return(RFCNBE_Bad); /* Should be able to write that lot ... */ } /* Now we have sent that lot, let's get rid of the RFCNB Header and return */ pkt -> next = NULL; RFCNB_Free_Pkt(pkt); return(len); } /* We pick up a message from the internet ... We have to worry about non-message packets ... */ int RFCNB_Recv(void *con_Handle, struct RFCNB_Pkt *Data, int Length) { struct RFCNB_Pkt *pkt; struct RFCNB_Hdr *hdr; int ret_len; if (con_Handle == NULL){ RFCNB_errno = RFCNBE_BadHandle; RFCNB_saved_errno = errno; return(RFCNBE_Bad); } /* Now get a packet from below. We allocate a header first */ /* Plug in the header and send the data */ pkt = RFCNB_Alloc_Pkt(RFCNB_Pkt_Hdr_Len); if (pkt == NULL) { RFCNB_errno = RFCNBE_NoSpace; RFCNB_saved_errno = errno; return(RFCNBE_Bad); } pkt -> next = Data; /* Plug in the data portion */ if ((ret_len = RFCNB_Get_Pkt(con_Handle, pkt, Length + RFCNB_Pkt_Hdr_Len)) < 0) { #ifdef RFCNB_DEBUG fprintf(stderr, "Bad packet return in RFCNB_Recv... \n"); #endif return(RFCNBE_Bad); } /* We should check that we go a message and not a keep alive */ pkt -> next = NULL; RFCNB_Free_Pkt(pkt); return(ret_len); } /* We just disconnect from the other end, as there is nothing in the RFCNB */ /* protocol that specifies any exchange as far as I can see */ int RFCNB_Hangup(struct RFCNB_Con *con_Handle) { if (con_Handle != NULL) { RFCNB_Close(con_Handle -> fd); /* Could this fail? */ free(con_Handle); } return 0; } /* Set TCP_NODELAY on the socket */ int RFCNB_Set_Sock_NoDelay(struct RFCNB_Con *con_Handle, BOOL yn) { return(setsockopt(con_Handle -> fd, IPPROTO_TCP, TCP_NODELAY, (char *)&yn, sizeof(yn))); } /* Listen for a connection on a port???, when */ /* the connection comes in, we return with the connection */ void *RFCNB_Listen() { } /* Pick up the last error response as a string, hmmm, this routine should */ /* have been different ... */ void RFCNB_Get_Error(char *buffer, int buf_len) { if (RFCNB_saved_errno <= 0) { sprintf(buffer, "%s", RFCNB_Error_Strings[RFCNB_errno]); } else { sprintf(buffer, "%s\n\terrno:%s", RFCNB_Error_Strings[RFCNB_errno], strerror(RFCNB_saved_errno)); } } /* Pick up the last error response and returns as a code */ int RFCNB_Get_Last_Error() { return(RFCNB_errno); } /* Pick up saved errno as well */ int RFCNB_Get_Last_Errno() { return(RFCNB_saved_errno); } /* Pick up the last error response and return in string ... */ int RFCNB_Get_Error_Msg(int code, char *msg_buf, int len) { strncpy(msg_buf, RFCNB_Error_Strings[abs(code)], len); } /* Register a higher level protocol print routine */ void RFCNB_Register_Print_Routine(void (*fn)()) { Prot_Print_Routine = fn; } muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/smbdes.c0100644000175000017500000002264207554515351022555 0ustar joergjoerg/* Unix SMB/Netbios implementation. Version 1.9. a partial implementation of DES designed for use in the SMB authentication protocol Copyright (C) Andrew Tridgell 1997 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* NOTES: This code makes no attempt to be fast! In fact, it is a very slow implementation This code is NOT a complete DES implementation. It implements only the minimum necessary for SMB authentication, as used by all SMB products (including every copy of Microsoft Windows95 ever sold) In particular, it can only do a unchained forward DES pass. This means it is not possible to use this code for encryption/decryption of data, instead it is only useful as a "hash" algorithm. There is no entry point into this code that allows normal DES operation. I believe this means that this code does not come under ITAR regulations but this is NOT a legal opinion. If you are concerned about the applicability of ITAR regulations to this code then you should confirm it for yourself (and maybe let me know if you come up with a different answer to the one above) */ static int perm1[56] = {57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4}; static int perm2[48] = {14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32}; static int perm3[64] = {58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8, 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3, 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7}; static int perm4[48] = { 32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, 8, 9, 10, 11, 12, 13, 12, 13, 14, 15, 16, 17, 16, 17, 18, 19, 20, 21, 20, 21, 22, 23, 24, 25, 24, 25, 26, 27, 28, 29, 28, 29, 30, 31, 32, 1}; static int perm5[32] = { 16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10, 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25}; static int perm6[64] ={ 40, 8, 48, 16, 56, 24, 64, 32, 39, 7, 47, 15, 55, 23, 63, 31, 38, 6, 46, 14, 54, 22, 62, 30, 37, 5, 45, 13, 53, 21, 61, 29, 36, 4, 44, 12, 52, 20, 60, 28, 35, 3, 43, 11, 51, 19, 59, 27, 34, 2, 42, 10, 50, 18, 58, 26, 33, 1, 41, 9, 49, 17, 57, 25}; static int sc[16] = {1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1}; static int sbox[8][4][16] = { {{14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7}, {0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8}, {4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0}, {15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13}}, {{15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10}, {3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5}, {0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15}, {13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9}}, {{10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8}, {13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1}, {13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7}, {1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12}}, {{7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15}, {13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9}, {10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4}, {3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14}}, {{2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9}, {14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6}, {4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14}, {11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3}}, {{12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11}, {10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8}, {9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6}, {4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13}}, {{4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1}, {13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6}, {1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2}, {6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12}}, {{13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7}, {1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2}, {7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8}, {2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11}}}; static void permute(char *out, char *in, int *p, int n) { int i; for (i=0;i>1; key[1] = ((str[0]&0x01)<<6) | (str[1]>>2); key[2] = ((str[1]&0x03)<<5) | (str[2]>>3); key[3] = ((str[2]&0x07)<<4) | (str[3]>>4); key[4] = ((str[3]&0x0F)<<3) | (str[4]>>5); key[5] = ((str[4]&0x1F)<<2) | (str[5]>>6); key[6] = ((str[5]&0x3F)<<1) | (str[6]>>7); key[7] = str[6]&0x7F; for (i=0;i<8;i++) { key[i] = (key[i]<<1); } } static void smbhash(unsigned char *out, unsigned char *in, unsigned char *key) { int i; char outb[64]; char inb[64]; char keyb[64]; unsigned char key2[8]; str_to_key(key, key2); for (i=0;i<64;i++) { inb[i] = (in[i/8] & (1<<(7-(i%8)))) ? 1 : 0; keyb[i] = (key2[i/8] & (1<<(7-(i%8)))) ? 1 : 0; outb[i] = 0; } dohash(outb, inb, keyb); for (i=0;i<8;i++) { out[i] = 0; } for (i=0;i<64;i++) { if (outb[i]) out[i/8] |= (1<<(7-(i%8))); } } void E_P16(unsigned char *p14,unsigned char *p16) { unsigned char sp8[8] = {0x4b, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25}; smbhash(p16, sp8, p14); smbhash(p16+8, sp8, p14+7); } void E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24) { smbhash(p24, c8, p21); smbhash(p24+8, c8, p21+7); smbhash(p24+16, c8, p21+14); } void cred_hash1(unsigned char *out,unsigned char *in,unsigned char *key) { unsigned char buf[8]; smbhash(buf, in, key); smbhash(out, buf, key+9); } void cred_hash2(unsigned char *out,unsigned char *in,unsigned char *key) { unsigned char buf[8]; static unsigned char key2[8]; smbhash(buf, in, key); key2[0] = key[7]; smbhash(out, buf, key2); } muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/smbencrypt.c0100644000175000017500000001055407554515351023465 0ustar joergjoerg/* Unix SMB/Netbios implementation. Version 1.9. SMB parameters and setup Copyright (C) Andrew Tridgell 1992-1997 Modified by Jeremy Allison 1995. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include "smblib-priv.h" #define uchar unsigned char extern int DEBUGLEVEL; #include "byteorder.h" char *StrnCpy(char *dest,char *src,int n); void strupper(char *s); /* This implements the X/Open SMB password encryption It takes a password, a 8 byte "crypt key" and puts 24 bytes of encrypted password into p24 */ void SMBencrypt(uchar *passwd, uchar *c8, uchar *p24) { uchar p14[15], p21[21]; memset(p21,'\0',21); memset(p14,'\0',14); StrnCpy((char *)p14,(char *)passwd,14); strupper((char *)p14); E_P16(p14, p21); E_P24(p21, c8, p24); } /* Routines for Windows NT MD4 Hash functions. */ static int _my_wcslen(int16 *str) { int len = 0; while(*str++ != 0) len++; return len; } /* * Convert a string into an NT UNICODE string. * Note that regardless of processor type * this must be in intel (little-endian) * format. */ static int _my_mbstowcs(int16 *dst, uchar *src, int len) { int i; int16 val; for(i = 0; i < len; i++) { val = *src; SSVAL(dst,0,val); dst++; src++; if(val == 0) break; } return i; } /* * Creates the MD4 Hash of the users password in NT UNICODE. */ void E_md4hash(uchar *passwd, uchar *p16) { int len; int16 wpwd[129]; /* Password cannot be longer than 128 characters */ len = strlen((char *)passwd); if(len > 128) len = 128; /* Password must be converted to NT unicode */ _my_mbstowcs(wpwd, passwd, len); wpwd[len] = 0; /* Ensure string is null terminated */ /* Calculate length in bytes */ len = _my_wcslen(wpwd) * sizeof(int16); mdfour(p16, (unsigned char *)wpwd, len); } /* Does the NT MD4 hash then des encryption. */ void SMBNTencrypt(uchar *passwd, uchar *c8, uchar *p24) { uchar p21[21]; memset(p21,'\0',21); E_md4hash(passwd, p21); E_P24(p21, c8, p24); } /* Does both the NT and LM owfs of a user's password */ void nt_lm_owf_gen(char *pwd, char *nt_p16, char *p16) { char passwd[130]; StrnCpy(passwd, pwd, sizeof(passwd)-1); /* Calculate the MD4 hash (NT compatible) of the password */ memset(nt_p16, '\0', 16); E_md4hash((uchar *)passwd, (uchar *)nt_p16); /* Mangle the passwords into Lanman format */ passwd[14] = '\0'; strupper(passwd); /* Calculate the SMB (lanman) hash functions of the password */ memset(p16, '\0', 16); E_P16((uchar *) passwd, (uchar *)p16); /* clear out local copy of user's password (just being paranoid). */ bzero(passwd, sizeof(passwd)); } /**************************************************************************** line strncpy but always null terminates. Make sure there is room! ****************************************************************************/ char *StrnCpy(char *dest,char *src,int n) { char *d = dest; if (!dest) return(NULL); if (!src) { *dest = 0; return(dest); } while (n-- && (*d++ = *src++)) ; *d = 0; return(dest); } void strupper(char *s) { while (*s) { /* #if !defined(KANJI_WIN95_COMPATIBILITY) if(lp_client_code_page() == KANJI_CODEPAGE) { if (is_shift_jis (*s)) { if (is_sj_lower (s[0], s[1])) s[1] = sj_toupper2 (s[1]); s += 2; } else if (is_kana (*s)) { s++; } else { if (islower(*s)) *s = toupper(*s); s++; } } else #endif */ /* KANJI_WIN95_COMPATIBILITY */ { if (islower(*s)) *s = toupper(*s); s++; } } } muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/smblib-common.h0100644000175000017500000001460407554515351024042 0ustar joergjoerg/* UNIX SMBlib NetBIOS implementation Version 1.0 SMBlib Common Defines Copyright (C) Richard Sharpe 1996 */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* To get the error class we want the first 8 bits */ /* Because we just grab 4bytes from the SMB header, we have to re-order */ /* here, but it makes the NtStatus part easier in future */ #define SMBlib_Error_Class(p) (p & 0x000000FF) /* To get the error code, we want the bottom 16 bits */ #define SMBlib_Error_Code(p) (((unsigned int)p & 0xFFFF0000) >>16) /* Error CLASS codes and etc ... */ #define SMBC_SUCCESS 0 #define SMBC_ERRDOS 0x01 #define SMBC_ERRSRV 0x02 #define SMBC_ERRHRD 0x03 #define SMBC_ERRCMD 0xFF /* Success error codes */ #define SMBS_BUFFERED 0x54 #define SMBS_LOGGED 0x55 #define SMBS_DISPLAYED 0x56 /* ERRDOS Error codes */ #define SMBD_badfunc 0x01 #define SMBD_badfile 0x02 #define SMBD_badpath 0x03 #define SMBD_nofids 0x04 #define SMBD_noaccess 0x05 #define SMBD_badfid 0x06 #define SMBD_badmcb 0x07 #define SMBD_nomem 0x08 #define SMBD_badmem 0x09 #define SMBD_badenv 0x0A #define SMBD_badformat 0x0B #define SMBD_badaccess 0x0C #define SMBD_baddata 0x0D #define SMBD_reserved 0x0E #define SMBD_baddrive 0x0F #define SMBD_remcd 0x10 #define SMBD_diffdevice 0x11 #define SMBD_nofiles 0x12 #define SMBD_badshare 0x20 #define SMBD_errlock 0x21 #define SMBD_filexists 0x50 /* Server errors ... */ #define SMBV_error 0x01 /* Generic error */ #define SMBV_badpw 0x02 #define SMBV_badtype 0x03 #define SMBV_access 0x04 #define SMBV_invnid 0x05 #define SMBV_invnetname 0x06 #define SMBV_invdevice 0x07 #define SMBV_qfull 0x31 #define SMBV_qtoobig 0x32 #define SMBV_qeof 0x33 #define SMBV_invpfid 0x34 #define SMBV_paused 0x51 #define SMBV_msgoff 0x52 #define SMBV_noroom 0x53 #define SMBV_rmuns 0x57 #define SMBV_nosupport 0xFFFF /* Hardware error codes ... */ #define SMBH_nowrite 0x13 #define SMBH_badunit 0x14 #define SMBH_notready 0x15 #define SMBH_badcmd 0x16 #define SMBH_data 0x17 #define SMBH_badreq 0x18 #define SMBH_seek 0x19 #define SMBH_badmedia 0x1A #define SMBH_badsector 0x1B #define SMBH_nopaper 0x1C #define SMBH_write 0x1D #define SMBH_read 0x1E #define SMBH_general 0x1F #define SMBH_badshare 0x20 /* Access mode defines ... */ #define SMB_AMODE_WTRU 0x4000 #define SMB_AMODE_NOCACHE 0x1000 #define SMB_AMODE_COMPAT 0x0000 #define SMB_AMODE_DENYRWX 0x0010 #define SMB_AMODE_DENYW 0x0020 #define SMB_AMODE_DENYRX 0x0030 #define SMB_AMODE_DENYNONE 0x0040 #define SMB_AMODE_OPENR 0x0000 #define SMB_AMODE_OPENW 0x0001 #define SMB_AMODE_OPENRW 0x0002 #define SMB_AMODE_OPENX 0x0003 #define SMB_AMODE_FCBOPEN 0x00FF #define SMB_AMODE_LOCUNKN 0x0000 #define SMB_AMODE_LOCMSEQ 0x0100 #define SMB_AMODE_LOCMRAN 0x0200 #define SMB_AMODE_LOCRAL 0x0300 /* File attribute encoding ... */ #define SMB_FA_ORD 0x00 #define SMB_FA_ROF 0x01 #define SMB_FA_HID 0x02 #define SMB_FA_SYS 0x04 #define SMB_FA_VOL 0x08 #define SMB_FA_DIR 0x10 #define SMB_FA_ARC 0x20 /* Define the protocol types ... */ #define SMB_P_Unknown -1 /* Hmmm, is this smart? */ #define SMB_P_Core 0 #define SMB_P_CorePlus 1 #define SMB_P_DOSLanMan1 2 #define SMB_P_LanMan1 3 #define SMB_P_DOSLanMan2 4 #define SMB_P_LanMan2 5 #define SMB_P_DOSLanMan2_1 6 #define SMB_P_LanMan2_1 7 #define SMB_P_NT1 8 /* SMBlib return codes */ /* We want something that indicates whether or not the return code was a */ /* remote error, a local error in SMBlib or returned from lower layer ... */ /* Wonder if this will work ... */ /* SMBlibE_Remote = 1 indicates remote error */ /* SMBlibE_ values < 0 indicate local error with more info available */ /* SMBlibE_ values >1 indicate local from SMBlib code errors? */ #define SMBlibE_Success 0 #define SMBlibE_Remote 1 /* Remote error, get more info from con */ #define SMBlibE_BAD -1 #define SMBlibE_LowerLayer 2 /* Lower layer error */ #define SMBlibE_NotImpl 3 /* Function not yet implemented */ #define SMBlibE_ProtLow 4 /* Protocol negotiated does not support req */ #define SMBlibE_NoSpace 5 /* No space to allocate a structure */ #define SMBlibE_BadParam 6 /* Bad parameters */ #define SMBlibE_NegNoProt 7 /* None of our protocols was liked */ #define SMBlibE_SendFailed 8 /* Sending an SMB failed */ #define SMBlibE_RecvFailed 9 /* Receiving an SMB failed */ #define SMBlibE_GuestOnly 10 /* Logged in as guest */ #define SMBlibE_CallFailed 11 /* Call remote end failed */ #define SMBlibE_ProtUnknown 12 /* Protocol unknown */ #define SMBlibE_NoSuchMsg 13 /* Keep this up to date */ typedef struct { /* A structure for a Dirent */ unsigned char resume_key[21]; /* Don't touch this */ unsigned char file_attributes; /* Attributes of file */ unsigned int date_time; /* date and time of last mod */ unsigned int size; char filename[13]; /* The name of the file */ } SMB_CP_dirent; muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/smblib-priv.h0100644000175000017500000007027107554515351023534 0ustar joergjoerg/* UNIX SMBlib NetBIOS implementation Version 1.0 SMBlib private Defines Copyright (C) Richard Sharpe 1996 */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "std-defines.h" #include "smblib-common.h" #include #include typedef unsigned short uint16; typedef unsigned int uint32; #include "byteorder.h" /* Hmmm ... hot good */ #define max(a,b) (a < b ? b : a) #define SMB_DEF_IDF 0x424D53FF /* "\377SMB" */ /* Core protocol commands */ #define SMBmkdir 0x00 /* create directory */ #define SMBrmdir 0x01 /* delete directory */ #define SMBopen 0x02 /* open file */ #define SMBcreate 0x03 /* create file */ #define SMBclose 0x04 /* close file */ #define SMBflush 0x05 /* flush file */ #define SMBunlink 0x06 /* delete file */ #define SMBmv 0x07 /* rename file */ #define SMBgetatr 0x08 /* get file attributes */ #define SMBsetatr 0x09 /* set file attributes */ #define SMBread 0x0A /* read from file */ #define SMBwrite 0x0B /* write to file */ #define SMBlock 0x0C /* lock byte range */ #define SMBunlock 0x0D /* unlock byte range */ #define SMBctemp 0x0E /* create temporary file */ #define SMBmknew 0x0F /* make new file */ #define SMBchkpth 0x10 /* check directory path */ #define SMBexit 0x11 /* process exit */ #define SMBlseek 0x12 /* seek */ #define SMBtcon 0x70 /* tree connect */ #define SMBtdis 0x71 /* tree disconnect */ #define SMBnegprot 0x72 /* negotiate protocol */ #define SMBdskattr 0x80 /* get disk attributes */ #define SMBsearch 0x81 /* search directory */ #define SMBsplopen 0xC0 /* open print spool file */ #define SMBsplwr 0xC1 /* write to print spool file */ #define SMBsplclose 0xC2 /* close print spool file */ #define SMBsplretq 0xC3 /* return print queue */ #define SMBsends 0xD0 /* send single block message */ #define SMBsendb 0xD1 /* send broadcast message */ #define SMBfwdname 0xD2 /* forward user name */ #define SMBcancelf 0xD3 /* cancel forward */ #define SMBgetmac 0xD4 /* get machine name */ #define SMBsendstrt 0xD5 /* send start of multi-block message */ #define SMBsendend 0xD6 /* send end of multi-block message */ #define SMBsendtxt 0xD7 /* send text of multi-block message */ /* CorePlus protocol */ #define SMBlockread 0x13 /* Lock a range and read it */ #define SMBwriteunlock 0x14 /* Unlock a range and then write */ #define SMBreadbraw 0x1a /* read a block of data without smb header ohead*/ #define SMBwritebraw 0x1d /* write a block of data without smb header ohead*/ #define SMBwritec 0x20 /* secondary write request */ #define SMBwriteclose 0x2c /* write a file and then close it */ /* DOS Extended Protocol */ #define SMBreadBraw 0x1A /* read block raw */ #define SMBreadBmpx 0x1B /* read block multiplexed */ #define SMBreadBs 0x1C /* read block (secondary response) */ #define SMBwriteBraw 0x1D /* write block raw */ #define SMBwriteBmpx 0x1E /* write block multiplexed */ #define SMBwriteBs 0x1F /* write block (secondary request) */ #define SMBwriteC 0x20 /* write complete response */ #define SMBsetattrE 0x22 /* set file attributes expanded */ #define SMBgetattrE 0x23 /* get file attributes expanded */ #define SMBlockingX 0x24 /* lock/unlock byte ranges and X */ #define SMBtrans 0x25 /* transaction - name, bytes in/out */ #define SMBtranss 0x26 /* transaction (secondary request/response) */ #define SMBioctl 0x27 /* IOCTL */ #define SMBioctls 0x28 /* IOCTL (secondary request/response) */ #define SMBcopy 0x29 /* copy */ #define SMBmove 0x2A /* move */ #define SMBecho 0x2B /* echo */ #define SMBopenX 0x2D /* open and X */ #define SMBreadX 0x2E /* read and X */ #define SMBwriteX 0x2F /* write and X */ #define SMBsesssetupX 0x73 /* Session Set Up & X (including User Logon) */ #define SMBtconX 0x75 /* tree connect and X */ #define SMBffirst 0x82 /* find first */ #define SMBfunique 0x83 /* find unique */ #define SMBfclose 0x84 /* find close */ #define SMBinvalid 0xFE /* invalid command */ /* Any more ? */ #define SMBdatablockID 0x01 /* A data block identifier */ #define SMBdialectID 0x02 /* A dialect id */ #define SMBpathnameID 0x03 /* A pathname ID */ #define SMBasciiID 0x04 /* An ascii string ID */ #define SMBvariableblockID 0x05 /* A variable block ID */ /* some other defines we need */ /* Flags defines ... */ #define SMB_FLG2_NON_DOS 0x01 /* We know non dos names */ #define SMB_FLG2_EXT_ATR 0x02 /* We know about Extended Attributes */ #define SMB_FLG2_LNG_NAM 0x04 /* Long names ? */ typedef unsigned short WORD; typedef unsigned short UWORD; typedef unsigned int ULONG; typedef unsigned char BYTE; typedef unsigned char UCHAR; /* Some macros to allow access to actual packet data so that we */ /* can change the underlying representation of packets. */ /* */ /* The current formats vying for attention are a fragment */ /* approach where the SMB header is a fragment linked to the */ /* data portion with the transport protocol (rfcnb or whatever) */ /* being linked on the front. */ /* */ /* The other approach is where the whole packet is one array */ /* of bytes with space allowed on the front for the packet */ /* headers. */ #define SMB_Hdr(p) (char *)(p -> data) /* SMB Hdr def for File Sharing Protocol? From MS and Intel, */ /* Intel PN 138446 Doc Version 2.0, Nov 7, 1988. This def also */ /* applies to LANMAN1.0 as well as the Core Protocol */ /* The spec states that wct and bcc must be present, even if 0 */ /* We define these as offsets into a char SMB[] array for the */ /* sake of portability */ /* NOTE!. Some of the lenght defines, SMB__len do not include */ /* the data that follows in the SMB packet, so the code will have to */ /* take that into account. */ #define SMB_hdr_idf_offset 0 /* 0xFF,'SMB' 0-3 */ #define SMB_hdr_com_offset 4 /* BYTE 4 */ #define SMB_hdr_rcls_offset 5 /* BYTE 5 */ #define SMB_hdr_reh_offset 6 /* BYTE 6 */ #define SMB_hdr_err_offset 7 /* WORD 7 */ #define SMB_hdr_reb_offset 9 /* BYTE 9 */ #define SMB_hdr_flg_offset 9 /* same as reb ...*/ #define SMB_hdr_res_offset 10 /* 7 WORDs 10 */ #define SMB_hdr_res0_offset 10 /* WORD 10 */ #define SMB_hdr_flg2_offset 10 /* WORD */ #define SMB_hdr_res1_offset 12 /* WORD 12 */ #define SMB_hdr_res2_offset 14 #define SMB_hdr_res3_offset 16 #define SMB_hdr_res4_offset 18 #define SMB_hdr_res5_offset 20 #define SMB_hdr_res6_offset 22 #define SMB_hdr_tid_offset 24 #define SMB_hdr_pid_offset 26 #define SMB_hdr_uid_offset 28 #define SMB_hdr_mid_offset 30 #define SMB_hdr_wct_offset 32 #define SMB_hdr_len 33 /* 33 byte header? */ #define SMB_hdr_axc_offset 33 /* AndX Command */ #define SMB_hdr_axr_offset 34 /* AndX Reserved */ #define SMB_hdr_axo_offset 35 /* Offset from start to WCT of AndX cmd */ /* Format of the Negotiate Protocol SMB */ #define SMB_negp_bcc_offset 33 #define SMB_negp_buf_offset 35 /* Where the buffer starts */ #define SMB_negp_len 35 /* plus the data */ /* Format of the Negotiate Response SMB, for CoreProtocol, LM1.2 and */ /* NT LM 0.12. wct will be 1 for CoreProtocol, 13 for LM 1.2, and 17 */ /* for NT LM 0.12 */ #define SMB_negrCP_idx_offset 33 /* Response to the neg req */ #define SMB_negrCP_bcc_offset 35 #define SMB_negrLM_idx_offset 33 /* dialect index */ #define SMB_negrLM_sec_offset 35 /* Security mode */ #define SMB_sec_user_mask 0x01 /* 0 = share, 1 = user */ #define SMB_sec_encrypt_mask 0x02 /* pick out encrypt */ #define SMB_negrLM_mbs_offset 37 /* max buffer size */ #define SMB_negrLM_mmc_offset 39 /* max mpx count */ #define SMB_negrLM_mnv_offset 41 /* max number of VCs */ #define SMB_negrLM_rm_offset 43 /* raw mode support bit vec*/ #define SMB_read_raw_mask 0x01 #define SMB_write_raw_mask 0x02 #define SMB_negrLM_sk_offset 45 /* session key, 32 bits */ #define SMB_negrLM_st_offset 49 /* Current server time */ #define SMB_negrLM_sd_offset 51 /* Current server date */ #define SMB_negrLM_stz_offset 53 /* Server Time Zone */ #define SMB_negrLM_ekl_offset 55 /* encryption key length */ #define SMB_negrLM_res_offset 57 /* reserved */ #define SMB_negrLM_bcc_offset 59 /* bcc */ #define SMB_negrLM_len 61 /* 61 bytes ? */ #define SMB_negrLM_buf_offset 61 /* Where the fun begins */ #define SMB_negrNTLM_idx_offset 33 /* Selected protocol */ #define SMB_negrNTLM_sec_offset 35 /* Security more */ #define SMB_negrNTLM_mmc_offset 36 /* Different format above */ #define SMB_negrNTLM_mnv_offset 38 /* Max VCs */ #define SMB_negrNTLM_mbs_offset 40 /* MBS now a long */ #define SMB_negrNTLM_mrs_offset 44 /* Max raw size */ #define SMB_negrNTLM_sk_offset 48 /* Session Key */ #define SMB_negrNTLM_cap_offset 52 /* Capabilities */ #define SMB_negrNTLM_stl_offset 56 /* Server time low */ #define SMB_negrNTLM_sth_offset 60 /* Server time high */ #define SMB_negrNTLM_stz_offset 64 /* Server time zone */ #define SMB_negrNTLM_ekl_offset 66 /* Encrypt key len */ #define SMB_negrNTLM_bcc_offset 67 /* Bcc */ #define SMB_negrNTLM_len 69 #define SMB_negrNTLM_buf_offset 69 /* Offsets related to Tree Connect */ #define SMB_tcon_bcc_offset 33 #define SMB_tcon_buf_offset 35 /* where the data is for tcon */ #define SMB_tcon_len 35 /* plus the data */ #define SMB_tconr_mbs_offset 33 /* max buffer size */ #define SMB_tconr_tid_offset 35 /* returned tree id */ #define SMB_tconr_bcc_offset 37 #define SMB_tconr_len 39 #define SMB_tconx_axc_offset 33 /* And X Command */ #define SMB_tconx_axr_offset 34 /* reserved */ #define SMB_tconx_axo_offset 35 /* Next command offset */ #define SMB_tconx_flg_offset 37 /* Flags, bit0=1 means disc TID */ #define SMB_tconx_pwl_offset 39 /* Password length */ #define SMB_tconx_bcc_offset 41 /* bcc */ #define SMB_tconx_buf_offset 43 /* buffer */ #define SMB_tconx_len 43 /* up to data ... */ #define SMB_tconxr_axc_offset 33 /* Where the AndX Command is */ #define SMB_tconxr_axr_offset 34 /* Reserved */ #define SMB_tconxr_axo_offset 35 /* AndX offset location */ /* Offsets related to tree_disconnect */ #define SMB_tdis_bcc_offset 33 /* bcc */ #define SMB_tdis_len 35 /* total len */ #define SMB_tdisr_bcc_offset 33 /* bcc */ #define SMB_tdisr_len 35 /* Offsets related to Open Request */ #define SMB_open_mod_offset 33 /* Mode to open with */ #define SMB_open_atr_offset 35 /* Attributes of file */ #define SMB_open_bcc_offset 37 /* bcc */ #define SMB_open_buf_offset 39 /* File name */ #define SMB_open_len 39 /* Plus the file name */ #define SMB_openx_axc_offset 33 /* Next command */ #define SMB_openx_axr_offset 34 /* Reserved */ #define SMB_openx_axo_offset 35 /* offset of next wct */ #define SMB_openx_flg_offset 37 /* Flags, bit0 = need more info */ /* bit1 = exclusive oplock */ /* bit2 = batch oplock */ #define SMB_openx_mod_offset 39 /* mode to open with */ #define SMB_openx_atr_offset 41 /* search attributes */ #define SMB_openx_fat_offset 43 /* File attributes */ #define SMB_openx_tim_offset 45 /* time and date of creat */ #define SMB_openx_ofn_offset 49 /* Open function */ #define SMB_openx_als_offset 51 /* Space to allocate on */ #define SMB_openx_res_offset 55 /* reserved */ #define SMB_openx_bcc_offset 63 /* bcc */ #define SMB_openx_buf_offset 65 /* Where file name goes */ #define SMB_openx_len 65 #define SMB_openr_fid_offset 33 /* FID returned */ #define SMB_openr_atr_offset 35 /* Attributes opened with */ #define SMB_openr_tim_offset 37 /* Last mod time of file */ #define SMB_openr_fsz_offset 41 /* File size 4 bytes */ #define SMB_openr_acc_offset 45 /* Access allowed */ #define SMB_openr_bcc_offset 47 #define SMB_openr_len 49 #define SMB_openxr_axc_offset 33 /* And X command */ #define SMB_openxr_axr_offset 34 /* reserved */ #define SMB_openxr_axo_offset 35 /* offset to next command */ #define SMB_openxr_fid_offset 37 /* FID returned */ #define SMB_openxr_fat_offset 39 /* File attributes returned*/ #define SMB_openxr_tim_offset 41 /* File creation date etc */ #define SMB_openxr_fsz_offset 45 /* Size of file */ #define SMB_openxr_acc_offset 49 /* Access granted */ #define SMB_clos_fid_offset 33 /* FID to close */ #define SMB_clos_tim_offset 35 /* Last mod time */ #define SMB_clos_bcc_offset 39 /* bcc */ #define SMB_clos_len 41 /* Offsets related to Write requests */ #define SMB_write_fid_offset 33 /* FID to write */ #define SMB_write_cnt_offset 35 /* bytes to write */ #define SMB_write_ofs_offset 37 /* location to write to */ #define SMB_write_clf_offset 41 /* advisory count left */ #define SMB_write_bcc_offset 43 /* bcc = data bytes + 3 */ #define SMB_write_buf_offset 45 /* Data=0x01, len, data */ #define SMB_write_len 45 /* plus the data ... */ #define SMB_writr_cnt_offset 33 /* Count of bytes written */ #define SMB_writr_bcc_offset 35 /* bcc */ #define SMB_writr_len 37 /* Offsets related to read requests */ #define SMB_read_fid_offset 33 /* FID of file to read */ #define SMB_read_cnt_offset 35 /* count of words to read */ #define SMB_read_ofs_offset 37 /* Where to read from */ #define SMB_read_clf_offset 41 /* Advisory count to go */ #define SMB_read_bcc_offset 43 #define SMB_read_len 45 #define SMB_readr_cnt_offset 33 /* Count of bytes returned */ #define SMB_readr_res_offset 35 /* 4 shorts reserved, 8 bytes */ #define SMB_readr_bcc_offset 43 /* bcc */ #define SMB_readr_bff_offset 45 /* buffer format char = 0x01 */ #define SMB_readr_len_offset 46 /* buffer len */ #define SMB_readr_len 45 /* length of the readr before data */ /* Offsets for Create file */ #define SMB_creat_atr_offset 33 /* Attributes of new file ... */ #define SMB_creat_tim_offset 35 /* Time of creation */ #define SMB_creat_dat_offset 37 /* 4004BCE :-) */ #define SMB_creat_bcc_offset 39 /* bcc */ #define SMB_creat_buf_offset 41 #define SMB_creat_len 41 /* Before the data */ #define SMB_creatr_fid_offset 33 /* FID of created file */ /* Offsets for Delete file */ #define SMB_delet_sat_offset 33 /* search attribites */ #define SMB_delet_bcc_offset 35 /* bcc */ #define SMB_delet_buf_offset 37 #define SMB_delet_len 37 /* Offsets for SESSION_SETUP_ANDX for both LM and NT LM protocols */ #define SMB_ssetpLM_mbs_offset 37 /* Max buffer Size, allow for AndX */ #define SMB_ssetpLM_mmc_offset 39 /* max multiplex count */ #define SMB_ssetpLM_vcn_offset 41 /* VC number if new VC */ #define SMB_ssetpLM_snk_offset 43 /* Session Key */ #define SMB_ssetpLM_pwl_offset 47 /* password length */ #define SMB_ssetpLM_res_offset 49 /* reserved */ #define SMB_ssetpLM_bcc_offset 53 /* bcc */ #define SMB_ssetpLM_len 55 /* before data ... */ #define SMB_ssetpLM_buf_offset 55 #define SMB_ssetpNTLM_mbs_offset 37 /* Max Buffer Size for NT LM 0.12 */ /* and above */ #define SMB_ssetpNTLM_mmc_offset 39 /* Max Multiplex count */ #define SMB_ssetpNTLM_vcn_offset 41 /* VC Number */ #define SMB_ssetpNTLM_snk_offset 43 /* Session key */ #define SMB_ssetpNTLM_cipl_offset 47 /* Case Insensitive PW Len */ #define SMB_ssetpNTLM_cspl_offset 49 /* Unicode pw len */ #define SMB_ssetpNTLM_res_offset 51 /* reserved */ #define SMB_ssetpNTLM_cap_offset 55 /* server capabilities */ #define SMB_ssetpNTLM_bcc_offset 59 /* bcc */ #define SMB_ssetpNTLM_len 61 /* before data */ #define SMB_ssetpNTLM_buf_offset 61 #define SMB_ssetpr_axo_offset 35 /* Offset of next response ... */ #define SMB_ssetpr_act_offset 37 /* action, bit 0 = 1 => guest */ #define SMB_ssetpr_bcc_offset 39 /* bcc */ #define SMB_ssetpr_buf_offset 41 /* Native OS etc */ /* Offsets for SMB create directory */ #define SMB_creatdir_bcc_offset 33 /* only a bcc here */ #define SMB_creatdir_buf_offset 35 /* Where things start */ #define SMB_creatdir_len 35 /* Offsets for SMB delete directory */ #define SMB_deletdir_bcc_offset 33 /* only a bcc here */ #define SMB_deletdir_buf_offset 35 /* where things start */ #define SMB_deletdir_len 35 /* Offsets for SMB check directory */ #define SMB_checkdir_bcc_offset 33 /* Only a bcc here */ #define SMB_checkdir_buf_offset 35 /* where things start */ #define SMB_checkdir_len 35 /* Offsets for SMB search */ #define SMB_search_mdc_offset 33 /* Max Dir ents to return */ #define SMB_search_atr_offset 35 /* Search attributes */ #define SMB_search_bcc_offset 37 /* bcc */ #define SMB_search_buf_offset 39 /* where the action is */ #define SMB_search_len 39 #define SMB_searchr_dec_offset 33 /* Dir ents returned */ #define SMB_searchr_bcc_offset 35 /* bcc */ #define SMB_searchr_buf_offset 37 /* Where the action starts */ #define SMB_searchr_len 37 /* before the dir ents */ #define SMB_searchr_dirent_len 43 /* 53 bytes */ /* Defines for SMB transact and transact2 calls */ #define SMB_trans_tpc_offset 33 /* Total param count */ #define SMB_trans_tdc_offset 35 /* total Data count */ #define SMB_trans_mpc_offset 37 /* Max params bytes to return */ #define SMB_trans_mdc_offset 39 /* Max data bytes to return */ #define SMB_trans_msc_offset 41 /* Max setup words to return */ #define SMB_trans_rs1_offset 42 /* Reserved byte */ #define SMB_trans_flg_offset 43 /* flags */ #define SMB_trans_tmo_offset 45 /* Timeout, long */ #define SMB_trans_rs2_offset 49 /* Next reserved */ #define SMB_trans_pbc_offset 51 /* Param Byte count in buf */ #define SMB_trans_pbo_offset 53 /* Offset to param bytes */ #define SMB_trans_dbc_offset 55 /* Data byte count in buf */ #define SMB_trans_dbo_offset 57 /* Data byte offset */ #define SMB_trans_suc_offset 59 /* Setup count - byte */ #define SMB_trans_rs3_offset 60 /* Reserved to pad ... */ #define SMB_trans_len 61 /* Up to setup, still need bcc */ #define SMB_transr_tpc_offset 33 /* Total param bytes returned */ #define SMB_transr_tdc_offset 35 #define SMB_transr_rs1_offset 37 #define SMB_transr_pbc_offset 39 #define SMB_transr_pbo_offset 41 #define SMB_transr_pdi_offset 43 /* parameter displacement */ #define SMB_transr_dbc_offset 45 #define SMB_transr_dbo_offset 47 #define SMB_transr_ddi_offset 49 #define SMB_transr_suc_offset 51 #define SMB_transr_rs2_offset 52 #define SMB_transr_len 53 /* Bit masks for SMB Capabilities ... */ #define SMB_cap_raw_mode 0x0001 #define SMB_cap_mpx_mode 0x0002 #define SMB_cap_unicode 0x0004 #define SMB_cap_large_files 0x0008 #define SMB_cap_nt_smbs 0x0010 #define SMB_rpc_remote_apis 0x0020 #define SMB_cap_nt_status 0x0040 #define SMB_cap_level_II_oplocks 0x0080 #define SMB_cap_lock_and_read 0x0100 #define SMB_cap_nt_find 0x0200 /* SMB LANMAN api call defines */ #define SMB_LMapi_SetUserInfo 0x0072 #define SMB_LMapi_UserPasswordSet 0x0073 /* Structures and defines we use in the client interface */ /* The protocols we might support. Perhaps a bit ambitious, as only RFCNB */ /* has any support so far 0(sometimes called NBT) */ typedef enum {SMB_RFCNB, SMB_IPXNB, SMB_NETBEUI, SMB_X25} SMB_Transport_Types; typedef enum {SMB_Con_FShare, SMB_Con_PShare, SMB_Con_IPC} SMB_Con_Types; typedef enum {SMB_State_NoState, SMB_State_Stopped, SMB_State_Started} SMB_State_Types; /* The following two arrays need to be in step! */ /* We must make it possible for callers to specify these ... */ static char *SMB_Prots[] = {"PC NETWORK PROGRAM 1.0", "MICROSOFT NETWORKS 1.03", "MICROSOFT NETWORKS 3.0", "DOS LANMAN1.0", "LANMAN1.0", "DOS LM1.2X002", "LM1.2X002", "DOS LANMAN2.1", "LANMAN2.1", "Samba", "NT LM 0.12", "NT LANMAN 1.0", NULL}; static int SMB_Types[] = {SMB_P_Core, SMB_P_CorePlus, SMB_P_DOSLanMan1, SMB_P_DOSLanMan1, SMB_P_LanMan1, SMB_P_DOSLanMan2, SMB_P_LanMan2, SMB_P_LanMan2_1, SMB_P_LanMan2_1, SMB_P_NT1, SMB_P_NT1, SMB_P_NT1, -1}; typedef struct SMB_Status { union { struct { unsigned char ErrorClass; unsigned char Reserved; unsigned short Error; } DosError; unsigned int NtStatus; } status; } SMB_Status; typedef struct SMB_Tree_Structure * SMB_Tree_Handle; typedef struct SMB_Connect_Def * SMB_Handle_Type; struct SMB_Connect_Def { SMB_Handle_Type Next_Con, Prev_Con; /* Next and previous conn */ int protocol; /* What is the protocol */ int prot_IDX; /* And what is the index */ void *Trans_Connect; /* The connection */ /* All these strings should be malloc'd */ char service[80], username[80], password[80], desthost[80], sock_options[80]; char address[80], myname[80]; SMB_Tree_Handle first_tree, last_tree; /* List of trees on this server */ int gid; /* Group ID, do we need it? */ int mid; /* Multiplex ID? We might need one per con */ int pid; /* Process ID */ int uid; /* Authenticated user id. */ /* It is pretty clear that we need to bust some of */ /* these out into a per TCon record, as there may */ /* be multiple TCon's per server, etc ... later */ int port; /* port to use in case not default, this is a TCPism! */ int max_xmit; /* Max xmit permitted by server */ int Security; /* 0 = share, 1 = user */ int Raw_Support; /* bit 0 = 1 = Read Raw supported, 1 = 1 Write raw */ BOOL encrypt_passwords; /* FALSE = don't */ int MaxMPX, MaxVC, MaxRaw; unsigned int SessionKey, Capabilities; int SvrTZ; /* Server Time Zone */ int Encrypt_Key_Len; char Encrypt_Key[80], Domain[80], PDomain[80], OSName[80], LMType[40]; char Svr_OS[80], Svr_LMType[80], Svr_PDom[80]; }; #define SMBLIB_DEFAULT_DOMAIN "STAFF" #define SMBLIB_DEFAULT_OSNAME "UNIX of some type" #define SMBLIB_DEFAULT_LMTYPE "SMBlib LM2.1 minus a bit" #define SMBLIB_MAX_XMIT 65535 #define SMB_Sec_Mode_Share 0 #define SMB_Sec_Mode_User 1 /* A Tree_Structure */ struct SMB_Tree_Structure { SMB_Tree_Handle next, prev; SMB_Handle_Type con; char path[129]; char device_type[20]; int mbs; /* Local MBS */ int tid; }; typedef struct SMB_File_Def SMB_File; struct SMB_File_Def { SMB_Tree_Handle tree; char filename[256]; /* We should malloc this ... */ UWORD fid; unsigned int lastmod; unsigned int size; /* Could blow up if 64bit files supported */ UWORD access; off_t fileloc; }; /* global Variables for the library */ extern SMB_State_Types SMBlib_State; #ifndef SMBLIB_ERRNO extern int SMBlib_errno; extern int SMBlib_SMB_Error; /* last Error */ #endif SMB_Tree_Handle SMB_TreeConnect(SMB_Handle_Type con, SMB_Tree_Handle tree, char *path, char *password, char *dev); muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/smblib-util.c0100644000175000017500000005004607554515351023522 0ustar joergjoerg/* UNIX SMBlib NetBIOS implementation Version 1.0 SMBlib Utility Routines Copyright (C) Richard Sharpe 1996 */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "smblib-priv.h" #include #include "rfcnb.h" /* Print out an SMB pkt in all its gory detail ... */ void SMB_Print_Pkt(FILE fd, RFCNB_Pkt *pkt, BOOL command, int Offset, int Len) { /* Well, just how do we do this ... print it I suppose */ /* Print out the SMB header ... */ /* Print the command */ /* Print the other bits in the header */ /* etc */ } /* Convert a DOS Date_Time to a local host type date time for printing */ char *SMB_DOSTimToStr(int DOS_time) { static char SMB_Time_Temp[48]; int DOS_sec, DOS_min, DOS_hour, DOS_day, DOS_month, DOS_year; SMB_Time_Temp[0] = 0; DOS_sec = (DOS_time & 0x001F) * 2; DOS_min = (DOS_time & 0x07E0) >> 5; DOS_hour = ((DOS_time & 0xF800) >> 11); DOS_day = (DOS_time & 0x001F0000) >> 16; DOS_month = (DOS_time & 0x01E00000) >> 21; DOS_year = ((DOS_time & 0xFE000000) >> 25) + 80; sprintf(SMB_Time_Temp, "%2d/%02d/%2d %2d:%02d:%02d", DOS_day, DOS_month, DOS_year, DOS_hour, DOS_min, DOS_sec); return(SMB_Time_Temp); } /* Convert an attribute byte/word etc to a string ... We return a pointer to a static string which we guarantee is long enough. If verbose is true, we print out long form of strings ... */ char *SMB_AtrToStr(int attribs, BOOL verbose) { static char SMB_Attrib_Temp[128]; SMB_Attrib_Temp[0] = 0; if (attribs & SMB_FA_ROF) strcat(SMB_Attrib_Temp, (verbose?"Read Only ":"R")); if (attribs & SMB_FA_HID) strcat(SMB_Attrib_Temp, (verbose?"Hidden ":"H")); if (attribs & SMB_FA_SYS) strcat(SMB_Attrib_Temp, (verbose?"System ":"S")); if (attribs & SMB_FA_VOL) strcat(SMB_Attrib_Temp, (verbose?"Volume ":"V")); if (attribs & SMB_FA_DIR) strcat(SMB_Attrib_Temp, (verbose?"Directory ":"D")); if (attribs & SMB_FA_ARC) strcat(SMB_Attrib_Temp, (verbose?"Archive ":"A")); return(SMB_Attrib_Temp); } /* Pick up the Max Buffer Size from the Tree Structure ... */ int SMB_Get_Tree_MBS(SMB_Tree_Handle tree) { if (tree != NULL) { return(tree -> mbs); } else { return(SMBlibE_BAD); } } /* Pick up the Max buffer size */ int SMB_Get_Max_Buf_Siz(SMB_Handle_Type Con_Handle) { if (Con_Handle != NULL) { return(Con_Handle -> max_xmit); } else { return(SMBlibE_BAD); } } /* Pickup the protocol index from the connection structure */ int SMB_Get_Protocol_IDX(SMB_Handle_Type Con_Handle) { if (Con_Handle != NULL) { return(Con_Handle -> prot_IDX); } else { return(0xFFFF); /* Invalid protocol */ } } /* Pick up the protocol from the connection structure */ int SMB_Get_Protocol(SMB_Handle_Type Con_Handle) { if (Con_Handle != NULL) { return(Con_Handle -> protocol); } else { return(0xFFFF); /* Invalid protocol */ } } /* Figure out what protocol was accepted, given the list of dialect strings */ /* We offered, and the index back from the server. We allow for a user */ /* supplied list, and assume that it is a subset of our list */ int SMB_Figure_Protocol(char *dialects[], int prot_index) { int i; if (dialects == SMB_Prots) { /* The jobs is easy, just index into table */ return(SMB_Types[prot_index]); } else { /* Search through SMB_Prots looking for a match */ for (i = 0; SMB_Prots[i] != NULL; i++) { if (strcmp(dialects[prot_index], SMB_Prots[i]) == 0) { /* A match */ return(SMB_Types[i]); } } /* If we got here, then we are in trouble, because the protocol was not */ /* One we understand ... */ return(SMB_P_Unknown); } } /* Negotiate the protocol we will use from the list passed in Prots */ /* we return the index of the accepted protocol in NegProt, -1 indicates */ /* none acceptible, and our return value is 0 if ok, <0 if problems */ int SMB_Negotiate(SMB_Handle_Type Con_Handle, char *Prots[]) { struct SMB_Neg_Prot_Def *prot_pkt; struct SMB_Neg_Prot_Resp_Def *resp_pkt; struct RFCNB_Pkt *pkt; int prots_len, i, pkt_len, prot, alloc_len; char *p; /* Figure out how long the prot list will be and allocate space for it */ prots_len = 0; for (i = 0; Prots[i] != NULL; i++) { prots_len = prots_len + strlen(Prots[i]) + 2; /* Account for null etc */ } /* The -1 accounts for the one byte smb_buf we have because some systems */ /* don't like char msg_buf[] */ pkt_len = SMB_negp_len + prots_len; /* Make sure that the pkt len is long enough for the max response ... */ /* Which is a problem, because the encryption key len eec may be long */ if (pkt_len < (SMB_hdr_wct_offset + (19 * 2) + 40)) { alloc_len = SMB_hdr_wct_offset + (19 * 2) + 40; } else { alloc_len = pkt_len; } pkt = (struct RFCNB_Pkt *)RFCNB_Alloc_Pkt(alloc_len); if (pkt == NULL) { SMBlib_errno = SMBlibE_NoSpace; return(SMBlibE_BAD); } /* Now plug in the bits we need */ bzero(SMB_Hdr(pkt), SMB_negp_len); SIVAL(SMB_Hdr(pkt), SMB_hdr_idf_offset, SMB_DEF_IDF); /* Plunk in IDF */ *(SMB_Hdr(pkt) + SMB_hdr_com_offset) = SMBnegprot; SSVAL(SMB_Hdr(pkt), SMB_hdr_pid_offset, Con_Handle -> pid); SSVAL(SMB_Hdr(pkt), SMB_hdr_tid_offset, 0); SSVAL(SMB_Hdr(pkt), SMB_hdr_mid_offset, Con_Handle -> mid); SSVAL(SMB_Hdr(pkt), SMB_hdr_uid_offset, Con_Handle -> uid); *(SMB_Hdr(pkt) + SMB_hdr_wct_offset) = 0; SSVAL(SMB_Hdr(pkt), SMB_negp_bcc_offset, prots_len); /* Now copy the prot strings in with the right stuff */ p = (char *)(SMB_Hdr(pkt) + SMB_negp_buf_offset); for (i = 0; Prots[i] != NULL; i++) { *p = SMBdialectID; strcpy(p + 1, Prots[i]); p = p + strlen(Prots[i]) + 2; /* Adjust len of p for null plus dialectID */ } /* Now send the packet and sit back ... */ if (RFCNB_Send(Con_Handle -> Trans_Connect, pkt, pkt_len) < 0){ #ifdef DEBUG fprintf(stderr, "Error sending negotiate protocol\n"); #endif RFCNB_Free_Pkt(pkt); SMBlib_errno = -SMBlibE_SendFailed; /* Failed, check lower layer errno */ return(SMBlibE_BAD); } /* Now get the response ... */ if (RFCNB_Recv(Con_Handle -> Trans_Connect, pkt, alloc_len) < 0) { #ifdef DEBUG fprintf(stderr, "Error receiving response to negotiate\n"); #endif RFCNB_Free_Pkt(pkt); SMBlib_errno = -SMBlibE_RecvFailed; /* Failed, check lower layer errno */ return(SMBlibE_BAD); } if (CVAL(SMB_Hdr(pkt), SMB_hdr_rcls_offset) != SMBC_SUCCESS) { /* Process error */ #ifdef DEBUG fprintf(stderr, "SMB_Negotiate failed with errorclass = %i, Error Code = %i\n", CVAL(SMB_Hdr(pkt), SMB_hdr_rcls_offset), SVAL(SMB_Hdr(pkt), SMB_hdr_err_offset)); #endif SMBlib_SMB_Error = IVAL(SMB_Hdr(pkt), SMB_hdr_rcls_offset); RFCNB_Free_Pkt(pkt); SMBlib_errno = SMBlibE_Remote; return(SMBlibE_BAD); } if (SVAL(SMB_Hdr(pkt), SMB_negrCP_idx_offset) == 0xFFFF) { #ifdef DEBUG fprintf(stderr, "None of our protocols was accepted ... "); #endif RFCNB_Free_Pkt(pkt); SMBlib_errno = SMBlibE_NegNoProt; return(SMBlibE_BAD); } /* Now, unpack the info from the response, if any and evaluate the proto */ /* selected. We must make sure it is one we like ... */ Con_Handle -> prot_IDX = prot = SVAL(SMB_Hdr(pkt), SMB_negrCP_idx_offset); Con_Handle -> protocol = SMB_Figure_Protocol(Prots, prot); if (Con_Handle -> protocol == SMB_P_Unknown) { /* No good ... */ RFCNB_Free_Pkt(pkt); SMBlib_errno = SMBlibE_ProtUnknown; return(SMBlibE_BAD); } switch (CVAL(SMB_Hdr(pkt), SMB_hdr_wct_offset)) { case 0x01: /* No more info ... */ break; case 13: /* Up to and including LanMan 2.1 */ Con_Handle -> Security = SVAL(SMB_Hdr(pkt), SMB_negrLM_sec_offset); Con_Handle -> encrypt_passwords = ((Con_Handle -> Security & SMB_sec_encrypt_mask) != 0x00); Con_Handle -> Security = Con_Handle -> Security & SMB_sec_user_mask; Con_Handle -> max_xmit = SVAL(SMB_Hdr(pkt), SMB_negrLM_mbs_offset); Con_Handle -> MaxMPX = SVAL(SMB_Hdr(pkt), SMB_negrLM_mmc_offset); Con_Handle -> MaxVC = SVAL(SMB_Hdr(pkt), SMB_negrLM_mnv_offset); Con_Handle -> Raw_Support = SVAL(SMB_Hdr(pkt), SMB_negrLM_rm_offset); Con_Handle -> SessionKey = IVAL(SMB_Hdr(pkt), SMB_negrLM_sk_offset); Con_Handle -> SvrTZ = SVAL(SMB_Hdr(pkt), SMB_negrLM_stz_offset); Con_Handle -> Encrypt_Key_Len = SVAL(SMB_Hdr(pkt), SMB_negrLM_ekl_offset); p = (SMB_Hdr(pkt) + SMB_negrLM_buf_offset); fprintf(stderr, "%d", (char *)(SMB_Hdr(pkt) + SMB_negrLM_buf_offset)); memcpy(Con_Handle->Encrypt_Key, p, 8); p = (SMB_Hdr(pkt) + SMB_negrLM_buf_offset + Con_Handle -> Encrypt_Key_Len); strncpy(p, Con_Handle -> Svr_PDom, sizeof(Con_Handle -> Svr_PDom) - 1); break; case 17: /* NT LM 0.12 and LN LM 1.0 */ Con_Handle -> Security = SVAL(SMB_Hdr(pkt), SMB_negrNTLM_sec_offset); Con_Handle -> encrypt_passwords = ((Con_Handle -> Security & SMB_sec_encrypt_mask) != 0x00); Con_Handle -> Security = Con_Handle -> Security & SMB_sec_user_mask; Con_Handle -> max_xmit = IVAL(SMB_Hdr(pkt), SMB_negrNTLM_mbs_offset); Con_Handle -> MaxMPX = SVAL(SMB_Hdr(pkt), SMB_negrNTLM_mmc_offset); Con_Handle -> MaxVC = SVAL(SMB_Hdr(pkt), SMB_negrNTLM_mnv_offset); Con_Handle -> MaxRaw = IVAL(SMB_Hdr(pkt), SMB_negrNTLM_mrs_offset); Con_Handle -> SessionKey = IVAL(SMB_Hdr(pkt), SMB_negrNTLM_sk_offset); Con_Handle -> SvrTZ = SVAL(SMB_Hdr(pkt), SMB_negrNTLM_stz_offset); Con_Handle -> Encrypt_Key_Len = CVAL(SMB_Hdr(pkt), SMB_negrNTLM_ekl_offset); p = (SMB_Hdr(pkt) + SMB_negrNTLM_buf_offset ); memcpy(Con_Handle -> Encrypt_Key, p, 8); p = (SMB_Hdr(pkt) + SMB_negrNTLM_buf_offset + Con_Handle -> Encrypt_Key_Len); strncpy(p, Con_Handle -> Svr_PDom, sizeof(Con_Handle -> Svr_PDom) - 1); break; default: #ifdef DEBUG fprintf(stderr, "Unknown NegProt response format ... Ignored\n"); fprintf(stderr, " wct = %i\n", CVAL(SMB_Hdr(pkt), SMB_hdr_wct_offset)); #endif break; } #ifdef DEBUG fprintf(stderr, "Protocol selected is: %i:%s\n", prot, Prots[prot]); #endif RFCNB_Free_Pkt(pkt); return(0); } /* Get our hostname */ void SMB_Get_My_Name(char *name, int len) { int loc; if (gethostname(name, len) < 0) { /* Error getting name */ strncpy(name, "unknown", len); /* Should check the error */ #ifdef DEBUG fprintf(stderr, "gethostname in SMB_Get_My_Name returned error:"); perror(""); #endif } /* only keep the portion up to the first "." */ } /* Send a TCON to the remote server ... */ SMB_Tree_Handle SMB_TreeConnect(SMB_Handle_Type Con_Handle, SMB_Tree_Handle Tree_Handle, char *path, char *password, char *device) { struct RFCNB_Pkt *pkt; int param_len, i, pkt_len; char *p; SMB_Tree_Handle tree; /* Figure out how much space is needed for path, password, dev ... */ if (path == NULL | password == NULL | device == NULL) { #ifdef DEBUG fprintf(stderr, "Bad parameter passed to SMB_TreeConnect\n"); #endif SMBlib_errno = SMBlibE_BadParam; return(NULL); } /* The + 2 is because of the \0 and the marker ... */ param_len = strlen(path) + 2 + strlen(password) + 2 + strlen(device) + 2; /* The -1 accounts for the one byte smb_buf we have because some systems */ /* don't like char msg_buf[] */ pkt_len = SMB_tcon_len + param_len; pkt = (struct RFCNB_Pkt *)RFCNB_Alloc_Pkt(pkt_len); if (pkt == NULL) { SMBlib_errno = SMBlibE_NoSpace; return(NULL); /* Should handle the error */ } /* Now allocate a tree for this to go into ... */ if (Tree_Handle == NULL) { tree = (SMB_Tree_Handle)malloc(sizeof(struct SMB_Tree_Structure)); if (tree == NULL) { RFCNB_Free_Pkt(pkt); SMBlib_errno = SMBlibE_NoSpace; return(NULL); } } else { tree = Tree_Handle; } tree -> next = tree -> prev = NULL; tree -> con = Con_Handle; strncpy(tree -> path, path, sizeof(tree -> path)); strncpy(tree -> device_type, device, sizeof(tree -> device_type)); /* Now plug in the values ... */ bzero(SMB_Hdr(pkt), SMB_tcon_len); SIVAL(SMB_Hdr(pkt), SMB_hdr_idf_offset, SMB_DEF_IDF); /* Plunk in IDF */ *(SMB_Hdr(pkt) + SMB_hdr_com_offset) = SMBtcon; SSVAL(SMB_Hdr(pkt), SMB_hdr_pid_offset, Con_Handle -> pid); SSVAL(SMB_Hdr(pkt), SMB_hdr_tid_offset, 0); SSVAL(SMB_Hdr(pkt), SMB_hdr_mid_offset, Con_Handle -> mid); SSVAL(SMB_Hdr(pkt), SMB_hdr_uid_offset, Con_Handle -> uid); *(SMB_Hdr(pkt) + SMB_hdr_wct_offset) = 0; SSVAL(SMB_Hdr(pkt), SMB_tcon_bcc_offset, param_len); /* Now copy the param strings in with the right stuff */ p = (char *)(SMB_Hdr(pkt) + SMB_tcon_buf_offset); *p = SMBasciiID; strcpy(p + 1, path); p = p + strlen(path) + 2; *p = SMBasciiID; strcpy(p + 1, password); p = p + strlen(password) + 2; *p = SMBasciiID; strcpy(p + 1, device); /* Now send the packet and sit back ... */ if (RFCNB_Send(Con_Handle -> Trans_Connect, pkt, pkt_len) < 0){ #ifdef DEBUG fprintf(stderr, "Error sending TCon request\n"); #endif if (Tree_Handle == NULL) free(tree); RFCNB_Free_Pkt(pkt); SMBlib_errno = -SMBlibE_SendFailed; return(NULL); } /* Now get the response ... */ if (RFCNB_Recv(Con_Handle -> Trans_Connect, pkt, pkt_len) < 0) { #ifdef DEBUG fprintf(stderr, "Error receiving response to TCon\n"); #endif if (Tree_Handle == NULL) free(tree); RFCNB_Free_Pkt(pkt); SMBlib_errno = -SMBlibE_RecvFailed; return(NULL); } /* Check out the response type ... */ if (CVAL(SMB_Hdr(pkt), SMB_hdr_rcls_offset) != SMBC_SUCCESS) { /* Process error */ #ifdef DEBUG fprintf(stderr, "SMB_TCon failed with errorclass = %i, Error Code = %i\n", CVAL(SMB_Hdr(pkt), SMB_hdr_rcls_offset), SVAL(SMB_Hdr(pkt), SMB_hdr_err_offset)); #endif if (Tree_Handle == NULL) free(tree); SMBlib_SMB_Error = IVAL(SMB_Hdr(pkt), SMB_hdr_rcls_offset); RFCNB_Free_Pkt(pkt); SMBlib_errno = SMBlibE_Remote; return(NULL); } tree -> tid = SVAL(SMB_Hdr(pkt), SMB_tconr_tid_offset); tree -> mbs = SVAL(SMB_Hdr(pkt), SMB_tconr_mbs_offset); #ifdef DEBUG fprintf(stderr, "TConn succeeded, with TID=%i, Max Xmit=%i\n", tree -> tid, tree -> mbs); #endif /* Now link the Tree to the Server Structure ... */ if (Con_Handle -> first_tree == NULL) { Con_Handle -> first_tree == tree; Con_Handle -> last_tree == tree; } else { Con_Handle -> last_tree -> next = tree; tree -> prev = Con_Handle -> last_tree; Con_Handle -> last_tree = tree; } RFCNB_Free_Pkt(pkt); return(tree); } int SMB_TreeDisconnect(SMB_Tree_Handle Tree_Handle, BOOL discard) { struct RFCNB_Pkt *pkt; int pkt_len; pkt_len = SMB_tdis_len; pkt = (struct RFCNB_Pkt *)RFCNB_Alloc_Pkt(pkt_len); if (pkt == NULL) { SMBlib_errno = SMBlibE_NoSpace; return(SMBlibE_BAD); /* Should handle the error */ } /* Now plug in the values ... */ bzero(SMB_Hdr(pkt), SMB_tdis_len); SIVAL(SMB_Hdr(pkt), SMB_hdr_idf_offset, SMB_DEF_IDF); /* Plunk in IDF */ *(SMB_Hdr(pkt) + SMB_hdr_com_offset) = SMBtdis; SSVAL(SMB_Hdr(pkt), SMB_hdr_pid_offset, Tree_Handle -> con -> pid); SSVAL(SMB_Hdr(pkt), SMB_hdr_mid_offset, Tree_Handle -> con -> mid); SSVAL(SMB_Hdr(pkt), SMB_hdr_uid_offset, Tree_Handle -> con -> uid); *(SMB_Hdr(pkt) + SMB_hdr_wct_offset) = 0; SSVAL(SMB_Hdr(pkt), SMB_hdr_tid_offset, Tree_Handle -> tid); SSVAL(SMB_Hdr(pkt), SMB_tcon_bcc_offset, 0); /* Now send the packet and sit back ... */ if (RFCNB_Send(Tree_Handle -> con -> Trans_Connect, pkt, pkt_len) < 0){ #ifdef DEBUG fprintf(stderr, "Error sending TDis request\n"); #endif RFCNB_Free_Pkt(pkt); SMBlib_errno = -SMBlibE_SendFailed; return(SMBlibE_BAD); } /* Now get the response ... */ if (RFCNB_Recv(Tree_Handle -> con -> Trans_Connect, pkt, pkt_len) < 0) { #ifdef DEBUG fprintf(stderr, "Error receiving response to TCon\n"); #endif RFCNB_Free_Pkt(pkt); SMBlib_errno = -SMBlibE_RecvFailed; return(SMBlibE_BAD); } /* Check out the response type ... */ if (CVAL(SMB_Hdr(pkt), SMB_hdr_rcls_offset) != SMBC_SUCCESS) { /* Process error */ #ifdef DEBUG fprintf(stderr, "SMB_TDis failed with errorclass = %i, Error Code = %i\n", CVAL(SMB_Hdr(pkt), SMB_hdr_rcls_offset), SVAL(SMB_Hdr(pkt), SMB_hdr_err_offset)); #endif SMBlib_SMB_Error = IVAL(SMB_Hdr(pkt), SMB_hdr_rcls_offset); RFCNB_Free_Pkt(pkt); SMBlib_errno = SMBlibE_Remote; return(SMBlibE_BAD); } Tree_Handle -> tid = 0xFFFF; /* Invalid TID */ Tree_Handle -> mbs = 0; /* Invalid */ #ifdef DEBUG fprintf(stderr, "Tree disconnect successful ...\n"); #endif /* What about the tree handle ? */ if (discard == TRUE) { /* Unlink it and free it ... */ if (Tree_Handle -> next == NULL) Tree_Handle -> con -> first_tree = Tree_Handle -> prev; else Tree_Handle -> next -> prev = Tree_Handle -> prev; if (Tree_Handle -> prev == NULL) Tree_Handle -> con -> last_tree = Tree_Handle -> next; else Tree_Handle -> prev -> next = Tree_Handle -> next; } RFCNB_Free_Pkt(pkt); return(0); } /* Pick up the last LMBlib error ... */ int SMB_Get_Last_Error() { return(SMBlib_errno); } /* Pick up the last error returned in an SMB packet */ /* We will need macros to extract error class and error code */ int SMB_Get_Last_SMB_Err() { return(SMBlib_SMB_Error); } /* Pick up the error message associated with an error from SMBlib */ /* Keep this table in sync with the message codes in smblib-common.h */ static char *SMBlib_Error_Messages[] = { "Request completed sucessfully.", "Server returned a non-zero SMB Error Class and Code.", "A lower layer protocol error occurred.", "Function not yet implemented.", "The protocol negotiated does not support the request.", "No space available for operation.", "One or more bad parameters passed.", "None of the protocols we offered were accepted.", "The attempt to send an SMB request failed. See protocol error info.", "The attempt to get an SMB response failed. See protocol error info.", "The logon request failed, but you were logged in as guest.", "The attempt to call the remote server failed. See protocol error info.", "The protocol dialect specified in a NegProt and accepted by the server is unknown.", /* This next one simplifies error handling */ "No such error code.", NULL}; int SMB_Get_Error_Msg(int msg, char *msgbuf, int len) { if (msg >= 0) { strncpy(msgbuf, SMBlib_Error_Messages[msg>SMBlibE_NoSuchMsg?SMBlibE_NoSuchMsg:msg], len - 1); msgbuf[len - 1] = 0; /* Make sure it is a string */ } else { /* Add the lower layer message ... */ char prot_msg[1024]; msg = -msg; /* Make it positive */ strncpy(msgbuf, SMBlib_Error_Messages[msg>SMBlibE_NoSuchMsg?SMBlibE_NoSuchMsg:msg], len - 1); msgbuf[len - 1] = 0; /* make sure it is a string */ if (strlen(msgbuf) < len) { /* If there is space, put rest in */ strncat(msgbuf, "\n\t", len - strlen(msgbuf)); RFCNB_Get_Error(prot_msg, sizeof(prot_msg) - 1); strncat(msgbuf, prot_msg, len - strlen(msgbuf)); } } } muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/smblib.c0100644000175000017500000003405407554515351022550 0ustar joergjoerg/* UNIX SMBlib NetBIOS implementation Version 1.0 SMBlib Routines Copyright (C) Richard Sharpe 1996 */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "../config.h" #include int SMBlib_errno; int SMBlib_SMB_Error; #define SMBLIB_ERRNO #define uchar unsigned char #include "smblib-priv.h" #include "rfcnb.h" #include SMB_State_Types SMBlib_State; /* Initialize the SMBlib package */ int SMB_Init() { SMBlib_State = SMB_State_Started; signal(SIGPIPE, SIG_IGN); /* Ignore these ... */ /* If SMBLIB_Instrument is defines, turn on the instrumentation stuff */ #ifdef SMBLIB_INSTRUMENT SMBlib_Instrument_Init(); #endif return 0; } int SMB_Term() { #ifdef SMBLIB_INSTRUMENT SMBlib_Instrument_Term(); /* Clean up and print results */ #endif return 0; } /* SMB_Create: Create a connection structure and return for later use */ /* We have other helper routines to set variables */ SMB_Handle_Type SMB_Create_Con_Handle() { SMBlib_errno = SMBlibE_NotImpl; return(NULL); } int SMBlib_Set_Sock_NoDelay(SMB_Handle_Type Con_Handle, BOOL yn) { if (RFCNB_Set_Sock_NoDelay(Con_Handle -> Trans_Connect, yn) < 0) { #ifdef DEBUG #endif fprintf(stderr, "Setting no-delay on TCP socket failed ...\n"); } return(0); } /* SMB_Connect_Server: Connect to a server, but don't negotiate protocol */ /* or anything else ... */ SMB_Handle_Type SMB_Connect_Server(SMB_Handle_Type Con_Handle, char *server, char *NTdomain) { SMB_Handle_Type con; char temp[80], called[80], calling[80], *address; int i; /* Get a connection structure if one does not exist */ con = Con_Handle; if (Con_Handle == NULL) { if ((con = (struct SMB_Connect_Def *)malloc(sizeof(struct SMB_Connect_Def))) == NULL) { SMBlib_errno = SMBlibE_NoSpace; return NULL; } } /* Init some things ... */ strcpy(con -> service, ""); strcpy(con -> username, ""); strcpy(con -> password, ""); strcpy(con -> sock_options, ""); strcpy(con -> address, ""); strcpy(con -> desthost, server); strcpy(con -> PDomain, NTdomain); strcpy(con -> OSName, SMBLIB_DEFAULT_OSNAME); strcpy(con -> LMType, SMBLIB_DEFAULT_LMTYPE); con -> first_tree = con -> last_tree = NULL; SMB_Get_My_Name(con -> myname, sizeof(con -> myname)); con -> port = 0; /* No port selected */ /* Get some things we need for the SMB Header */ con -> pid = getpid(); con -> mid = con -> pid; /* This will do for now ... */ con -> uid = 0; /* Until we have done a logon, no uid ... */ con -> gid = getgid(); /* Now connect to the remote end, but first upper case the name of the service we are going to call, sine some servers want it in uppercase */ for (i=0; i < strlen(server); i++) called[i] = toupper(server[i]); called[strlen(server)] = 0; /* Make it a string */ for (i=0; i < strlen(con -> myname); i++) calling[i] = toupper(con -> myname[i]); calling[strlen(con -> myname)] = 0; /* Make it a string */ if (strcmp(con -> address, "") == 0) address = con -> desthost; else address = con -> address; con -> Trans_Connect = RFCNB_Call(called, calling, address, /* Protocol specific */ con -> port); /* Did we get one? */ if (con -> Trans_Connect == NULL) { if (Con_Handle == NULL) { Con_Handle = NULL; free(con); } SMBlib_errno = -SMBlibE_CallFailed; return NULL; } return(con); } /* SMB_Connect: Connect to the indicated server */ /* If Con_Handle == NULL then create a handle and connect, otherwise */ /* use the handle passed */ char *SMB_Prots_Restrict[] = {"PC NETWORK PROGRAM 1.0", NULL}; SMB_Handle_Type SMB_Connect(SMB_Handle_Type Con_Handle, SMB_Tree_Handle *tree, char *service, char *username, char *password) { SMB_Handle_Type con; char *host, *address; char temp[80], called[80], calling[80]; int i; /* Get a connection structure if one does not exist */ con = Con_Handle; if (Con_Handle == NULL) { if ((con = (struct SMB_Connect_Def *)malloc(sizeof(struct SMB_Connect_Def))) == NULL) { SMBlib_errno = SMBlibE_NoSpace; return NULL; } } /* Init some things ... */ strcpy(con -> service, service); strcpy(con -> username, username); strcpy(con -> password, password); strcpy(con -> sock_options, ""); strcpy(con -> address, ""); strcpy(con -> PDomain, SMBLIB_DEFAULT_DOMAIN); strcpy(con -> OSName, SMBLIB_DEFAULT_OSNAME); strcpy(con -> LMType, SMBLIB_DEFAULT_LMTYPE); con -> first_tree = con -> last_tree = NULL; SMB_Get_My_Name(con -> myname, sizeof(con -> myname)); con -> port = 0; /* No port selected */ /* Get some things we need for the SMB Header */ con -> pid = getpid(); con -> mid = con -> pid; /* This will do for now ... */ con -> uid = 0; /* Until we have done a logon, no uid */ con -> gid = getgid(); /* Now figure out the host portion of the service */ strcpy(temp, service); host = strtok(temp, "/\\"); /* Separate host name portion */ strcpy(con -> desthost, host); /* Now connect to the remote end, but first upper case the name of the service we are going to call, sine some servers want it in uppercase */ for (i=0; i < strlen(host); i++) called[i] = toupper(host[i]); called[strlen(host)] = 0; /* Make it a string */ for (i=0; i < strlen(con -> myname); i++) calling[i] = toupper(con -> myname[i]); calling[strlen(con -> myname)] = 0; /* Make it a string */ if (strcmp(con -> address, "") == 0) address = con -> desthost; else address = con -> address; con -> Trans_Connect = RFCNB_Call(called, calling, address, /* Protocol specific */ con -> port); /* Did we get one? */ if (con -> Trans_Connect == NULL) { if (Con_Handle == NULL) { free(con); Con_Handle = NULL; } SMBlib_errno = -SMBlibE_CallFailed; return NULL; } /* Now, negotiate the protocol */ if (SMB_Negotiate(con, SMB_Prots_Restrict) < 0) { /* Hmmm what should we do here ... We have a connection, but could not negotiate ... */ return NULL; } /* Now connect to the service ... */ if ((*tree = SMB_TreeConnect(con, NULL, service, password, "A:")) == NULL) { return NULL; } return(con); } /* Logon to the server. That is, do a session setup if we can. We do not do */ /* Unicode yet! */ int SMB_Logon_Server(SMB_Handle_Type Con_Handle, char *UserName, char *PassWord) { struct RFCNB_Pkt *pkt; int param_len, i, pkt_len, pass_len,a; char *p, pword[128]; /* First we need a packet etc ... but we need to know what protocol has */ /* been negotiated to figure out if we can do it and what SMB format to */ /* use ... */ if (Con_Handle -> protocol < SMB_P_LanMan1) { SMBlib_errno = SMBlibE_ProtLow; return(SMBlibE_BAD); } strcpy(pword, PassWord); #ifdef PAM_SMB_ENC_PASS if (Con_Handle -> encrypt_passwords) { pass_len=24; SMBencrypt((uchar *) PassWord, (uchar *)Con_Handle -> Encrypt_Key,(uchar *)pword); } else #endif pass_len=strlen(pword); /* Now build the correct structure */ if (Con_Handle -> protocol < SMB_P_NT1) { param_len = strlen(UserName) + 1 + pass_len + 1 + strlen(Con_Handle -> PDomain) + 1 + strlen(Con_Handle -> OSName) + 1; pkt_len = SMB_ssetpLM_len + param_len; pkt = (struct RFCNB_Pkt *)RFCNB_Alloc_Pkt(pkt_len); if (pkt == NULL) { SMBlib_errno = SMBlibE_NoSpace; return(SMBlibE_BAD); /* Should handle the error */ } bzero(SMB_Hdr(pkt), SMB_ssetpLM_len); SIVAL(SMB_Hdr(pkt), SMB_hdr_idf_offset, SMB_DEF_IDF); /* Plunk in IDF */ *(SMB_Hdr(pkt) + SMB_hdr_com_offset) = SMBsesssetupX; SSVAL(SMB_Hdr(pkt), SMB_hdr_pid_offset, Con_Handle -> pid); SSVAL(SMB_Hdr(pkt), SMB_hdr_tid_offset, 0); SSVAL(SMB_Hdr(pkt), SMB_hdr_mid_offset, Con_Handle -> mid); SSVAL(SMB_Hdr(pkt), SMB_hdr_uid_offset, Con_Handle -> uid); *(SMB_Hdr(pkt) + SMB_hdr_wct_offset) = 10; *(SMB_Hdr(pkt) + SMB_hdr_axc_offset) = 0xFF; /* No extra command */ SSVAL(SMB_Hdr(pkt), SMB_hdr_axo_offset, 0); SSVAL(SMB_Hdr(pkt), SMB_ssetpLM_mbs_offset, SMBLIB_MAX_XMIT); SSVAL(SMB_Hdr(pkt), SMB_ssetpLM_mmc_offset, 2); SSVAL(SMB_Hdr(pkt), SMB_ssetpLM_vcn_offset, Con_Handle -> pid); SIVAL(SMB_Hdr(pkt), SMB_ssetpLM_snk_offset, 0); SSVAL(SMB_Hdr(pkt), SMB_ssetpLM_pwl_offset, pass_len + 1); SIVAL(SMB_Hdr(pkt), SMB_ssetpLM_res_offset, 0); SSVAL(SMB_Hdr(pkt), SMB_ssetpLM_bcc_offset, param_len); /* Now copy the param strings in with the right stuff */ p = (char *)(SMB_Hdr(pkt) + SMB_ssetpLM_buf_offset); /* Copy in password, then the rest. Password has a null at end */ memcpy(p, pword, pass_len); p = p + pass_len + 1; strcpy(p, UserName); p = p + strlen(UserName); *p = 0; p = p + 1; strcpy(p, Con_Handle -> PDomain); p = p + strlen(Con_Handle -> PDomain); *p = 0; p = p + 1; strcpy(p, Con_Handle -> OSName); p = p + strlen(Con_Handle -> OSName); *p = 0; } else { /* We don't admit to UNICODE support ... */ param_len = strlen(UserName) + 1 + pass_len + strlen(Con_Handle -> PDomain) + 1 + strlen(Con_Handle -> OSName) + 1 + strlen(Con_Handle -> LMType) + 1; pkt_len = SMB_ssetpNTLM_len + param_len; pkt = (struct RFCNB_Pkt *)RFCNB_Alloc_Pkt(pkt_len); if (pkt == NULL) { SMBlib_errno = SMBlibE_NoSpace; return(-1); /* Should handle the error */ } bzero(SMB_Hdr(pkt), SMB_ssetpNTLM_len); SIVAL(SMB_Hdr(pkt), SMB_hdr_idf_offset, SMB_DEF_IDF); /* Plunk in IDF */ *(SMB_Hdr(pkt) + SMB_hdr_com_offset) = SMBsesssetupX; SSVAL(SMB_Hdr(pkt), SMB_hdr_pid_offset, Con_Handle -> pid); SSVAL(SMB_Hdr(pkt), SMB_hdr_tid_offset, 0); SSVAL(SMB_Hdr(pkt), SMB_hdr_mid_offset, Con_Handle -> mid); SSVAL(SMB_Hdr(pkt), SMB_hdr_uid_offset, Con_Handle -> uid); *(SMB_Hdr(pkt) + SMB_hdr_wct_offset) = 13; *(SMB_Hdr(pkt) + SMB_hdr_axc_offset) = 0xFF; /* No extra command */ SSVAL(SMB_Hdr(pkt), SMB_hdr_axo_offset, 0); SSVAL(SMB_Hdr(pkt), SMB_ssetpNTLM_mbs_offset, SMBLIB_MAX_XMIT); SSVAL(SMB_Hdr(pkt), SMB_ssetpNTLM_mmc_offset, 0); SSVAL(SMB_Hdr(pkt), SMB_ssetpNTLM_vcn_offset, 0); SIVAL(SMB_Hdr(pkt), SMB_ssetpNTLM_snk_offset, 0); SSVAL(SMB_Hdr(pkt), SMB_ssetpNTLM_cipl_offset, pass_len); SSVAL(SMB_Hdr(pkt), SMB_ssetpNTLM_cspl_offset, 0); SIVAL(SMB_Hdr(pkt), SMB_ssetpNTLM_res_offset, 0); SIVAL(SMB_Hdr(pkt), SMB_ssetpNTLM_cap_offset, 0); SSVAL(SMB_Hdr(pkt), SMB_ssetpNTLM_bcc_offset, param_len); /* Now copy the param strings in with the right stuff */ p = (char *)(SMB_Hdr(pkt) + SMB_ssetpNTLM_buf_offset); /* Copy in password, then the rest. Password has no null at end */ memcpy(p, pword, pass_len); p = p + pass_len; strcpy(p, UserName); p = p + strlen(UserName); *p = 0; p = p + 1; strcpy(p, Con_Handle -> PDomain); p = p + strlen(Con_Handle -> PDomain); *p = 0; p = p + 1; strcpy(p, Con_Handle -> OSName); p = p + strlen(Con_Handle -> OSName); *p = 0; p = p + 1; strcpy(p, Con_Handle -> LMType); p = p + strlen(Con_Handle -> LMType); *p = 0; } /* Now send it and get a response */ if (RFCNB_Send(Con_Handle -> Trans_Connect, pkt, pkt_len) < 0){ #ifdef DEBUG fprintf(stderr, "Error sending SessSetupX request\n"); #endif RFCNB_Free_Pkt(pkt); SMBlib_errno = SMBlibE_SendFailed; return(SMBlibE_BAD); } /* Now get the response ... */ if (RFCNB_Recv(Con_Handle -> Trans_Connect, pkt, pkt_len) < 0) { #ifdef DEBUG fprintf(stderr, "Error receiving response to SessSetupAndX\n"); #endif RFCNB_Free_Pkt(pkt); SMBlib_errno = SMBlibE_RecvFailed; return(SMBlibE_BAD); } /* Check out the response type ... */ if (CVAL(SMB_Hdr(pkt), SMB_hdr_rcls_offset) != SMBC_SUCCESS) { /* Process error */ #ifdef DEBUG fprintf(stderr, "SMB_SessSetupAndX failed with errorclass = %i, Error Code = %i\n", CVAL(SMB_Hdr(pkt), SMB_hdr_rcls_offset), SVAL(SMB_Hdr(pkt), SMB_hdr_err_offset)); #endif SMBlib_SMB_Error = IVAL(SMB_Hdr(pkt), SMB_hdr_rcls_offset); RFCNB_Free_Pkt(pkt); SMBlib_errno = SMBlibE_Remote; return(SMBlibE_BAD); } /** @@@ mdz: check for guest login { **/ if (SVAL(SMB_Hdr(pkt), SMB_ssetpr_act_offset) & 0x1) { /* do we allow guest login? NO! */ return(SMBlibE_BAD); } /** @@@ mdz: } **/ #ifdef DEBUG fprintf(stderr, "SessSetupAndX response. Action = %i\n", SVAL(SMB_Hdr(pkt), SMB_ssetpr_act_offset)); #endif /* Now pick up the UID for future reference ... */ Con_Handle -> uid = SVAL(SMB_Hdr(pkt), SMB_hdr_uid_offset); RFCNB_Free_Pkt(pkt); return(0); } /* Disconnect from the server, and disconnect all tree connects */ int SMB_Discon(SMB_Handle_Type Con_Handle, BOOL KeepHandle) { /* We just disconnect the connection for now ... */ RFCNB_Hangup(Con_Handle -> Trans_Connect); if (!KeepHandle) free(Con_Handle); return(0); } muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/smblib.h0100644000175000017500000000560007554515351022550 0ustar joergjoerg/* UNIX SMBlib NetBIOS implementation Version 1.0 SMBlib Defines Copyright (C) Richard Sharpe 1996 */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "std-defines.h" #include "smblib-common.h" /* Just define all the entry points */ /* Create a handle to allow us to set/override some parameters ... */ void *SMB_Create_Con_Handle(); /* Connect to a server, but do not do a tree con etc ... */ void *SMB_Connect_Server(void *Con, char *server, char *NTdomain); /* Connect to a server and give us back a handle. If Con == NULL, create */ /* The handle and populate it with defaults */ void *SMB_Connect(void *Con, void **tree, char *name, char *User, char *Password); /* Negotiate a protocol */ int SMB_Negotiate(void *Con_Handle, char *Prots[]); /* Connect to a tree ... */ void *SMB_TreeConnect(void *con_handle, void *tree_handle, char *path, char *password, char *dev); /* Disconnect a tree ... */ int SMB_TreeDisconect(void *tree_handle); /* Open a file */ void *SMB_Open(void *tree_handle, void *file_handle, char *file_name, unsigned short mode, unsigned short search); /* Close a file */ int SMB_Close(void *file_handle); /* Disconnect from server. Has flag to specify whether or not we keep the */ /* handle. */ int SMB_Discon(void *Con, BOOL KeepHandle); void *SMB_Create(void *Tree_Handle, void *File_Handle, char *file_name, short search); int SMB_Delete(void *tree, char *file_name, short search); int SMB_Create_Dir(void *tree, char *dir_name); int SMB_Delete_Dir(void *tree, char *dir_name); int SMB_Check_Dir(void *tree, char *dir_name); int SMB_Get_Last_Error(); int SMB_Get_Last_SMB_Err(); int SMB_Get_Error_Msg(int msg, char *msgbuf, int len); void *SMB_Logon_And_TCon(void *con, void *tree, char *user, char *pass, char *service, char *st); #define SMBLIB_DEFAULT_DOMAIN "anydom" muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/std-defines.h0100644000175000017500000000215407554515351023506 0ustar joergjoerg/* RFCNB Standard includes ... */ /* SMBlib Standard Includes Copyright (C) 1996, Richard Sharpe /* One day we will conditionalize these on OS types ... */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define BOOL int typedef short int16; #include #include #include #include #include #include #include #include #include #define TRUE 1 #define FALSE 0 muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/std-includes.h0100644000175000017500000000225707554515351023703 0ustar joergjoerg/* RFCNB Standard includes ... */ /* RFCNB Standard Includes Copyright (C) 1996, Richard Sharpe /* One day we will conditionalize these on OS types ... */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define BOOL int typedef short int16; #include #include #include #include #include #include #include #include #define TRUE 1 #define FALSE 0 /* Pick up define for INADDR_NONE */ #ifndef INADDR_NONE #define INADDR_NONE -1 #endif muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/valid.c0100644000175000017500000000223707554515351022375 0ustar joergjoerg#include #include #include #include "smblib-priv.h" #include "valid.h" SMB_Handle_Type SMB_Connect_Server(void *, char *, char *); int Valid_User(char *USERNAME,char *PASSWORD,char *SERVER,char *BACKUP, char *DOMAIN) { char *SMB_Prots[] = {"PC NETWORK PROGRAM 1.0", "MICROSOFT NETWORKS 1.03", "MICROSOFT NETWORKS 3.0", "LANMAN1.0", "LM1.2X002", "Samba", "NT LM 0.12", "NT LANMAN 1.0", NULL}; SMB_Handle_Type con; SMB_Init(); con = SMB_Connect_Server(NULL, SERVER, DOMAIN); if (con == NULL) { /* Error ... */ con = SMB_Connect_Server(NULL, BACKUP, DOMAIN); if (con == NULL) { return(NTV_SERVER_ERROR); } } if (SMB_Negotiate(con, SMB_Prots) < 0) { /* An error */ SMB_Discon(con,0); return(NTV_PROTOCOL_ERROR); } /* Test for a server in share level mode do not authenticate against it */ if (con -> Security == 0) { SMB_Discon(con,0); return(NTV_PROTOCOL_ERROR); } if (SMB_Logon_Server(con, USERNAME, PASSWORD) < 0) { SMB_Discon(con,0); return(NTV_LOGON_ERROR); } SMB_Discon(con,0); return(NTV_NO_ERROR); } muddleftpd-1.3.13.1/modules/auth/authlibsmb/smbval/valid.h0100644000175000017500000000042407554515351022376 0ustar joergjoerg#ifndef _VALID_H_ #define _VALID_H_ /* SMB User verification function */ #define NTV_NO_ERROR 0 #define NTV_SERVER_ERROR 1 #define NTV_PROTOCOL_ERROR 2 #define NTV_LOGON_ERROR 3 int Valid_User(char *USERNAME,char *PASSWORD,char *SERVER, char *BACKUP, char *DOMAIN); #endif muddleftpd-1.3.13.1/modules/auth/authlibsmb/configure.ac0100644000175000017500000000076507554515351022140 0ustar joergjoergdnl Process this file with autoconf to produce a configure script. AC_INIT AC_PREREQ(2.54) AC_CONFIG_SRCDIR([authsmb.c]) AC_CONFIG_HEADER(config.h) dnl Checks for programs. AC_PROG_CC dnl Checks for libraries. dnl Checks for header files. AC_CHECK_HEADERS(unistd.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_STRUCT_TM dnl Checks for library functions. AC_HEADER_STDC dnl Check functions AC_CHECK_FUNCS(memmove) AC_CONFIG_FILES([Makefile smbval/Makefile]) AC_OUTPUT muddleftpd-1.3.13.1/modules/auth/authlibsmb/valid.h0100644000175000017500000000042507554515351021113 0ustar joergjoerg#ifndef _VALID_H_ #define _VALID_H_ /* SMB User verification function */ #define NTV_NO_ERROR 0 #define NTV_SERVER_ERROR 1 #define NTV_PROTOCOL_ERROR 2 #define NTV_LOGON_ERROR 3 int Valid_User(char *USERNAME,char *PASSWORD,char *SERVER, char *BACKUP, char *DOMAIN); #endif muddleftpd-1.3.13.1/modules/auth/authlibsmb/configure0100755000175000017500000035434207751444704021566 0ustar joergjoerg#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57. # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="authsmb.c" # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd "$ac_popdir" done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6 if test "${ac_cv_struct_tm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct tm *tp; tp->tm_sec; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_struct_tm=time.h else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_struct_tm=sys/time.h fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 echo "${ECHO_T}$ac_cv_struct_tm" >&6 if test $ac_cv_struct_tm = sys/time.h; then cat >>confdefs.h <<\_ACEOF #define TM_IN_SYS_TIME 1 _ACEOF fi echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi for ac_func in memmove do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done ac_config_files="$ac_config_files Makefile smbval/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by $as_me, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "smbval/Makefile" ) CONFIG_FILES="$CONFIG_FILES smbval/Makefile" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi muddleftpd-1.3.13.1/modules/auth/authlibsmb/config.h.in0100644000175000017500000000264207751444705021674 0ustar joergjoerg/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME muddleftpd-1.3.13.1/src/0040755000175000017500000000000007751444665013701 5ustar joergjoergmuddleftpd-1.3.13.1/src/util/0040755000175000017500000000000007751444665014656 5ustar joergjoergmuddleftpd-1.3.13.1/src/util/pwgrent.c0100644000175000017500000001046607545306425016504 0ustar joergjoerg/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ /* This code was borrowed from proftpd for muddleftpd :-P */ #include "../ftpd.h" #define NPWDFIELDS 7 #define NGRPFIELDS 4 #ifndef BUFSIZ #define BUFSIZ 1024 #endif /* provides fgetpwent()/fgetgrent() functions. Note that the * format of the files is probably NOT platform dependant, so * use of these functions will require a strict format * "username:password:uid:gid:gecos:home:default_shell" */ #ifndef HAVE_FGETPWENT static char pwdbuf[BUFSIZ]; static char *pwdfields[NPWDFIELDS]; static struct passwd pwent; static struct passwd *_pgetpwent(const char *buf) { register int i; register char *cp; char *ep; char **fields; char *buffer; struct passwd *pwd; fields = pwdfields; buffer = pwdbuf; pwd = &pwent; strncpy(buffer,buf,BUFSIZ-1); buffer[BUFSIZ-1] = '\0'; for(cp = buffer, i = 0; i < NPWDFIELDS && cp; i++) { fields[i] = cp; while(*cp && *cp != ':') ++cp; if(*cp) *cp++ = '\0'; else cp = 0; } if(i != NPWDFIELDS || *fields[2] == '\0' || *fields[3] == '\0') return 0; pwd->pw_name = fields[0]; pwd->pw_passwd = fields[1]; if(fields[2][0] == '\0' || ((pwd->pw_uid = strtol(fields[2], &ep, 10)) == 0 && *ep)) return 0; if(fields[3][0] == '\0' || ((pwd->pw_gid = strtol(fields[3], &ep, 10)) == 0 && *ep)) return 0; pwd->pw_gecos = fields[4]; pwd->pw_dir = fields[5]; pwd->pw_shell = fields[6]; return pwd; } struct passwd *fgetpwent(FILE *fp) { char buf[BUFSIZ]; if (fgets(buf,sizeof(buf),fp) != (char*)0) { buf[strlen(buf)-1] = '\0'; return _pgetpwent(buf); } return NULL; } #endif /* HAVE_FGETPWENT */ #ifndef HAVE_FGETGRENT #define MAXMEMBERS 4096 static char *grpbuf = NULL; static struct group grent; static char *grpfields[NGRPFIELDS]; static char *members[MAXMEMBERS+1]; static char *fgetbufline(char **buf, int *size, FILE *fp) { char *rbuf = NULL,*cp; if(!*size || !*buf) { *size = BUFSIZ; *buf = rbuf = malloc(*size); if(!rbuf) return 0; } cp = rbuf; while(fgets(cp,(*size) - (cp - rbuf), fp) != (char *)0) { if(strchr(cp,'\n')) return rbuf; *size += *size; *buf = realloc(rbuf,*size); if(!*buf) break; cp = *buf + (cp - rbuf); rbuf = *buf; cp = strchr(cp,'\0'); } free(rbuf); *buf = NULL; *size = 0; return 0; } static char **_grlist(char *s) { int nmembers = 0; while(s && *s && nmembers < MAXMEMBERS) { members[nmembers++] = s; while(*s && *s != ',') s++; if(*s) *s++ = '\0'; } members[nmembers] = (char*)0; return members; } static struct group * _pgetgrent(const char *buf) { int i; char *cp; i = strlen(buf); if(!grpbuf) grpbuf = malloc(i); else grpbuf = realloc(grpbuf,i); if(!grpbuf) return NULL; strncpy(grpbuf,buf,i); grpbuf[i-1] = '\0'; if((cp = strrchr(grpbuf,'\n'))) *cp = '\0'; for(cp = grpbuf, i = 0; i < NGRPFIELDS && cp; i++) { grpfields[i] = cp; if((cp = strchr(cp,':'))) *cp++ = 0; } if(i < (NGRPFIELDS-1) || *grpfields[2] == '\0') return 0; grent.gr_name = grpfields[0]; grent.gr_passwd = grpfields[1]; grent.gr_gid = atoi(grpfields[2]); grent.gr_mem = _grlist(grpfields[3]); return &grent; } struct group *fgetgrent(FILE *fp) { char *buf = NULL; int size = 0; char *cp; struct group *g; if(fgetbufline(&buf,&size,fp) != (char*)0) { if((cp = strchr(buf,'\n')) != (char*)0) *cp = '\0'; g = _pgetgrent(buf); free(buf); return g; } return 0; } #endif /* HAVE_FGETGRENT */ muddleftpd-1.3.13.1/src/util/seteguid.c0100644000175000017500000000216007545306425016617 0ustar joergjoerg/* Copyright (C) 2001 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "../../config.h" #ifndef HAVE_SETEUID #error huh /* seteuid replacement for systems without it, uses setresuid */ int seteuid(uid_t euid) { return setresuid((uid_t)-1, euid, (uid_t)-1); } #endif /* HAVE_SETEUID */ #ifndef HAVE_SETEGID /* setegid replacement for systems without it, uses setresgid */ int setegid(gid_t egid) { return setresgid((gid_t)-1, egid, (gid_t)-1); } #endif /* HAVE_SETEGID */ muddleftpd-1.3.13.1/src/util/snprintf.c0100644000175000017500000004746607545306425016673 0ustar joergjoerg/* snprintf.c snprintf implementation for computers without it */ /* Modified by Beau Kuiper for muddle.ftpd */ /* Changed December 16, 1999 to be compliant with latest C9X snprintf() specification: (from the comp.lang.c FAQ list, Q12.22) When the C9X snprintf() arrives, it will also be possible to use it to predict the size required for an arbitrary sprintf() call. C9X snprintf() will return the number of characters it would have placed in the buffer, not just how many it did place. Furthermore, it may be called with a buffer size of 0 and a null pointer as the destination buffer. Therefore, the call nch = snprintf(NULL, 0, fmtstring, ...); will compute the number of characters required for the fully- formatted string. References: C9X Sec. 7.13.6.6. */ /* * Copyright Patrick Powell 1995 * This code is based on code written by Patrick Powell (papowell@astart.com) * It may be used for any purpose as long as this notice remains intact * on all source code distributions */ /************************************************************** * Original: * Patrick Powell Tue Apr 11 09:48:21 PDT 1995 * A bombproof version of doprnt (dopr) included. * Sigh. This sort of thing is always nasty do deal with. Note that * the version here does not include floating point... * * snprintf() is used instead of sprintf() as it does limit checks * for string length. This covers a nasty loophole. * * The other functions are there to prevent NULL pointers from * causing nast effects. * * More Recently: * Brandon Long 9/15/96 for mutt 0.43 * This was ugly. It is still ugly. I opted out of floating point * numbers, but the formatter understands just about everything * from the normal C string format, at least as far as I can tell from * the Solaris 2.5 printf(3S) man page. * * Brandon Long 10/22/97 for mutt 0.87.1 * Ok, added some minimal floating point support, which means this * probably requires libm on most operating systems. Don't yet * support the exponent (e,E) and sigfig (g,G). Also, fmtint() * was pretty badly broken, it just wasn't being exercised in ways * which showed it, so that's been fixed. Also, formated the code * to mutt conventions, and removed dead code left over from the * original. Also, there is now a builtin-test, just compile with: * gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm * and run snprintf for results. * * Thomas Roessler 01/27/98 for mutt 0.89i * The PGP code was using unsigned hexadecimal formats. * Unfortunately, unsigned formats simply didn't work. * * Michael Elkins 03/05/98 for mutt 0.90.8 * The original code assumed that both snprintf() and vsnprintf() were * missing. Some systems only have snprintf() but not vsnprintf(), so * the code is now broken down under HAVE_SNPRINTF and HAVE_VSNPRINTF. * * Andrew Tridgell (tridge@samba.org) Oct 1998 * fixed handling of %.0f * added test for HAVE_LONG_DOUBLE * **************************************************************/ #include "../../config.h" #include # include #include #ifndef INT_MAX #define INT_MAX 0x7FFFFFFF #endif #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) /* Define this as a fall through, HAVE_STDARG_H is probably already set */ #define HAVE_VARARGS_H /* varargs declarations: */ #if defined(HAVE_STDARG_H) # include # define HAVE_STDARGS /* let's hope that works everywhere (mj) */ # define VA_LOCAL_DECL va_list ap # define VA_START(f) va_start(ap, f) # define VA_SHIFT(v,t) ; /* no-op for ANSI */ # define VA_END va_end(ap) #else # if defined(HAVE_VARARGS_H) # include # undef HAVE_STDARGS # define VA_LOCAL_DECL va_list ap # define VA_START(f) va_start(ap) /* f is ignored! */ # define VA_SHIFT(v,t) v = va_arg(ap,t) # define VA_END va_end(ap) # else /*XX ** NO VARARGS ** XX*/ # endif #endif #ifdef HAVE_LONG_DOUBLE #define LDOUBLE long double #else #define LDOUBLE double #endif /*int snprintf (char *str, size_t count, const char *fmt, ...);*/ /*int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);*/ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args); static void fmtstr (char *buffer, size_t *currlen, size_t maxlen, size_t *reallen, char *value, int flags, int min, int max); static void fmtint (char *buffer, size_t *currlen, size_t maxlen, size_t *reallen, long value, int base, int min, int max, int flags); static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, size_t *reallen, LDOUBLE fvalue, int min, int max, int flags); static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, size_t *reallen, char c ); /* * dopr(): poor man's version of doprintf */ /* format read states */ #define DP_S_DEFAULT 0 #define DP_S_FLAGS 1 #define DP_S_MIN 2 #define DP_S_DOT 3 #define DP_S_MAX 4 #define DP_S_MOD 5 #define DP_S_CONV 6 #define DP_S_DONE 7 /* format flags - Bits */ #define DP_F_MINUS (1 << 0) #define DP_F_PLUS (1 << 1) #define DP_F_SPACE (1 << 2) #define DP_F_NUM (1 << 3) #define DP_F_ZERO (1 << 4) #define DP_F_UP (1 << 5) #define DP_F_UNSIGNED (1 << 6) /* Conversion Flags */ #define DP_C_SHORT 1 #define DP_C_LONG 2 #define DP_C_LDOUBLE 3 #define char_to_int(p) (p - '0') #define MAX(p,q) ((p >= q) ? p : q) static int dopr (char *buffer, size_t maxlen, const char *format, va_list args) { char ch; long value; LDOUBLE fvalue; char *strvalue; int min; int max; int state; int flags; int cflags; size_t currlen; size_t reallen; state = DP_S_DEFAULT; currlen = reallen = flags = cflags = min = 0; max = -1; ch = *format++; while (state != DP_S_DONE) { if (ch == '\0') state = DP_S_DONE; switch(state) { case DP_S_DEFAULT: if (ch == '%') state = DP_S_FLAGS; else dopr_outch (buffer, &currlen, maxlen, &reallen, ch); ch = *format++; break; case DP_S_FLAGS: switch (ch) { case '-': flags |= DP_F_MINUS; ch = *format++; break; case '+': flags |= DP_F_PLUS; ch = *format++; break; case ' ': flags |= DP_F_SPACE; ch = *format++; break; case '#': flags |= DP_F_NUM; ch = *format++; break; case '0': flags |= DP_F_ZERO; ch = *format++; break; default: state = DP_S_MIN; break; } break; case DP_S_MIN: if (isdigit((unsigned char)ch)) { min = 10*min + char_to_int (ch); ch = *format++; } else if (ch == '*') { min = va_arg (args, int); ch = *format++; state = DP_S_DOT; } else state = DP_S_DOT; break; case DP_S_DOT: if (ch == '.') { state = DP_S_MAX; ch = *format++; } else state = DP_S_MOD; break; case DP_S_MAX: if (isdigit((unsigned char)ch)) { if (max < 0) max = 0; max = 10*max + char_to_int (ch); ch = *format++; } else if (ch == '*') { max = va_arg (args, int); ch = *format++; state = DP_S_MOD; } else state = DP_S_MOD; break; case DP_S_MOD: /* Currently, we don't support Long Long, bummer */ switch (ch) { case 'h': cflags = DP_C_SHORT; ch = *format++; break; case 'l': cflags = DP_C_LONG; ch = *format++; break; case 'L': cflags = DP_C_LDOUBLE; ch = *format++; break; default: break; } state = DP_S_CONV; break; case DP_S_CONV: switch (ch) { case 'd': case 'i': if (cflags == DP_C_SHORT) value = va_arg (args, short int); else if (cflags == DP_C_LONG) value = va_arg (args, long int); else value = va_arg (args, int); fmtint (buffer, &currlen, maxlen, &reallen, value, 10, min, max, flags); break; case 'o': flags |= DP_F_UNSIGNED; if (cflags == DP_C_SHORT) value = va_arg (args, unsigned short int); else if (cflags == DP_C_LONG) value = (long)va_arg (args, unsigned long int); else value = (long)va_arg (args, unsigned int); fmtint (buffer, &currlen, maxlen, &reallen, value, 8, min, max, flags); break; case 'u': flags |= DP_F_UNSIGNED; if (cflags == DP_C_SHORT) value = va_arg (args, unsigned short int); else if (cflags == DP_C_LONG) value = (long)va_arg (args, unsigned long int); else value = (long)va_arg (args, unsigned int); fmtint (buffer, &currlen, maxlen, &reallen, value, 10, min, max, flags); break; case 'X': flags |= DP_F_UP; case 'x': flags |= DP_F_UNSIGNED; if (cflags == DP_C_SHORT) value = va_arg (args, unsigned short int); else if (cflags == DP_C_LONG) value = (long)va_arg (args, unsigned long int); else value = (long)va_arg (args, unsigned int); fmtint (buffer, &currlen, maxlen, &reallen, value, 16, min, max, flags); break; case 'f': if (cflags == DP_C_LDOUBLE) fvalue = va_arg (args, LDOUBLE); else fvalue = va_arg (args, double); /* um, floating point? */ fmtfp (buffer, &currlen, maxlen, &reallen, fvalue, min, max, flags); break; case 'E': flags |= DP_F_UP; case 'e': if (cflags == DP_C_LDOUBLE) fvalue = va_arg (args, LDOUBLE); else fvalue = va_arg (args, double); break; case 'G': flags |= DP_F_UP; case 'g': if (cflags == DP_C_LDOUBLE) fvalue = va_arg (args, LDOUBLE); else fvalue = va_arg (args, double); break; case 'c': dopr_outch (buffer, &currlen, maxlen, &reallen, va_arg (args, int)); break; case 's': strvalue = va_arg (args, char *); if (max < 0) max = INT_MAX; /* ie, no max */ fmtstr (buffer, &currlen, maxlen, &reallen, strvalue, flags, min, max); break; case 'p': strvalue = va_arg (args, void *); fmtint (buffer, &currlen, maxlen, &reallen, (long) strvalue, 16, min, max, flags); break; case 'n': if (cflags == DP_C_SHORT) { short int *num; num = va_arg (args, short int *); *num = currlen; } else if (cflags == DP_C_LONG) { long int *num; num = va_arg (args, long int *); *num = (long int)currlen; } else { int *num; num = va_arg (args, int *); *num = currlen; } break; case '%': dopr_outch (buffer, &currlen, maxlen, &reallen, ch); break; case 'w': /* not supported yet, treat as next char */ ch = *format++; break; default: /* Unknown, skip */ break; } ch = *format++; state = DP_S_DEFAULT; flags = cflags = min = 0; max = -1; break; case DP_S_DONE: break; default: /* hmm? */ break; /* some picky compilers need this */ } } if (buffer != NULL && maxlen > 0) { if (currlen < maxlen) buffer[currlen] = '\0'; else buffer[maxlen - 1] = '\0'; } return reallen; } static void fmtstr (char *buffer, size_t *currlen, size_t maxlen, size_t *reallen, char *value, int flags, int min, int max) { int padlen, strln; /* amount to pad */ int cnt = 0; if (value == 0) { value = ""; } for (strln = 0; value[strln]; ++strln); /* strlen */ padlen = min - strln; if (padlen < 0) padlen = 0; if (flags & DP_F_MINUS) padlen = -padlen; /* Left Justify */ while ((padlen > 0) && (cnt < max)) { dopr_outch (buffer, currlen, maxlen, reallen, ' '); --padlen; ++cnt; } while (*value && (cnt < max)) { dopr_outch (buffer, currlen, maxlen, reallen, *value++); ++cnt; } while ((padlen < 0) && (cnt < max)) { dopr_outch (buffer, currlen, maxlen, reallen, ' '); ++padlen; ++cnt; } } /* Have to handle DP_F_NUM (ie 0x and 0 alternates) */ static void fmtint (char *buffer, size_t *currlen, size_t maxlen, size_t *reallen, long value, int base, int min, int max, int flags) { int signvalue = 0; unsigned long uvalue; char convert[20]; int place = 0; int spadlen = 0; /* amount to space pad */ int zpadlen = 0; /* amount to zero pad */ int caps = 0; if (max < 0) max = 0; uvalue = value; if(!(flags & DP_F_UNSIGNED)) { if( value < 0 ) { signvalue = '-'; uvalue = -value; } else if (flags & DP_F_PLUS) /* Do a sign (+/i) */ signvalue = '+'; else if (flags & DP_F_SPACE) signvalue = ' '; } if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */ do { convert[place++] = (caps? "0123456789ABCDEF":"0123456789abcdef") [uvalue % (unsigned)base ]; uvalue = (uvalue / (unsigned)base ); } while(uvalue && (place < 20)); if (place == 20) place--; convert[place] = 0; zpadlen = max - place; spadlen = min - MAX (max, place) - (signvalue ? 1 : 0); if (zpadlen < 0) zpadlen = 0; if (spadlen < 0) spadlen = 0; if (flags & DP_F_ZERO) { zpadlen = MAX(zpadlen, spadlen); spadlen = 0; } if (flags & DP_F_MINUS) spadlen = -spadlen; /* Left Justifty */ #ifdef DEBUG_SNPRINTF printf("zpad: %d, spad: %d, min: %d, max: %d, place: %d\n", zpadlen, spadlen, min, max, place); #endif /* Spaces */ while (spadlen > 0) { dopr_outch (buffer, currlen, maxlen, reallen, ' '); --spadlen; } /* Sign */ if (signvalue) dopr_outch (buffer, currlen, maxlen, reallen, signvalue); /* Zeros */ if (zpadlen > 0) { while (zpadlen > 0) { dopr_outch (buffer, currlen, maxlen, reallen, '0'); --zpadlen; } } /* Digits */ while (place > 0) dopr_outch (buffer, currlen, maxlen, reallen, convert[--place]); /* Left Justified spaces */ while (spadlen < 0) { dopr_outch (buffer, currlen, maxlen, reallen, ' '); ++spadlen; } } static LDOUBLE abs_val (LDOUBLE value) { LDOUBLE result = value; if (value < 0) result = -value; return result; } static LDOUBLE pow10 (int exp) { LDOUBLE result = 1; while (exp) { result *= 10; exp--; } return result; } static long round (LDOUBLE value) { long intpart; intpart = (long)value; value = value - intpart; if (value >= 0.5) intpart++; return intpart; } static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, size_t *reallen, LDOUBLE fvalue, int min, int max, int flags) { int signvalue = 0; LDOUBLE ufvalue; char iconvert[20]; char fconvert[20]; int iplace = 0; int fplace = 0; int padlen = 0; /* amount to pad */ int zpadlen = 0; int caps = 0; long intpart; long fracpart; /* * AIX manpage says the default is 0, but Solaris says the default * is 6, and sprintf on AIX defaults to 6 */ if (max < 0) max = 6; ufvalue = abs_val (fvalue); if (fvalue < 0) signvalue = '-'; else if (flags & DP_F_PLUS) /* Do a sign (+/i) */ signvalue = '+'; else if (flags & DP_F_SPACE) signvalue = ' '; #if 0 if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */ #endif intpart = (long)ufvalue; /* * Sorry, we only support 9 digits past the decimal because of our * conversion method */ if (max > 9) max = 9; /* We "cheat" by converting the fractional part to integer by * multiplying by a factor of 10 */ fracpart = round ((pow10 (max)) * (ufvalue - intpart)); if (fracpart >= pow10 (max)) { intpart++; fracpart -= pow10 (max); } #ifdef DEBUG_SNPRINTF printf("fmtfp: %g %d.%d min=%d max=%d\n", (double)fvalue, intpart, fracpart, min, max); #endif /* Convert integer part */ do { iconvert[iplace++] = (caps? "0123456789ABCDEF":"0123456789abcdef")[intpart % 10]; intpart = (intpart / 10); } while(intpart && (iplace < 20)); if (iplace == 20) iplace--; iconvert[iplace] = 0; /* Convert fractional part */ do { fconvert[fplace++] = (caps? "0123456789ABCDEF":"0123456789abcdef")[fracpart % 10]; fracpart = (fracpart / 10); } while(fracpart && (fplace < 20)); if (fplace == 20) fplace--; fconvert[fplace] = 0; /* -1 for decimal point, another -1 if we are printing a sign */ padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0); zpadlen = max - fplace; if (zpadlen < 0) zpadlen = 0; if (padlen < 0) padlen = 0; if (flags & DP_F_MINUS) padlen = -padlen; /* Left Justifty */ if ((flags & DP_F_ZERO) && (padlen > 0)) { if (signvalue) { dopr_outch (buffer, currlen, maxlen, reallen, signvalue); --padlen; signvalue = 0; } while (padlen > 0) { dopr_outch (buffer, currlen, maxlen, reallen, '0'); --padlen; } } while (padlen > 0) { dopr_outch (buffer, currlen, maxlen, reallen, ' '); --padlen; } if (signvalue) dopr_outch (buffer, currlen, maxlen, reallen, signvalue); while (iplace > 0) dopr_outch (buffer, currlen, maxlen, reallen, iconvert[--iplace]); #ifdef DEBUG_SNPRINTF printf("fmtfp: fplace=%d zpadlen=%d\n", fplace, zpadlen); #endif /* * Decimal point. This should probably use locale to find the correct * char to print out. */ if (max > 0) { dopr_outch (buffer, currlen, maxlen, reallen, '.'); while (fplace > 0) dopr_outch (buffer, currlen, maxlen, reallen, fconvert[--fplace]); } while (zpadlen > 0) { dopr_outch (buffer, currlen, maxlen, reallen, '0'); --zpadlen; } while (padlen < 0) { dopr_outch (buffer, currlen, maxlen, reallen, ' '); ++padlen; } } static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, size_t *reallen, char c) { if (buffer != NULL && maxlen > 0 && *currlen < maxlen) buffer[(*currlen)++] = c; (*reallen)++; } #endif /* !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) */ #ifndef HAVE_VSNPRINTF int vsnprintf (char *str, size_t count, const char *fmt, va_list args) { if (str != NULL) str[0] = 0; return dopr(str, count, fmt, args); } #endif /* !HAVE_VSNPRINTF */ #ifndef HAVE_SNPRINTF /* VARARGS3 */ #ifdef HAVE_STDARGS int snprintf (char *str,size_t count,const char *fmt,...) #else int snprintf (va_alist) va_dcl #endif { #ifndef HAVE_STDARGS char *str; size_t count; char *fmt; #endif VA_LOCAL_DECL; int result; VA_START (fmt); VA_SHIFT (str, char *); VA_SHIFT (count, size_t ); VA_SHIFT (fmt, char *); result = vsnprintf(str, count, fmt, ap); VA_END; return result; } #else /* keep compilers happy about empty files */ void dummy_snprintf(void) {} #endif /* !HAVE_SNPRINTF */ #ifdef TEST_SNPRINTF #ifndef LONG_STRING #define LONG_STRING 1024 #endif int main (void) { char buf1[LONG_STRING]; char buf2[LONG_STRING]; char *fp_fmt[] = { "%-1.5f", "%1.5f", "%123.9f", "%10.5f", "% 10.5f", "%+22.9f", "%+4.9f", "%01.3f", "%4f", "%3.1f", "%3.2f", "%.0f", "%.1f", NULL }; double fp_nums[] = { -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996, 0.9996, 1.996, 4.136, 0}; char *int_fmt[] = { "%-1.5d", "%1.5d", "%123.9d", "%5.5d", "%10.5d", "% 10.5d", "%+22.33d", "%01.3d", "%4d", NULL }; long int_nums[] = { -1, 134, 91340, 341, 0203, 0}; int x, y; int fail = 0; int num = 0; printf ("Testing snprintf format codes against system sprintf...\n"); for (x = 0; fp_fmt[x] != NULL ; x++) for (y = 0; fp_nums[y] != 0 ; y++) { snprintf (buf1, sizeof (buf1), fp_fmt[x], fp_nums[y]); sprintf (buf2, fp_fmt[x], fp_nums[y]); if (strcmp (buf1, buf2)) { printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", fp_fmt[x], buf1, buf2); fail++; } num++; } for (x = 0; int_fmt[x] != NULL ; x++) for (y = 0; int_nums[y] != 0 ; y++) { snprintf (buf1, sizeof (buf1), int_fmt[x], int_nums[y]); sprintf (buf2, int_fmt[x], int_nums[y]); if (strcmp (buf1, buf2)) { printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", int_fmt[x], buf1, buf2); fail++; } num++; } printf ("%d tests failed out of %d.\n", fail, num); } #endif /* SNPRINTF_TEST */ muddleftpd-1.3.13.1/src/util/strerror.c0100644000175000017500000001347407545306425016702 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "../../config.h" #ifndef HAVE_STRERROR #include "strerror.h" /* this was generated using vi on a linux system. May not work on yours */ char *strerror(int errnum) { switch (errnum) { case EPERM : { return("Operation not permitted"); }; case ENOENT : { return("No such file or directory"); }; case ESRCH : { return("No such process"); }; case EINTR : { return("Interrupted system call"); }; case EIO : { return("I/O error"); }; case ENXIO : { return("No such device or address"); }; case E2BIG : { return("Arg list too long"); }; case ENOEXEC : { return("Exec format error"); }; case EBADF : { return("Bad file number"); }; case ECHILD : { return("No child processes"); }; case EAGAIN : { return("Try again"); }; case ENOMEM : { return("Out of memory"); }; case EACCES : { return("Permission denied"); }; case EFAULT : { return("Bad address"); }; case ENOTBLK : { return("Block device required"); }; case EBUSY : { return("Device or resource busy"); }; case EEXIST : { return("File exists"); }; case EXDEV : { return("Cross-device link"); }; case ENODEV : { return("No such device"); }; case ENOTDIR : { return("Not a directory"); }; case EISDIR : { return("Is a directory"); }; case EINVAL : { return("Invalid argument"); }; case ENFILE : { return("File table overflow"); }; case EMFILE : { return("Too many open files"); }; case ENOTTY : { return("Not a typewriter"); }; case ETXTBSY : { return("Text file busy"); }; case EFBIG : { return("File too large"); }; case ENOSPC : { return("No space left on device"); }; case ESPIPE : { return("Illegal seek"); }; case EROFS : { return("Read-only file system"); }; case EMLINK : { return("Too many links"); }; case EPIPE : { return("Broken pipe"); }; case EDOM : { return("Math argument out of domain of func"); }; case ERANGE : { return("Math result not representable"); }; case EDEADLK : { return("Resource deadlock would occur"); }; case ENAMETOOLONG : { return("File name too long"); }; case ENOLCK : { return("No record locks available"); }; case ENOSYS : { return("Function not implemented"); }; case ENOTEMPTY : { return("Directory not empty"); }; case ELOOP : { return("Too many symbolic links encountered"); }; case ENOMSG : { return("No message of desired type"); }; case EIDRM : { return("Identifier removed"); }; case ENOSTR : { return("Device not a stream"); }; case ETIME : { return("Timer expired"); }; case ENOSR : { return("Out of streams resources"); }; case ENONET : { return("Machine is not on the network"); }; case EREMOTE : { return("Object is remote"); }; case ENOLINK : { return("Link has been severed"); }; case EADV : { return("Advertise error"); }; case ESRMNT : { return("Srmount error"); }; case ECOMM : { return("Communication error on send"); }; case EPROTO : { return("Protocol error"); }; case EMULTIHOP : { return("Multihop attempted"); }; case EDOTDOT : { return("RFS specific error"); }; case EBADMSG : { return("Not a data message"); }; case EREMCHG : { return("Remote address changed"); }; case EUSERS : { return("Too many users"); }; case ENOTSOCK : { return("Socket operation on non-socket"); }; case EDESTADDRREQ : { return("Destination address required"); }; case EMSGSIZE : { return("Message too long"); }; case EPROTOTYPE : { return("Protocol wrong type for socket"); }; case ENOPROTOOPT : { return("Protocol not available"); }; case EPROTONOSUPPORT : { return("Protocol not supported"); }; case ESOCKTNOSUPPORT : { return("Socket type not supported"); }; case EOPNOTSUPP : { return("Operation not supported on transport endpoint"); }; case EPFNOSUPPORT : { return("Protocol family not supported"); }; case EAFNOSUPPORT : { return("Address family not supported by protocol"); }; case EADDRINUSE : { return("Address already in use"); }; case EADDRNOTAVAIL : { return("Cannot assign requested address"); }; case ENETDOWN : { return("Network is down"); }; case ENETUNREACH : { return("Network is unreachable"); }; case ENETRESET : { return("Network dropped connection because of reset"); }; case ECONNABORTED : { return("Software caused connection abort"); }; case ECONNRESET : { return("Connection reset by peer"); }; case ENOBUFS : { return("No buffer space available"); }; case EISCONN : { return("Transport endpoint is already connected"); }; case ENOTCONN : { return("Transport endpoint is not connected"); }; case ESHUTDOWN : { return("Cannot send after transport endpoint shutdown"); }; case ETOOMANYREFS : { return("Too many references: cannot splice"); }; case ETIMEDOUT : { return("Connection timed out"); }; case ECONNREFUSED : { return("Connection refused"); }; case EHOSTDOWN : { return("Host is down"); }; case EHOSTUNREACH : { return("No route to host"); }; case EALREADY : { return("Operation already in progress"); }; case EINPROGRESS : { return("Operation now in progress"); }; case ESTALE : { return("Stale NFS file handle"); }; case EDQUOT : { return("Quota exceeded"); }; default : { return("Unknown Error"); }; } } #endif /* HAVE_STRERROR */ muddleftpd-1.3.13.1/src/util/strerror.h0100644000175000017500000000152107545306425016675 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef STRERROR_H #define STRERROR_H #include #ifndef HAVE_STRERROR extern char *strerror(int errnum); #endif #endif muddleftpd-1.3.13.1/src/Makefile.in0100644000175000017500000000656307751231357015745 0ustar joergjoerg # Copyright (C) 1999 Beau Kuiper # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ # **** TRY TO LEAVE EVERYTHING BELOW HERE ALONE! include ../Makefile.defs prefix=@prefix@ exec_prefix=@exec_prefix@ # where the binary is stored BINDIR=@bindir@ SRC = acl.c auth.c authanon.c authdisable.c authint.c authpam.c authunix.c \ bufread.c cfloader.c checkip.c cmd.c config.c datasock.c dir.c file.c \ ftp.c ftplist.c ftpout.c ftpsite.c ftpstat.c ftpstate.c ftptrans.c \ init.c logger.c main.c myglob.c newfile.c procnum.c proxy.c ratio.c \ select.c shmem.c socket.c string.c utils.c version.c \ util/pwgrent.c util/snprintf.c util/strerror.c WHOSRC = ftpwho.c util/strerror.c utils.c string.c config.c newfile.c \ version.c util/snprintf.c util/pwgrent.c MUDPASSWDSRC = mudpasswd.c util/strerror.c version.c util/snprintf.c RATIOTOOLSRC = ratiotool.c util/strerror.c version.c utils.c util/snprintf.c \ util/pwgrent.c MUDLOGDSRC = mudlogd.c util/strerror.c util/snprintf.c config.c utils.c \ newfile.c version.c string.c ifdef NEWMALLOC SRC += malloc.c WHOSRC += malloc.c MUDPASSWDSRC += malloc.c RATIOTOOLSRC += malloc.c endif # Build a debug version (NOT RECOMMENDED FOR REAL USE) #DEBUG = 1 # these flags are needed regardless of if DEBUG is used CC=@CC@ DEFS=@DEFS@ -D$(shell uname) LIBS=@LIBS@ CFLAGSSHD:=$(DEFS) @CFLAGS@ # Set for debugging mode ifdef DEBUG CFLAGS=$(DEFS) -g -Wall -Wshadow -Wpointer-arith -Waggregate-return -Wstrict-prototypes -DDEBUG #-Werror # else set for optimising output code else CFLAGS=$(CFLAGSSHD) endif OBJ = $(SRC:.c=.o) WHOOBJ = $(WHOSRC:.c=.o) MUDPASSWDOBJ = $(MUDPASSWDSRC:.c=.o) RATIOTOOLOBJ = $(RATIOTOOLSRC:.c=.o) MUDLOGDOBJ = $(MUDLOGDSRC:.c=.o) TARGETS = $(MUDOUTPROG) $(WHOPROG) $(MUDPASSWDPROG) $(RATIOTOOLPROG) \ $(MUDLOGD) all: $(TARGETS) # always force rebuilding of version.c, so it always has the current # date .PHONY : version.o version.o: $(CC) $(CFLAGS) -DDATESTR="\"$(shell date)\"" -c $(@:.o=.c) -o $@ $(WHOPROG): $(WHOOBJ) $(CC) $(CFLAGS) $(LIBS) -o $(WHOPROG) $(WHOOBJ) $(MUDPASSWDPROG): $(MUDPASSWDOBJ) $(CC) $(CFLAGS) $(LIBS) -o $(MUDPASSWDPROG) $(MUDPASSWDOBJ) $(RATIOTOOLPROG): $(RATIOTOOLOBJ) $(CC) $(CFLAGS) $(LIBS) -o $(RATIOTOOLPROG) $(RATIOTOOLOBJ) $(MUDOUTPROG): $(OBJ) $(CC) $(CFLAGS) $(LIBS) -o $(MUDOUTPROG) $(OBJ) $(MUDLOGD): $(MUDLOGDOBJ) $(CC) $(CFLAGS) $(LIBS) -o $(MUDLOGD) $(MUDLOGDOBJ) install: all mkdir -p $(BINDIR) install $(MUDOUTPROG) -m 755 $(BINDIR) install $(WHOPROG) -m 755 $(BINDIR) install $(MUDPASSWDPROG) -m 755 $(BINDIR) install $(MUDLOGD) -m 755 $(BINDIR) clean: rm -f $(MUDOUTPROG) $(WHOPROG) *.o *~ core DEADJOE util/*.o rm -f $(MUDPASSWDPROG) $(RATIOTOOLPROG) $(MUDLOGD) distclean: clean rm -f Makefile maintainer-clean: distclean muddleftpd-1.3.13.1/src/acl.c0100644000175000017500000001144307737077255014605 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" ACLLIST *acllist_create(void) { ACLLIST *newlist = mallocwrapper(sizeof(ACLLIST)); newlist->aclcount = 0; newlist->acls = NULL; return(newlist); } int getaclattr(char *instr) { int result = 0; if (strcasecmp(instr, "ALL") == 0) return(ACL_ADD | ACL_READ | ACL_LIST | ACL_DELETE | ACL_MKDIR | ACL_RMDIR | ACL_WRITE | ACL_CHMOD | ACL_CHDIR | ACL_REPLACE ); else if (strcasecmp(instr, "NONE") == 0) return(0); while(*instr != 0) { /* make sure character is upper case! */ char aclchar = *instr & (255 - 32); switch (aclchar) { case 'A': { result |= ACL_ADD ; break ; } case 'R': { result |= ACL_READ ; break ; } case 'L': { result |= ACL_LIST ; break ; } case 'X': { result |= ACL_REPLACE ; break ; } case 'D': { result |= ACL_DELETE ; break ; } case 'M': { result |= ACL_MKDIR ; break ; } case 'I': { result |= ACL_RMDIR ; break ; } case 'W': { result |= ACL_WRITE ; break ; } case 'H': { result |= ACL_CHMOD ; break ; } case 'C': { result |= ACL_CHDIR ; break ; } default : { log_giveentry(MYLOG_INFO, 0, safe_snprintf("Unknown ACL char %c", aclchar)); } } instr++; } return(result); } /* this assumes ret is at least 10 chars long */ char *acllist_makepermstr(ACLLIST *acl, int cnt, char *ret) { char refchars[10] = { "RALXDMIWHC" }; int count, xcount = 1; strcpy(ret, ""); for (count = 0; count < strlen(refchars); count++) { if (acl->acls[cnt].attr & xcount) strncat(ret, refchars + count, 1); xcount *= 2; } return(ret); } void acllist_add(ACLLIST *acl, char *dir, char *attribs, int is_regexp) { int count; int attr = getaclattr(attribs); /* see if this directory already has an ACL. If it does, combine the ACL attributes if allowed to */ debuglog("adding acl: %s %s", dir, attribs); for (count = 0; count < acl->aclcount; count++) { if (strcmp(acl->acls[count].dir, dir) == 0) { if (!(acl->acls[count].attr & ACL_REPLACE)) acl->acls[count].attr |= attr; return; } } /* if there isn't an ACL yet for this directory, create it here */ reallocwrapper(sizeof(ACL) * (acl->aclcount+1), (void **)&(acl->acls)); acl->acls[acl->aclcount].dir = strdupwrapper(dir); acl->acls[acl->aclcount].regexp = is_regexp; acl->acls[acl->aclcount].attr = attr; acl->aclcount++; } /* void acllist_tokendo(ACLLIST *acl, TOKENSET *tset) { int count; for (count = 0; count < acl->aclcount; count++) acl->acls[count].dir = tokenset_apply(tset, acl->acls[count].dir); } */ int acllist_check(ACLLIST *acl, char *dir, int attr) { int result = 0; char *mydir = strdupwrapper(dir); int len = strlen(dir); int count; debuglog("inacl : %s", dir); /* go through the list and find and test any regexp acls */ for (count = 0; count < acl->aclcount; count++) { if ( acl->acls[count].regexp ) { debuglog( "regexp acl %s, %s\n", mydir, acl->acls[count].dir); if (my_fnmatch( acl->acls[count].dir, mydir, acl->acls[count].regexp == 2 ? FNM_PATHNAME : 0 ) == 0) { result = acl->acls[count].attr; goto gotmatch; } } } /* now do regular dir matches */ while( mydir[0] != 0 ) { char *tmp; debuglog("acl breakdown : %s", mydir); for (count = 0; count < acl->aclcount; count++) { debuglog( "%s, %s\n", mydir, acl->acls[count].dir); if (strcmp( mydir, acl->acls[count].dir ) == 0) { result = acl->acls[count].attr; goto gotmatch; } } if (mydir[len - 1] == '/') len--; mydir[len] = 0; tmp = strrchr(mydir, '/'); if (tmp != NULL) { tmp++; *tmp = 0; len = tmp - mydir; } } result = 0; gotmatch: freewrapper(mydir); if ((result & attr) == attr) return(TRUE); return(FALSE); } void acllist_dest(ACLLIST *acl) { int count; if (acl->aclcount > 0) { for (count = 0; count < acl->aclcount; count++) freewrapper(acl->acls[count].dir); freewrapper(acl->acls); } freewrapper(acl); } int check_acl(FTPSTATE *peer, char *path, int perm) { int ok; ok = acllist_check(peer->acldata, dir_getvirtual(peer, path), perm); errno = 0; if (ok) return(0); else errno = EACCES; return(-1); } muddleftpd-1.3.13.1/src/acl.h0100644000175000017500000000060607737077255014611 0ustar joergjoerg #ifndef ACL_H #define ACL_H #define ACL_READ 1 #define ACL_ADD 2 #define ACL_LIST 4 #define ACL_REPLACE 8 #define ACL_DELETE 16 #define ACL_MKDIR 32 #define ACL_RMDIR 64 #define ACL_WRITE 128 #define ACL_CHMOD 256 #define ACL_CHDIR 512 typedef struct { char *dir; int regexp; int attr; } ACL; typedef struct { ACL *acls; int aclcount; } ACLLIST; #endif /* ACL_H */ muddleftpd-1.3.13.1/src/auth.c0100644000175000017500000004001207737077255015001 0ustar joergjoerg/* auth.c Handle user authentication and setup of user options Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" #include "auth.h" extern FTPCMD mainftpcmd[]; extern FTPCMD siteftpcmd[]; PERMINFO authtypes[] = { { "unix", &unixauth_commands }, { "anonymous", &anonauth_commands }, { "internal", &internalauth_commands }, { "disabled", &disableauth_commands }, #ifdef HAVE_PAM_START { "pam", &pamauth_commands }, #endif { NULL, NULL }, }; /* this converts a config file string to discribe a multiline response to a real string. This does not need a new string to copy it to */ void converttorealstr(char *strbuf) { char *pos1, *pos2; pos1 = pos2 = strbuf; while(*pos1 != 0) { if (*pos1 == '/') { pos1++; switch(*pos1) { case 'n': *pos2 = '\n'; pos2++; break; case 's': *pos2 = ' '; pos2++; break; case 't': *pos2 = '\t'; pos2++; break; case '/': *pos2 = '/'; pos2++; break; default: *pos2 = '/'; pos2++; pos1--; break; } } else { *pos2 = *pos1; pos2++; } pos1++; } *pos2 = 0; } /* check an encrypted password against a plain text password */ int chkpassword(char *encrypass, char *password) { char *pass2; int result = FALSE; pass2 = crypt(password, encrypass); if (strcmp(pass2, encrypass) == 0) result = TRUE; /* destroy the passwords so it cannot be seen if muddleftpd crashes! */ memset(password, 0, strlen(password)); memset(pass2, 0, strlen(pass2)); return(result); } /* Make sure the user isn't trying to exploit the nature of the ftp server */ int checkexploits(FTPSTATE *peer) { int count; int namelen = strlen(peer->username); if (strlen(peer->username) > MAXNAMELEN) return(TRUE); for(count = 0; count < namelen; count++) { switch ((peer->username)[count]) { case '?': case '*': case '/': case '[': case ']': case '\\': case '!': case ':': case '^': return(TRUE); } } return(FALSE); } int authlogmsg(char *directive, char *groupname) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("directive %s is not correct in group %s", directive, groupname)); return(FALSE); } int checkabsdir(char *dir) { if (dir == NULL) return(TRUE); return(dir[0] == '/'); } void clearauth(FTPSTATE *peer) { freeifnotnull(peer->pwd); peer->pwd = NULL; freeifnotnull(peer->homedir); freeifnotnull(peer->basedir); if (peer->passiveport) select_delfd(peer->sel, peer->passiveport); peer->passiveport = 0; freeifnotnull(peer->renameoldname); peer->renameoldname = NULL; peer->restartpos = 0; peer->binary = TRUE; peer->remoteport = peer->connport - 1; freeifnotnull(peer->logindump); freeifnotnull(peer->cwddump); freeifnotnull(peer->busydump); freeifnotnull(peer->quitdump); freeifnotnull(peer->logindumpdata); freeifnotnull(peer->cwddumpdata); freeifnotnull(peer->busydumpdata); freeifnotnull(peer->quitdumpdata); freeifnotnull(peer->cmddisableset); freeifnotnull(peer->sitedisableset); peer->sitedisableset = disableset_create(); peer->cmddisableset = disableset_create(); peer->umask = peer->vserver->umask; if (peer->acldata) acllist_dest(peer->acldata); peer->gidt_asgid = config->gidt_nobodygid; peer->uidt_asuid = config->uidt_nobodyuid; peer->maxusers = peer->vserver->maxusers; peer->maxtimeout = peer->vserver->timeout; peer->timeout = peer->vserver->timeout; peer->chmodable = FALSE; peer->jailenabled = FALSE; peer->droproot = FALSE; peer->fakemode = -1; peer->accessdevices = FALSE; peer->fxpallow = FALSE; peer->maxtranspd = 0; freeifnotnull(peer->fakename); freeifnotnull(peer->fakegroup); if (peer->ratioinfo) ratio_finish(peer->ratioinfo); freeifnotnull(peer->supgids); } char *mkconfrealstr(int sectionid, char *item, char *defaul) { char *setting; loadstrfromconfig(config->configfile, sectionid, item, &(setting), defaul); if (setting == NULL) return(NULL); setting = strdupwrapper(setting); converttorealstr(setting); return(setting); return(setting); } char *mktokconfstr(TOKENSET *tset, int sectionid, char *item, char *defaul) { char *setting; loadstrfromconfig(config->configfile, sectionid, item, &(setting), defaul); if (setting == NULL) return(NULL); setting = strdupwrapper(setting); setting = tokenset_apply(tset, setting, FALSE); return(setting); } int mktokconfint(TOKENSET *tset, int sectionid, char *item, char *format, char *defaultstr, int defaultint) { char *setting; int ret; loadstrfromconfig(config->configfile, sectionid, item, &(setting), defaultstr); if (setting == NULL) return(defaultint); setting = strdupwrapper(setting); setting = tokenset_apply(tset, setting, FALSE); if (sscanf(setting, format, &ret) != 1) ret = defaultint; freewrapper(setting); return(ret); } void buildtokset(TOKENSET *tset, PERMSTRUCT *s, void *a) { gid_t *list; uid_t inuid; gid_t ingid; int result; char *str; if (s->getuseruid) { inuid = s->getuseruid(a); result = (int)inuid; str = safe_snprintf("%d", result); tokenset_settoken(tset, 'u', str); } if (s->getusergid) { ingid = s->getusergid(a); result = (int)ingid; str = safe_snprintf("%d", result); tokenset_settoken(tset, 'g', str); } if (s->gethomedir) tokenset_settoken(tset, 'h', strdupwrapper(s->gethomedir(a))); if (s->getrootdir) tokenset_settoken(tset, 'r', strdupwrapper(s->getrootdir(a))); if (s->getusersupgid) { list = s->getusersupgid(a); tokenset_settoken(tset, 'G', makegidliststr(list)); freewrapper(list); } } void setupacls(FTPSTATE *peer, TOKENSET *tset, int section, char *funcname, int aclfunc) { char *data; int occur = 1; int escapetoks = (aclfunc != 0); while((data = getconfigdata(config->configfile, section, funcname, occur))) { char *pos; data = tokenset_apply(tset, strdupwrapper(data), escapetoks); if ((pos = strrchr(data, ':')) != NULL) { /* this will temporaryly damage config data. But I fix it afterwards :) */ *pos = 0; acllist_add(peer->acldata, data, pos + 1, aclfunc); } freewrapper(data); occur++; } } int transferconfig(FTPSTATE *peer, TOKENSET *tset, int section) { int occur, result = TRUE; char *data; int intdata; peer->timeout = mktokconfint(tset, section, "timeout", "%d", NULL, peer->vserver->timeout); peer->maxtimeout = peer->timeout; /* get uid setting */ loadstrfromconfig(config->configfile, section, "uid", &(data), "%u"); data = strdupwrapper(data); data = tokenset_apply(tset, data, FALSE); if (sscanf(data, "%d", &intdata) != 1) { /* try for username then */ struct passwd *pwdent; pwdent = getpwnam(data); if (pwdent) peer->uidt_asuid = pwdent->pw_uid; else peer->uidt_asuid = config->uidt_nobodyuid; } else { peer->uidt_asuid = (uid_t)intdata; } freewrapper(data); /* get gid setting */ loadstrfromconfig(config->configfile, section, "gid", &(data), "%g"); data = strdupwrapper(data); data = tokenset_apply(tset, data, FALSE); if (sscanf(data, "%d", &intdata) != 1) { /* if it starts with a "!" mark, get gid of username */ if (data[0] == '!') { struct passwd *pwdent; pwdent = getpwnam(data+1); if (pwdent) peer->gidt_asgid = pwdent->pw_gid; else peer->gidt_asgid = config->gidt_nobodygid; } else { /* try for groupname then */ struct group *grent; grent = getgrnam(data); if (grent) peer->gidt_asgid = grent->gr_gid; else peer->gidt_asgid = config->gidt_nobodygid; } } else { peer->gidt_asgid = (gid_t)intdata; } freewrapper(data); if ((int)peer->uidt_asuid == 0) peer->uidt_asuid = config->uidt_nobodyuid; if ((int)peer->gidt_asgid == 0) peer->gidt_asgid = config->gidt_nobodygid; peer->homedir = mktokconfstr(tset, section, "homedir", "%h"); if (!checkabsdir(peer->homedir)) result = authlogmsg("homedir", peer->groupname); peer->basedir = mktokconfstr(tset, section, "rootdir", "%r"); if (!checkabsdir(peer->basedir)) result = authlogmsg("rootdir", peer->groupname); peer->umask = mktokconfint(tset, section, "umask", "%o", NULL, peer->vserver->umask) & 0777; peer->chmodable = mktokconfint(tset, section, "chmoding", "%d", NULL, 0); peer->jailenabled = mktokconfint(tset, section, "userjail", "%d", NULL, 0); peer->maxusers = mktokconfint(tset, section, "maxusers", "%d", NULL, config->defaults->maxusers); peer->maxtranspd = mktokconfint(tset, section, "maxspeed", "%d", NULL, 0); peer->maxtranspd_down = mktokconfint(tset, section, "maxspeeddown", "%d", NULL, 0); peer->maxtranspd_up = mktokconfint(tset, section, "maxspeedup", "%d", NULL, 0); peer->chroot = mktokconfint(tset, section, "chroot", "%d", NULL, FALSE); peer->droproot = mktokconfint(tset, section, "droproot", "%d", NULL, FALSE); peer->nicevalue = mktokconfint(tset, section, "nice", "%d", NULL, 0); peer->accessdevices = mktokconfint(tset, section, "devaccess", "%d", NULL, FALSE); peer->realdir = mktokconfint(tset, section, "realdir", "%d", NULL, FALSE); peer->fxpallow = mktokconfint(tset, section, "fxpallow", "%d", NULL, FALSE); peer->fakemode = mktokconfint(tset, section, "fakemode", "%o", NULL, -1); peer->fakename = mktokconfstr(tset, section, "fakename", NULL); peer->fakegroup = mktokconfstr(tset, section, "fakegroup", NULL); peer->cwddumpdata = mkconfrealstr(section, "cddumpdata", NULL); peer->logindumpdata = mkconfrealstr(section, "welcomedumpdata", NULL); peer->quitdumpdata = mkconfrealstr(section, "quitdumpdata", NULL); peer->busydumpdata = mkconfrealstr(section, "busydumpdata", NULL); if (!peer->cwddumpdata) peer->cwddump = mktokconfstr(tset, section, "cddump", NULL); if (!peer->logindumpdata) { peer->logindump = mktokconfstr(tset, section, "welcome", NULL); if (!checkabsdir(peer->logindump)) result = authlogmsg("welcome", peer->groupname); } if (!peer->quitdumpdata) { peer->quitdump = mktokconfstr(tset, section, "quitdump", NULL); if (!checkabsdir(peer->quitdump)) result = authlogmsg("quitdump", peer->groupname); } if (!peer->busydumpdata) { peer->busydump = mktokconfstr(tset, section, "busydump", NULL); if (!checkabsdir(peer->busydump)) result = authlogmsg("busydump", peer->groupname); } peer->acldata = acllist_create(); setupacls(peer, tset, section, "fnaccess", 1); setupacls(peer, tset, section, "pfnaccess", 2); setupacls(peer, tset, section, "access", 0); occur = 1; while((data = getconfigdata(config->configfile, section, "cmdoff", occur++))) disableset_disablecmd(peer->cmddisableset, mainftpcmd, data); occur = 1; while((data = getconfigdata(config->configfile, section, "sitecmdoff", occur++))) disableset_disablecmd(peer->sitedisableset, siteftpcmd, data); if (mktokconfint(tset, section, "ratios", "%d", NULL, FALSE)) peer->ratioinfo = ratio_loaduser(peer->username, section); else peer->ratioinfo = NULL; data = mktokconfstr(tset, section, "supgid", "%G"); peer->supgids = parsegidlist(data); freewrapper(data); return(result); } int auth_getcursectionid(FTPSTATE *peer) { return(getsectionid(config->configfile, peer->groupname)); } void *auth_getconfigcache(void) { return(config->configfile); } char *auth_getremotename(FTPSTATE *peer) { return(peer->hostname); } unsigned int *auth_getremoteip(FTPSTATE *peer) { return(&(peer->remoteip)); } PERMSTRUCT *configauthmethod(char *group, char *authmethod) { int count = 0; static PERMSTRUCT dp; #ifdef HAVE_DLOPEN if (authmethod[0] == '/') { /* assume it is a libary module */ #ifndef RTLD_NOW dp.handle = dlopen(authmethod, 1); #else dp.handle = dlopen(authmethod, RTLD_NOW); #endif if (dp.handle == NULL) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("could not open or link '%s', reason: %s", authmethod, dlerror())); return(NULL); } dp.gethandle = dlsym(dp.handle, "gethandle"); dp.freehandle = dlsym(dp.handle, "freehandle"); dp.chkpasswd = dlsym(dp.handle, "chkpasswd"); dp.gethomedir = dlsym(dp.handle, "gethomedir"); dp.getrootdir = dlsym(dp.handle, "getrootdir"); dp.getuseruid = dlsym(dp.handle, "getuseruid"); dp.getusergid = dlsym(dp.handle, "getusergid"); dp.getusersupgid = dlsym(dp.handle, "getusersupgid"); /* make sure the required functions exist and are defined. */ if (!dp.gethandle || !dp.freehandle || !dp.chkpasswd) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("linked module '%s' incomplete", authmethod)); dlclose(dp.handle); return(NULL); } return(&dp); } #endif while(authtypes[count].authname != NULL) { if (strcasecmp(authmethod, authtypes[count].authname) == 0) return(authtypes[count].authstruct); count++; } log_giveentry(MYLOG_INFO, NULL, safe_snprintf("authmethod '%s' does not exist, used by group %s", authmethod, group)); return(NULL); } /* this finds the section the user belongs to */ char *auth_getgroup(FTPSTATE *peer, TOKENSET *tset, int *section, PERMSTRUCT **rprog, void **rinf) { int count = 0; int sectionid, result; char *mode, *authuser; char **grouplist = peer->vserver->grouplist; PERMSTRUCT *am = NULL; void *handle = NULL; while(grouplist[count] != NULL) { sectionid = getsectionid(config->configfile, grouplist[count]); if (sectionid == -1) { /* stop authenticating if error occurs */ log_giveentry(MYLOG_INFO, NULL, safe_snprintf("group %s does not exist", grouplist[count])); return(NULL); } else { authuser = mktokconfstr(tset, sectionid, "authuser", peer->username); mode = getconfigdata(config->configfile, sectionid, "authmethod", 1); if (mode) am = configauthmethod(grouplist[count], mode); if (am) { /* Check ip */ IPACLLIST *clist; clist = ipacllist_new(config->configfile, sectionid, "ipacl"); if (!user_allowed(clist, peer->remoteip, peer->hostname)) am = NULL; ipacllist_destroy(clist); } else return(NULL); if (am) /* Check username */ if (!checknamelist(config->configfile, sectionid, peer->username)) am = NULL; if (am) { /* now see if valid user */ peer->groupname = grouplist[count]; handle = am->gethandle(peer, tset, authuser, &result); /* if the authentication module returns ERROR, return now! */ if (result == AUTH_ERROR) { freewrapper(authuser); return(NULL); } } if (handle) { *section = sectionid; *rprog = (void *)am; *rinf = handle; freewrapper(authuser); return(grouplist[count]); } freewrapper(authuser); } count++; } return(NULL); } char *setuseropts(FTPSTATE *peer, char *password) { int section; void *authhandle = NULL; char *errstr = NULL; PERMSTRUCT *authcmd; TOKENSET *tset = tokenset_new(); /* Check possible exploits here! */ if (checkexploits(peer)) goto authend; peer->loggedin = FALSE; tokenset_settoken(tset, 'U', strdupwrapper(peer->username)); tokenset_settoken(tset, 'v', strdupwrapper(peer->vserver->sectionname)); tokenset_settoken(tset, 'V', strdupwrapper(peer->vserver->vhostname)); peer->groupname = auth_getgroup(peer, tset, §ion, &authcmd, &authhandle); if (peer->groupname == NULL) goto authend; if (!authcmd->chkpasswd(authhandle, password, &errstr)) goto authend; clearauth(peer); buildtokset(tset, authcmd, authhandle); if (!transferconfig(peer, tset, section)) goto authend; peer->loggedin = TRUE; authend: tokenset_finish(tset); if (authhandle) { authcmd->freehandle(authhandle); #ifdef HAVE_DLOPEN if (authcmd->handle) dlclose(authcmd->handle); #endif } if (peer->loggedin) { freeifnotnull(errstr); return(NULL); } else { if (!errstr) errstr = strdupwrapper("Bad password"); return(errstr); } } muddleftpd-1.3.13.1/src/auth.h0100644000175000017500000000127507737077255015016 0ustar joergjoergextern int chkpassword(char *, char *); typedef struct { int (* chkpasswd)(void *, char *, char **errmsg); char *(* gethomedir)(void *); char *(* getrootdir)(void *); uid_t (* getuseruid)(void *); gid_t (* getusergid)(void *); gid_t *(* getusersupgid)(void *); void *(* gethandle)(FTPSTATE *peer, TOKENSET *tset, char *username, int *err); void (* freehandle)(void *); void *handle; } PERMSTRUCT; extern PERMSTRUCT unixauth_commands; extern PERMSTRUCT anonauth_commands; extern PERMSTRUCT internalauth_commands; extern PERMSTRUCT disableauth_commands; #ifdef HAVE_PAM_START extern PERMSTRUCT pamauth_commands; #endif typedef struct { char *authname; PERMSTRUCT *authstruct; } PERMINFO; muddleftpd-1.3.13.1/src/authanon.c0100644000175000017500000000443407737077255015665 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" #include "auth.h" /* This file contains code to autheticate for anonymous users */ typedef struct { struct passwd *passent; FTPSTATE *peer; } PASSWDSTRUCT; void *anonauth_gethandle(FTPSTATE *peer, TOKENSET *tset, char *username, int *err) { PASSWDSTRUCT *newhandle; char *anonuser; newhandle = mallocwrapper(sizeof(PASSWDSTRUCT)); anonuser = mktokconfstr(tset, auth_getcursectionid(peer), "anonymous_user", "ftp"); newhandle->passent = getpwnam(anonuser); if (newhandle->passent == NULL) goto error; newhandle->peer = peer; *err = AUTH_OK; freewrapper(anonuser); return(newhandle); error: *err = AUTH_ERROR; log_giveentry(MYLOG_INFO, peer, safe_snprintf("Could not find user '%s' in password file. Cancelling anonymous authentication.", anonuser)); freewrapper(anonuser); freewrapper(newhandle); return(NULL); } void anonauth_freehandle(void *handle) { freewrapper(handle); } int anonauth_checkpasswd(void *h, char *password, char **errmsg) { log_giveentry(MYLOG_LOGIN, ((PASSWDSTRUCT *)h)->peer, safe_snprintf("anonymous password '%s'", password)); return(TRUE); } char *anonauth_getrootdir(void *h) { return(((PASSWDSTRUCT *)h)->passent->pw_dir); } char *anonauth_gethomedir(void *h) { return("/"); } uid_t anonauth_getuseruid(void *h) { return(config->uidt_nobodyuid); } gid_t anonauth_getusergid(void *h) { return(config->gidt_nobodygid); } PERMSTRUCT anonauth_commands = { anonauth_checkpasswd, anonauth_gethomedir, anonauth_getrootdir, anonauth_getuseruid, anonauth_getusergid, NULL, anonauth_gethandle, anonauth_freehandle, NULL, }; muddleftpd-1.3.13.1/src/authdisable.c0100644000175000017500000000232507737077255016332 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" #include "auth.h" /* This file contains code to autheticate for disabled users */ void *disableauth_gethandle(FTPSTATE *peer, TOKENSET *tset, char *username, int *err) { *err = AUTH_ERROR; return(NULL); } void disableauth_freehandle(void *handle) { } int disableauth_checkpasswd(void *h, char *password, char **errmsg) { return FALSE; } PERMSTRUCT disableauth_commands = { disableauth_checkpasswd, NULL, NULL, NULL, NULL, NULL, disableauth_gethandle, disableauth_freehandle, NULL, }; muddleftpd-1.3.13.1/src/authint.c0100644000175000017500000000676307737077255015533 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" #include "auth.h" #define GOT_USER 1 #define NOT_GOT_USER 0 /* This file contains code to autheticate against custom password files */ typedef struct { char *udata; char *password; char *username; char *homedir; char *rootdir; } PASSWDSTRUCT; int internalauth_config(char *username, char *data, int line, void *h) { PASSWDSTRUCT *handle = (PASSWDSTRUCT *)h; if (strcmp(username, handle->username) == 0) { handle->udata = strdupwrapper(data); return(GOT_USER); } return(NOT_GOT_USER); } void *internalauth_gethandle(FTPSTATE *peer, TOKENSET *tset, char *username, int *err) { PASSWDSTRUCT *newhandle; int result, error, line; char *passwdfile = NULL; /* assume we don't find the user */ *err = AUTH_USERNKNOW; newhandle = mallocwrapper(sizeof(PASSWDSTRUCT)); newhandle->username = strdupwrapper(username); passwdfile = mktokconfstr(tset, auth_getcursectionid(peer), "internal_passfile", NULL); if (passwdfile == NULL) goto logerror; /* make sure that the password file is secure */ result = loadconfigfile(passwdfile, internalauth_config, newhandle, TRUE, &error, &line); switch (result) { case CONFIG_OK: goto error; case CONFIG_HANDLER_ERROR: break; /* found the user */ default: goto logerror; } if (strchrcount(newhandle->udata, ':') != 2) { freewrapper(newhandle->udata); goto error; } newhandle->password = newhandle->udata; newhandle->homedir = strchr(newhandle->udata, ':') + 1; /* lets hope this doesn't cause heart attacks. It may not work with flakey C compilers */ newhandle->homedir[-1] = 0; newhandle->rootdir = strchr(newhandle->homedir, ':') + 1; newhandle->rootdir[-1] = 0; *err = AUTH_OK; freewrapper(passwdfile); return(newhandle); logerror: if (passwdfile == NULL) log_addentry(MYLOG_INFO, NULL, "You didn't specify a password file for internal authentication!"); else log_giveentry(MYLOG_INFO, NULL, safe_snprintf("Error loading '%s': %s", passwdfile, config_errorstr(result))); *err = AUTH_ERROR; error: freeifnotnull(passwdfile); freewrapper(newhandle->username); freewrapper(newhandle); return(NULL); } void internalauth_freehandle(void *h) { PASSWDSTRUCT *handle = (PASSWDSTRUCT *)h; freewrapper(handle->udata); freewrapper(handle->username); freewrapper(handle); } int internalauth_checkpasswd(void *h, char *password, char **errmsg) { PASSWDSTRUCT *handle = (PASSWDSTRUCT *)h; return(chkpassword(handle->password, password)); } char *internalauth_gethomedir(void *h) { return(((PASSWDSTRUCT *)h)->homedir); } char *internalauth_getrootdir(void *h) { return(((PASSWDSTRUCT *)h)->rootdir); } PERMSTRUCT internalauth_commands = { internalauth_checkpasswd, internalauth_gethomedir, internalauth_getrootdir, NULL, NULL, NULL, internalauth_gethandle, internalauth_freehandle, NULL, }; muddleftpd-1.3.13.1/src/authpam.c0100644000175000017500000001402207737077255015501 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" #include "auth.h" #ifdef HAVE_PAM_START /* Are we debugging pam at the moment? */ #define PAMDEBUG #ifdef PAMDEBUG #define PAMLOG(handle, name, user, result) log_giveentry(MYLOG_INFO, NULL, safe_snprintf(name" on %s returned %d. (%s)", user, result, pam_strerror(handle, result))) #else #define PAMLOG(handle, name, user, result) NULL #endif #include /* This file contains code to autheticate using PAM password. It was written using proftpd as a reference */ typedef struct { char *password; char *username; char *homedir; char *passwduser; int uid; int gid; pam_handle_t *pamh; int retval; } PASSWDSTRUCT; PASSWDSTRUCT *currenthandle = NULL; static int pamauth_conv(int num_msg, struct pam_message **msg, struct pam_response **resp, void *appdata_ptr) { struct pam_response *response = NULL; int count; /* I cannot use mallocwrapper here because it will break counters since PAM takes the memory */ response = malloc(sizeof(struct pam_response) * num_msg); if (response == NULL) return(PAM_CONV_ERR); for (count = 0; count < num_msg; count++) { response[count].resp_retcode = PAM_SUCCESS; switch(msg[count]->msg_style) { case PAM_PROMPT_ECHO_ON: if (currenthandle == NULL) ERRORMSGFATAL("PAM is being mean! It wants a username I don't know"); response[count].resp = strdup(currenthandle->username); if (!response[count].resp) return(PAM_CONV_ERR); break; case PAM_PROMPT_ECHO_OFF: if (currenthandle == NULL) ERRORMSGFATAL("PAM is being mean! It wants a password I don't know"); response[count].resp = currenthandle->password; break; case PAM_TEXT_INFO: case PAM_ERROR_MSG: response[count].resp = NULL; break; default: /* yuck, an error! */ free(response); return(PAM_CONV_ERR); } } *resp = response; return(PAM_SUCCESS); } static struct pam_conv mypam = { &pamauth_conv, NULL }; void pamauth_freehandle(void *h) { PASSWDSTRUCT *handle = (PASSWDSTRUCT *)h; pam_end(handle->pamh, handle->retval); freeifnotnull(handle->homedir); freewrapper(handle->passwduser); freewrapper(handle->username); freewrapper(handle); } void *pamauth_gethandle(FTPSTATE *peer, TOKENSET *tset, char *username, int *err) { PASSWDSTRUCT *newhandle; char *pamservice = NULL; char *pamuser = NULL; struct passwd *passent; pamservice = mktokconfstr(tset, auth_getcursectionid(peer), "pam_service", "ftp"); pamuser = mktokconfstr(tset, auth_getcursectionid(peer), "pam_user", "%U"); newhandle = mallocwrapper(sizeof(PASSWDSTRUCT)); newhandle->username = strdupwrapper(username); newhandle->passwduser = pamuser; newhandle->homedir = NULL; /* if we can't get the username from the password file, assume it doesn't exist */ *err = AUTH_USERNKNOW; passent = getpwnam(pamuser); if (passent == NULL) { if (strcmp(username, pamuser) == 0) log_giveentry(MYLOG_INFO, NULL, safe_snprintf("Username '%s' does not exist for pam authentication", pamuser)); goto error; } newhandle->homedir = strdupwrapper(passent->pw_dir); newhandle->uid = passent->pw_uid; newhandle->gid = passent->pw_gid; newhandle->pamh = NULL; newhandle->retval = pam_start(pamservice, username, &mypam, &(newhandle->pamh)); /* lets log all stuff that pam does! */ PAMLOG(newhandle->pamh, "pam_start", username, newhandle->retval); /* if above didn't work, it is a nasty error and should cancel authentication */ *err = AUTH_ERROR; if (newhandle->retval != PAM_SUCCESS) goto error; *err = AUTH_OK; freewrapper(pamservice); return(newhandle); error: pamauth_freehandle(newhandle); freewrapper(pamservice); return(NULL); } int pamauth_checkpasswd(void *h, char *password, char **errmsg) { PASSWDSTRUCT *handle = (PASSWDSTRUCT *)h; currenthandle = handle; handle->password = strdup(password); if (!handle->password) ERRORMSGFATAL("out of memory in PAM module!"); /* This will authenticate the password */ /* I think it uses all the auth PAM configuration lines */ handle->retval = pam_authenticate(handle->pamh, PAM_SILENT); PAMLOG(handle->pamh, "pam_authenticate", handle->username, handle->retval); /* This part now checks the users account */ if (handle->retval == PAM_SUCCESS) handle->retval = pam_acct_mgmt(handle->pamh, 0); else return(FALSE); PAMLOG(handle->pamh, "pam_acct_mgmt", handle->username, handle->retval); if (handle->retval == PAM_SUCCESS) handle->retval = pam_setcred(handle->pamh, PAM_ESTABLISH_CRED); else { *errmsg = safe_snprintf("Account Problem"); return(FALSE); } PAMLOG(handle->pamh, "pam_setcred", handle->username, handle->retval); if (handle->retval == PAM_SUCCESS) return(TRUE); *errmsg = safe_snprintf("Credantial Problem"); return(FALSE); } char *pamauth_gethomedir(void *h) { return(((PASSWDSTRUCT *)h)->homedir); } char *pamauth_getrootdir(void *h) { return("/"); } uid_t pamauth_getuseruid(void *h) { return(((PASSWDSTRUCT *)h)->uid); } gid_t pamauth_getusergid(void *h) { return(((PASSWDSTRUCT *)h)->gid); } gid_t *pamauth_getusersupgid(void *h) { return(getusergrouplist(((PASSWDSTRUCT *)h)->passwduser)); } PERMSTRUCT pamauth_commands = { pamauth_checkpasswd, pamauth_gethomedir, pamauth_getrootdir, pamauth_getuseruid, pamauth_getusergid, pamauth_getusersupgid, pamauth_gethandle, pamauth_freehandle, NULL, }; #endif muddleftpd-1.3.13.1/src/authunix.c0100644000175000017500000001001107737077255015701 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" #include "auth.h" /* This file contains code to autheticate against unix password files */ typedef struct { struct passwd *passent; #ifdef HAVE_GETSPNAM struct spwd *sppassent; #endif } PASSWDSTRUCT; int getday(void) { time_t currenttime = time(NULL); struct tm *currenttm = localtime(¤ttime); int yeardif = currenttm->tm_year - 70; int days; days = yeardif * 365 + currenttm->tm_yday; /* THIS STUFF IS Y2K COMPLIANT */ days += (yeardif + 1) / 4; /* I don't ever expect this code to be used beyond 2100, but so did too many cobol programmers in the 1970's !! */ if (currenttm->tm_year > 200) /* simple algorithm */ { yeardif -= 31; days -= (yeardif) / 100; /* take centaries off */ days += (yeardif) / 400; /* add on 400 year leapyears */ } return(days); } void *unixauth_gethandle(FTPSTATE *peer, TOKENSET *tset, char *username, int *err) { PASSWDSTRUCT *newhandle; char *passwdmode; newhandle = mallocwrapper(sizeof(PASSWDSTRUCT)); passwdmode = mktokconfstr(tset, auth_getcursectionid(peer), "unix_passwdtype", ""); newhandle->passent = getpwnam(username); if (newhandle->passent == NULL) goto error; #ifdef HAVE_GETSPNAM /* this will try to autodetect shadow passwordness */ if ((strcasecmp(passwdmode, "shadow") == 0) || (strcmp(newhandle->passent->pw_passwd, "x") == 0)) { if (strcasecmp(passwdmode, "normal") == 0) newhandle->sppassent = NULL; else { newhandle->sppassent = getspnam(username); if (newhandle->sppassent == NULL) goto error; } } else newhandle->sppassent = NULL; #endif freewrapper(passwdmode); *err = AUTH_OK; return(newhandle); error: *err = AUTH_USERNKNOW; freewrapper(passwdmode); freewrapper(newhandle); return(NULL); } void unixauth_freehandle(void *handle) { freewrapper(handle); } int unixauth_checkpasswd(void *h, char *password, char **errmsg) { PASSWDSTRUCT *handle = (PASSWDSTRUCT *)h; #ifdef HAVE_GETSPNAM if (handle->sppassent) { int days = getday(); int expiredate = handle->sppassent->sp_max + handle->sppassent->sp_lstchg + + handle->sppassent->sp_inact; /* do the account expiration checking! */ if ((days > handle->sppassent->sp_expire) && (handle->sppassent->sp_expire != -1)) { *errmsg = safe_snprintf("Account has expired"); return(FALSE); } if ((handle->sppassent->sp_inact != -1) && (handle->sppassent->sp_max != -1) && (handle->sppassent->sp_lstchg != -1) && (days > expiredate)) { *errmsg = safe_snprintf("Account disabled, needs new password"); return(FALSE); } return(chkpassword(handle->sppassent->sp_pwdp, password)); } #endif return(chkpassword(handle->passent->pw_passwd, password)); } char *unixauth_gethomedir(void *h) { return(((PASSWDSTRUCT *)h)->passent->pw_dir); } char *unixauth_getrootdir(void *h) { return("/"); } uid_t unixauth_getuseruid(void *h) { return(((PASSWDSTRUCT *)h)->passent->pw_uid); } gid_t unixauth_getusergid(void *h) { return(((PASSWDSTRUCT *)h)->passent->pw_gid); } gid_t *unixauth_getusersupgid(void *h) { return(getusergrouplist(((PASSWDSTRUCT *)h)->passent->pw_name)); } PERMSTRUCT unixauth_commands = { unixauth_checkpasswd, unixauth_gethomedir, unixauth_getrootdir, unixauth_getuseruid, unixauth_getusergid, unixauth_getusersupgid, unixauth_gethandle, unixauth_freehandle, NULL, }; muddleftpd-1.3.13.1/src/bufread.c0100644000175000017500000000302707737077255015455 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" extern int signumber; int popcmd(FTPSTATE *peer, char **outstr) { /* find the EOL marker (remember it is in ansi style!) */ char *chtmp = strstr(STRTOCHAR(peer->inbuffer), "\r\n"); *outstr = NULL; if (chtmp == NULL) return(FALSE); else { if ((chtmp - STRTOCHAR(peer->inbuffer)) != (STRLENGTH(peer->inbuffer) - 2)) { /* they are breaking the RFC, kill them now! */ return(TRUE); } *chtmp = 0; *outstr = STRTOCHAR(peer->inbuffer); return(FALSE); } } int readcmd(FTPSTATE *peer) { char inputbuf[BUFFERSIZE]; int stringlen, oldlen = STRLENGTH(peer->inbuffer); stringlen = read(peer->remotefd, inputbuf, BUFFERSIZE); if (stringlen <= 0) return(TRUE); string_cat(&(peer->inbuffer), inputbuf, stringlen); string_filterbadchars_telnet(&(peer->inbuffer), oldlen); return(FALSE); } muddleftpd-1.3.13.1/src/cfloader.c0100644000175000017500000003275607737077255015637 0ustar joergjoerg/* cfloader.c Configuration loader This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" #include "reply.h" VSERVER serverdefaults = { NULL, MAXUSERS, LOGSTRENGTH, TIMEOUT, LOGFILE, EMAIL, LOGINTRIES, BADAUTHWAIT, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL }; char *gethostname2(void) { char *hostname; int size = 32; struct hostent *h; hostname = mallocwrapper(size); while(gethostname(hostname, size-1) == -1) { size *= 2; reallocwrapper(size, (void **)&hostname); } h = gethostbyname(hostname); freewrapper(hostname); if (!h) return(NULL); hostname = strdupwrapper(h->h_name); return(hostname); } /* generates a busy string from config file data */ char *makebusystring(char *input, int alt) { char *r, *n; r = mallocwrapper(strlen(input) + ((strchrcount(input, '/') + 1) * 6) + strlen(REPLY_SERVERBUSY) + 2); strcpy(r, input); /* do / translation */ converttorealstr(r); /* insert inital 421 */ memmove(r + 4, r, strlen(r) + 1); memcpy(r, "421-", 4); /* insert further 421 for each line */ n = r; while((n = strchr(n, '\n')) != NULL) { int len = strlen(n); memmove(n + 5, n, len + 1); if(alt) memcpy(n, "\r\n421-", 6); else memcpy(n, "\r\n ", 6); n = n + 2; } /* insert server message */ strcpy(r + strlen(r), "\r\n"); strcpy(r + strlen(r), REPLY_SERVERBUSY); return(r); } void configerror(char *str) { switch(logerrors) { case SYSLOG: syslog(LOG_ERR, PROGNAME":%s", str); break; case TERMINAL: fprintf(stderr, "CONFIG: %s\n", str); break; case MUDLOG: log_addentry(MYLOG_INFO, NULL, str); } freewrapper(str); } void vserver_kill(VSERVER *c) { if (c->ipaccess) ipacllist_destroy(c->ipaccess); freeifnotnull(c->prelogindumpdata); freeifnotnull(c->grouplist); freeifnotnull(c->toobusy); freewrapper(c); } VSERVER *vserver_load(CONFIGDATA *cf, char *sectionname, VSERVER *def, VSERVERCONN ***vp) { int section, occur; char *setting; VSERVER *newvs = mallocwrapper(sizeof(VSERVER)); VSERVER *dvs = def; if (!dvs) dvs = &serverdefaults; newvs->grouplist = NULL; newvs->ipaccess = NULL; newvs->sectionname = sectionname; section = getsectionid(cf->configfile, sectionname); if (section == -1) { configerror(safe_snprintf("Cannot get %s section in config file!", sectionname)); vserver_kill(newvs); return(NULL); } loadintfromconfig(cf->configfile, section, "maxusers", &(newvs->maxusers), dvs->maxusers); loadintfromconfig(cf->configfile, section, "logstrength", &(newvs->loglevel), dvs->loglevel); loadintfromconfig(cf->configfile, section, "logintries", &(newvs->logincount), dvs->logincount); loadintfromconfig(cf->configfile, section, "timeout", &(newvs->timeout), dvs->timeout); loadintfromconfig(cf->configfile, section, "umask", &(newvs->umask), dvs->umask); loadintfromconfig(cf->configfile, section, "maxconnectperip", &(newvs->maxperip), dvs->maxperip); if (newvs->logincount == 0) newvs->logincount = -1; loadintfromconfig(cf->configfile, section, "badauthwait", &(newvs->authwait), dvs->authwait / 1000); newvs->authwait *= 1000; loadstrfromconfig(cf->configfile, section, "logfile", &(newvs->logfile), dvs->logfile); loadstrfromconfig(cf->configfile, section, "busydumpdata", &setting, NULL); if (setting) newvs->toobusy = makebusystring(setting, cf->altlongreplies); else if (dvs->toobusy) newvs->toobusy = strdupwrapper(dvs->toobusy); else newvs->toobusy = NULL; loadstrfromconfig(cf->configfile, section, "email", &(newvs->email), dvs->email); loadstrfromconfig(cf->configfile, section, "greeting", &(newvs->greetline), dvs->greetline); loadstrfromconfig(cf->configfile, section, "hostname", &(newvs->vhostname), dvs->vhostname); if (newvs->vhostname == NULL) newvs->vhostname = cf->hostname; loadstrfromconfig(cf->configfile, section, "logindump", &(newvs->prelogindump), dvs->prelogindump); loadstrfromconfig(cf->configfile, section, "logindumpdata", &(newvs->prelogindumpdata), dvs->prelogindumpdata); /* if prelogindumpdata is there, allocate it by itself and then convert it to a displayable string */ if (newvs->prelogindumpdata) { newvs->prelogindumpdata = strdupwrapper(newvs->prelogindumpdata); converttorealstr(newvs->prelogindumpdata); } newvs->grouplist = makeconfiglist(cf->configfile, sectionname, "group"); newvs->ipaccess = ipacllist_new(cf->configfile, section, "ipacl"); if (vp == NULL) return(newvs); occur = 1; while((setting = getconfigdata(cf->configfile, section, "ftpport", occur)) != NULL) { char *bindip = strchr(setting, '/'); **vp = mallocwrapper(sizeof(VSERVERCONN)); if (bindip == NULL) getnetworkint("0.0.0.0", &((**vp)->ip)); else { *bindip = 0; getnetworkint(++bindip, &((**vp)->ip)); } sscanf(setting, "%d", &((**vp)->port)); (**vp)->fd = 0; (**vp)->vptr = newvs; *vp = &((**vp)->next); occur++; } return(newvs); } void ftpd_killconfig(CONFIGDATA *dc) { if (dc->configfile) freeconfigcache(dc->configfile); freeifnotnull(dc->vserverlist); freeifnotnull(dc->hostname); if (dc->vservers) { VSERVER *c = dc->vservers; while(c != NULL) { VSERVER *d = c->next; vserver_kill(c); c = d; } } if (dc->inports) { VSERVERCONN *c = dc->inports; while (c != NULL) { VSERVERCONN *d = c->next; freewrapper(c); c = d; } } if (dc->defaults) vserver_kill(dc->defaults); freewrapper(dc); } CONFIGDATA *ftpd_loadconfig(char *inidata, int as_inetd, int use_umask) { CONFIGDATA *newconfig = mallocwrapper(sizeof(CONFIGDATA)); int section, occur, line, error; struct passwd *userinfo; char *setting; VSERVERCONN **vscpos; VSERVER **vspos, *vpos; newconfig->configfile = NULL; newconfig->vserverlist = NULL; newconfig->vservers = NULL; newconfig->inports = NULL; newconfig->inetd = as_inetd; newconfig->parentpid = getpid(); newconfig->defaults = NULL; newconfig->defaulthost = 0; userinfo = getpwnam("nobody"); if (userinfo == NULL) { ftpd_killconfig(newconfig); configerror(strdupwrapper("Cannot find uid/gid for user nobody!")); return(NULL); } newconfig->hostname = gethostname2(); if (!(newconfig->hostname)) { ftpd_killconfig(newconfig); configerror(strdupwrapper("Could not resolve hostname for local machine.")); return(NULL); } newconfig->gidt_nobodygid = userinfo->pw_gid; newconfig->uidt_nobodyuid = userinfo->pw_uid; newconfig->configfile = loadconfigcache(inidata, &line, &error); if (!(newconfig->configfile)) { configerror(safe_snprintf("Error on line %d, %s", line, config_errorstr(error))); configerror(safe_snprintf("Cannot open config file %s", inidata)); ftpd_killconfig(newconfig); return(NULL); } section = getsectionid(newconfig->configfile, "main"); if (section == -1) { ftpd_killconfig(newconfig); configerror(strdupwrapper("Cannot get main section in config file!")); return(NULL); } loadintfromconfig(newconfig->configfile, section, "altlongreplies", &(newconfig->altlongreplies), ALTLONGREPLIES); loadintfromconfig(newconfig->configfile, section, "smartbind", &(newconfig->smartbind), SMARTBIND); loadintfromconfig(newconfig->configfile, section, "zerobind", &(newconfig->zerobind), ZEROBIND); loadintfromconfig(newconfig->configfile, section, "vserverhost", &(newconfig->hostvservers), 0); loadintfromconfig(newconfig->configfile, section, "rdnstimeout", &(newconfig->dnstimeout), RDNSTIMEOUT); if (newconfig->dnstimeout == 0) newconfig->dnstimeout = -1; if (!(setting = getconfigdata(newconfig->configfile, section, "runasuser", 1))) { newconfig->gidt_asgid = getgid(); newconfig->uidt_asuid = getuid(); newconfig->username = NULL; } else { userinfo = getpwnam(setting); if (userinfo == NULL) { configerror(safe_snprintf("runasuser: username '%s' doesn't exist!", setting)); ftpd_killconfig(newconfig); return(NULL); } newconfig->gidt_asgid = userinfo->pw_gid; newconfig->uidt_asuid = userinfo->pw_uid; newconfig->username = setting; } vscpos = &(newconfig->inports); newconfig->vserverlist = makeconfiglist(newconfig->configfile, "main", "vserver"); if (newconfig->vserverlist[0] == NULL) { /* we don't have vservers, so we create one vserver using the main section. This has the major advantage of not needing lots of code for non-vserver setups */ newconfig->defaults = vserver_load(newconfig, "main", NULL, &(vscpos)); newconfig->defaults->umask = use_umask; newconfig->vservers = NULL; } else { if (newconfig->hostvservers) newconfig->defaults = vserver_load(newconfig, "main", NULL, &(vscpos)); else newconfig->defaults = vserver_load(newconfig, "main", NULL, NULL); newconfig->defaults->umask = use_umask; occur = 0; vspos = &(newconfig->vservers); while(newconfig->vserverlist[occur] != NULL) { if (strlen(newconfig->vserverlist[occur]) >= MAXSECTIONLEN) { configerror(safe_snprintf("vserver '%s', name too long. Must be less than %d characters long.", newconfig->vserverlist[occur], MAXSECTIONLEN)); ftpd_killconfig(newconfig); return(NULL); } *vspos = vserver_load(newconfig, newconfig->vserverlist[occur], newconfig->defaults, &(vscpos)); if (*vspos == NULL) { ftpd_killconfig(newconfig); return(NULL); } vspos = &((*vspos)->next); occur++; } *vspos = NULL; } *vscpos = NULL; newconfig->rootmode = ((int)newconfig->uidt_asuid == 0); loadstrfromconfig(newconfig->configfile, section, "vserverdefault", &setting, NULL); if ((setting) && (newconfig->vservers) && (newconfig->hostvservers)) { vpos = newconfig->vservers; while((vpos != NULL) && (strcmp(vpos->sectionname, setting) != 0)) vpos = vpos->next; if (vpos == NULL) { configerror(safe_snprintf("vserverdefault section '%s' is not defined.")); ftpd_killconfig(newconfig); return(NULL); } newconfig->defaulthost = vpos; } return(newconfig); } int ftpd_checkvserver(CONFIGDATA *cdat, VSERVER *vs) { int result = TRUE; int count = 0; if (vs->maxusers <= 0) { configerror(safe_snprintf("section '%s': must has maxusers more than zero.", vs->sectionname)); result = FALSE; } if ((vs->loglevel > 127) || (vs->loglevel < 0)) { configerror(safe_snprintf("section '%s': Logstrength must be between 0 and 127", vs->sectionname)); result = FALSE; } if (vs->logfile) if (vs->logfile[0] != '/') { configerror(safe_snprintf("section '%s': logfile is not an absolute filename", vs->sectionname)); result = FALSE; } if (vs->prelogindump) if (vs->prelogindump[0] != '/') { configerror(safe_snprintf("section '%s': logindump is not an absolute filename.", vs->sectionname)); result = FALSE; } if ((vs->logincount == 0) || (vs->logincount < -1)) { configerror(safe_snprintf("section '%s': logintries must be more than 0 or set to -1.", vs->sectionname)); result = FALSE; } if (vs->authwait < 0) { configerror(safe_snprintf("section '%s': badauthwait must be 0 or more milliseconds.", vs->sectionname)); result = FALSE; } while(vs->grouplist[count] != NULL) { if (strlen(vs->grouplist[count]) >= MAXSECTIONLEN) { configerror(safe_snprintf("section '%s': group '%s', name too long. Must be less than %d characters long", vs->sectionname, vs->grouplist[count], MAXSECTIONLEN)); result = FALSE; } else if (getsectionid(cdat->configfile, vs->grouplist[count]) == -1) { configerror(safe_snprintf("section '%s': group '%s' does not have a section in the config file.", vs->sectionname, vs->grouplist[count])); result = FALSE; } count++; } return(result); } int ftpd_checkconfig(CONFIGDATA *cdat) { int result = TRUE; VSERVERCONN *vsc, *vsc2; VSERVER *vs; if (cdat->dnstimeout < -1) { result = FALSE; configerror(strdupwrapper("dnstimeout must be zero or more seconds")); } /* search for duplicate binds! */ vsc = cdat->inports; if (vsc == NULL) { result = FALSE; configerror(strdupwrapper("there are no ports to bind to.")); } while ((vsc != NULL) && result) { vsc2 = vsc->next; if ((vsc->port <= 0) || (vsc->port > 32768)) { result = FALSE; configerror(strdupwrapper("port to bind to not in valid range")); } while ((vsc2 != NULL) && result) { if ((vsc2->port) == (vsc->port)) if ((vsc2->ip == 0) || (vsc2->ip == vsc->ip)) { result = FALSE; configerror(strdupwrapper("Overlapping port binds found!")); } vsc2 = vsc2->next; } vsc = vsc->next; } /* now check all the vservers */ vs = cdat->vservers; while ((vs != NULL) && result) { result = ftpd_checkvserver(cdat, vs); vs = vs->next; } if (result) result = ftpd_checkvserver(cdat, cdat->defaults); /* now check the config file, and open attempt to open it */ if (result) /* if everything is ok still */ { cdat->logout = log_initcontext(cdat->defaults->logfile); if (cdat->logout == -1) { result = FALSE; configerror(safe_snprintf("Couldn't open logfile '%s'", cdat->defaults->logfile)); } } return(result); } muddleftpd-1.3.13.1/src/checkip.c0100644000175000017500000000702307737077255015453 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" int checknamelist(CONFIGFILECACHE *cf, int section, char *username) { int occur; char *setting; occur = 1; while ((setting = getconfigdata(cf, section, "nameacl", occur))) { char *name = strchr(setting, ':'); if (name) { name++; if (my_fnmatch(name, username, 0) == 0) return((*setting == 'A') || (*setting == 'a')); } occur++; } return(FALSE); } IPACLLIST *ipacllist_new(CONFIGFILECACHE *cf, int section, char *name) { int occur; char *setting; IPACLLIST *new = mallocwrapper(sizeof(IPACLLIST)); occur = 1; new->count = 0; new->list = NULL; while ((setting = getconfigdata(cf, section, name, occur))) { char *settingt = strdupwrapper(setting); char *netmask, *ipaddr; strtrimspace(settingt); ipaddr = strchr(settingt, ':'); if (ipaddr) { ipaddr++; netmask = strchr(ipaddr, '/'); reallocwrapper(sizeof(IPACL) * (new->count + 1), (void *)&(new->list)); new->list[new->count].accept = (*settingt == 'A') || (*settingt == 'a'); if ((*ipaddr == '(') && (ipaddr[strlen(ipaddr)-1] == ')')) { /* hostname-pattern type IPACL */ memmove(settingt, ipaddr + 1, strlen(ipaddr)); settingt[strlen(settingt)-1] = 0; new->list[new->count].fnstr = settingt; new->list[new->count].type = 0; } else if (!netmask) { /* IP-pattern type IPACL */ memmove(settingt, ipaddr, strlen(ipaddr)+1); new->list[new->count].fnstr = settingt; new->list[new->count].type = 1; } else { *netmask = 0; netmask++; getnetworkint(ipaddr, &(new->list[new->count].ipaddr)); getnetworkint(netmask, &(new->list[new->count].netmask)); new->list[new->count].fnstr = NULL; freewrapper(settingt); new->list[new->count].type = 2; } new->count++; } else { log_addentry(MYLOG_INFO, NULL, "Error decoding ipacl directive, data missing ':'. Skipping entry."); freewrapper(settingt); } occur++; } return(new); } void ipacllist_destroy(IPACLLIST *list) { int count; if (list->count > 0) { for (count = 0; count < list->count; count++) freeifnotnull(list->list[count].fnstr); freewrapper(list->list); } freewrapper(list); } int user_allowed(IPACLLIST *list, int ip, char *hostname) { int pos = 0; int mip, mip2; char *ipstr = (char *)getipstr(ip); for (pos = 0; pos < list->count; pos++) { switch(list->list[pos].type) { case 0: if (my_fnmatch(list->list[pos].fnstr, hostname, 0) == 0) return(list->list[pos].accept); break; case 1: if (my_fnmatch(list->list[pos].fnstr, ipstr, 0) == 0) return(list->list[pos].accept); break; case 2: mip = ip & list->list[pos].netmask; mip2 = list->list[pos].ipaddr & list->list[pos].netmask; if (mip == mip2) return(list->list[pos].accept); break; } } return(FALSE); } muddleftpd-1.3.13.1/src/cmd.c0100644000175000017500000001426707737077255014620 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" #include "ftpcmd.h" /* command, proc, needsparam, needlogin, dataportok */ FTPCMD siteftpcmd[] = { #ifdef DUMPCMD {"DUMP", ftpsite_dump, TRUE, TRUE, FALSE, "Display a file over control connection." }, */ #endif {"UMASK", ftpsite_umask, FALSE, TRUE, FALSE, "Change the umask." }, {"CHMOD", ftpsite_chmod, TRUE, TRUE, FALSE, "Change the permissions on a file." }, {"HELP", ftpsite_help, FALSE, TRUE, TRUE, "Get help on SITE commands." }, #ifdef ACCESSCMD {"ACCESS", ftpsite_access, FALSE, TRUE, TRUE, "Show access list that is enforced." }, */ #endif {"IDLE", ftpsite_idle, FALSE, TRUE, FALSE, "Change the current timeout." }, {"", NULL, FALSE, FALSE, FALSE, ""} }; FTPCMD mainftpcmd[] = { {"PORT", ftp_port, TRUE , TRUE , FALSE, "Specify data port connection." }, {"PASV", ftp_pasv, FALSE, TRUE , FALSE, "Specify a passive data port connection." }, {"RETR", ftp_retr, TRUE , TRUE , FALSE, "Download a file." }, {"STOR", ftp_stor, TRUE , TRUE , FALSE, "Upload a file." }, {"STOU", ftp_stou, TRUE , TRUE , FALSE, "Upload a file, storing it with a unique filename." }, {"APPE", ftp_appe, TRUE , TRUE , FALSE, "Append to a file on the server." }, {"TYPE", ftp_type, TRUE , TRUE , FALSE, "Specify type of file transfer." }, {"QUIT", ftp_quit, FALSE, FALSE, TRUE , "Quit control connection." }, {"PASS", ftp_pass, FALSE, FALSE, FALSE, "Specify password." }, {"USER", ftp_user, TRUE , FALSE, FALSE, "Specify username." }, {"HOST", ftp_host, TRUE , FALSE, FALSE, "Specify virtual host." }, {"SYST", ftp_syst, FALSE, FALSE, FALSE, "Return the system type." }, {"LIST", ftp_list, FALSE, TRUE , FALSE, "Do a long file list." }, {"NLST", ftp_nlst, FALSE, TRUE , FALSE, "Do a short file list." }, {"PWD" , ftp_pwd , FALSE, TRUE , FALSE, "Get the current directory." }, {"XPWD", ftp_pwd , FALSE, TRUE , FALSE, "Get the current directory." }, {"CWD" , ftp_cwd , TRUE , TRUE , FALSE, "Change the current directory." }, {"XCWD", ftp_cwd , TRUE , TRUE , FALSE, "Change the current directory." }, {"ABOR", ftp_abor, FALSE, TRUE , TRUE , "Abort a file transfer." }, {"CDUP", ftp_cdup, FALSE, TRUE , FALSE, "Change to parent directory." }, {"XCUP", ftp_cdup, FALSE, TRUE , FALSE, "Change to parent directory." }, {"STAT", ftp_stat, FALSE, TRUE , TRUE , "Get server status." }, {"NOOP", ftp_noop, FALSE, FALSE, TRUE , "No-operation." }, {"REIN", ftp_rein, FALSE, FALSE, TRUE , "Re-initialize server." }, {"REST", ftp_rest, TRUE , TRUE , FALSE, "Specify resume postion for file transfer." }, {"DELE", ftp_dele, TRUE , TRUE , FALSE, "Delete a file." }, {"MKD" , ftp_mkd , TRUE , TRUE , FALSE, "Make a new directory." }, {"XMKD", ftp_mkd , TRUE , TRUE , FALSE, "Make a new directory." }, {"XRMD", ftp_rmd , TRUE , TRUE , FALSE, "Remove a directory." }, {"RMD" , ftp_rmd , TRUE , TRUE , FALSE, "Remove a directory." }, {"RNFR", ftp_rnfr, TRUE , TRUE , FALSE, "Specify a file to rename from." }, {"RNTO", ftp_rnto, TRUE , TRUE , FALSE, "Specify a file to rename to." }, {"SIZE", ftp_size, TRUE , TRUE , FALSE, "Get the size of a file." }, {"MDTM", ftp_mdtm, TRUE , TRUE , FALSE, "Get the modified data of a file." }, {"HELP", ftp_help, FALSE, FALSE, TRUE , "Get help on commands." }, {"SITE", ftp_site, FALSE, TRUE , TRUE , "Site specific commands. See SITE HELP." }, {"ALLO", ftp_allo, FALSE, TRUE , FALSE, "Allocate space (redundant)." }, {"ACCT", ftp_acct, FALSE, TRUE , FALSE, "Specify account (redundant)." }, {"STRU", ftp_stru, FALSE, TRUE , FALSE, "Specify structure (redundant)."}, {"EPRT", ftp_eprt, TRUE , TRUE , FALSE, "Specify an extended data port connection."}, {"EPSV", ftp_epsv, FALSE, TRUE , FALSE, "Specify an extended passive port connection."}, {"", NULL , FALSE, FALSE, FALSE, ""} }; int *disableset_create(void) { int *set; int count = 0; while(mainftpcmd[count].ftpfunc != NULL) count++; count++; set = mallocwrapper(sizeof(int) * count); memset(set, 0, sizeof(int) * count); return(set); } void disableset_disablecmd(int *set, FTPCMD *ctable, char *cmd) { int count = 0; while((strcasecmp(ctable[count].command, cmd) != 0) && (ctable[count].ftpfunc != NULL)) count++; if (ctable[count].ftpfunc != NULL) set[count] = TRUE; else log_giveentry(MYLOG_INFO, NULL, safe_snprintf("Could not find command '%s' to disable.", cmd)); } char *getkeyword(char **iline) { char *data, *param; /* move to the first non-space stuff */ while ((**iline == ' ') || ((unsigned char)**iline > 128)) (*iline)++; data = strdupwrapper(*iline); param = strchr(data, ' '); if (param != NULL) *param = 0; *iline = strchr(*iline, ' '); if (*iline != NULL) (*iline)++; return(data); } void cmd_split(FTPSTATE *peer, INPUTLINE *cmd, char* inpline, FTPCMD *ctable, int log, int *disableset) { char *command; char *param = inpline; int counter; command = getkeyword(¶m); if (param != NULL) cmd->parameters = strdupwrapper(param); else cmd->parameters = NULL; counter = 0; /* while (command not found && not end of table) || command is disabled */ /* this causes the parser to drop past disabled commands */ while( ((strcasecmp(ctable[counter].command, command) != 0) && (ctable[counter].ftpfunc != NULL)) || ((disableset ? disableset[counter] : ctable[counter].needslogin))) { counter++; } cmd->command = &(ctable[counter]); if (log) if (cmd->command->ftpfunc != ftp_none) { if (cmd->command->ftpfunc == ftp_pass) log_addentry(MYLOG_COMMAND, peer, "PASS *"); else log_addentry(MYLOG_COMMAND, peer, inpline); } freewrapper(command); } muddleftpd-1.3.13.1/src/config.c0100644000175000017500000002666407737077255015326 0ustar joergjoerg/* config.c --- gereric config file loader Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" char *getconfigdata_r(CONFIGFILECACHE *cache, int section, char *cmd, int *occur, int depth, int *error); /* this, rather messyly, splits an input line into the command and data where the command is the first word on a line, and the data is the second. */ char *strsplit(char *in, char *cmd, char *data) { int pos = 0; int pos2 = 0; if (strlen(in) >= 1) if (in[strlen(in) - 1] == 10) in[strlen(in) - 1] = 0; while(in[pos] != 0) /* scan entire string resolving \ and remove comments */ { if ((in[pos] == '\\') && (in[pos+1] != 0)) pos++; else if (in[pos] == '#') { in[pos2] = 0; break; } in[pos2] = in[pos]; pos++; pos2++; } in[pos2] = 0; pos = 0; pos2 = 0; while((in[pos] <= 32) && (in[pos] != 0)) pos++; if (in[pos] == 0) return(NULL); while(((unsigned char)(in[pos]) > 32) && (in[pos] != 0)) { cmd[pos2] = in[pos]; pos2++; pos++; } if (in[pos] == 0) return(NULL); cmd[pos2] = 0; while((in[pos] <= 32) && (in[pos] != 0)) pos++; if (in[pos] == 0) return(NULL); pos2 = 0; strcpy(data, in + pos); pos = strlen(data); /* now trace back spaces and tabes at end of line */ while(data[--pos] <= 32); data[pos + 1] = 0; return(data); } /* This will open and load each line in the specified config file (filename) and then split it up into constitute parts before sending them off to a handler you specify with a void pointer (to be used as the structure that the config file will load each item into) */ int loadconfigfile(char *filename, int (* confighandler)(char *, char *, int, void *), void *configdata, int besecure, int *handlererror, int *linenum) { NEWFILE *configfile; char *inputline; char *cmd = NULL; char *data = NULL; int result; *linenum = 0; configfile = nfopen(filename); if (configfile == NULL) return(CONFIG_FILE_ERROR); if (besecure) if (!isfilesafe(configfile->fd)) { nfclose(configfile); return(CONFIG_FILE_UNSAFE); } result = CONFIG_OK; while((inputline = nfgetcs(configfile, '\n')) != NULL) { int a = strlen(inputline) + 1; reallocwrapper(a, (void **)&cmd); reallocwrapper(a, (void **)&data); (*linenum)++; /* This is a fix for config files written with DOS based software */ a = strlen(inputline); if (a >= 2) if (inputline[a-2] == '\r') inputline[a-2] = 0; if (strsplit(inputline, cmd, data) != NULL) { *handlererror = confighandler(cmd, data, *linenum, configdata); if (*handlererror) { result = CONFIG_HANDLER_ERROR; freewrapper(inputline); break; } } freewrapper(inputline); } freeifnotnull(cmd); freeifnotnull(data); nfclose(configfile); return(result); } /* this code is quite tricky, but it saves much memory */ int cachemaker(char *cmd, char *data, int linenum, void *c) { char newcmd[32]; CONFIGFILECACHE *cache = (CONFIGFILECACHE *)c; int count; if (strcasecmp(cmd, "[section]") == 0) { /* add new section */ if (strcasecmp(data, "none") == 0) return(CFC_SECTION_NONE); /* check to see if section already is there */ for (count = 0; count < cache->sectioncount; count++) if (strcasecmp(data, cache->sectionlist + cache->sectionindex[count]) == 0) return(CFC_SECTION_EXISTS); /* nupe, add it, may be a little slow, but is efficient enough */ cache->sectioncount++; reallocwrapper(sizeof(int) * cache->sectioncount, (void *)&cache->sectionindex); reallocwrapper(sizeof(int) * cache->sectioncount, (void *)&cache->sectionlinenum); cache->sectionindex[cache->sectioncount - 1] = cache->sectionlen; cache->sectionlinenum[cache->sectioncount - 1] = linenum; cache->sectionlen += strlen(data) + 1; reallocwrapper(cache->sectionlen, (void *)&(cache->sectionlist)); strcpy(cache->sectionlist + cache->sectionindex[cache->sectioncount - 1], data); reallocwrapper(sizeof(int) * cache->sectioncount, (void **)&(cache->index)); cache->index[cache->sectioncount - 1] = cache->datacount; } else { if (cache->sectioncount == 0) return(CFC_NO_SECTION); /* change an include to a special character for quick recognision. Puts this special character in a new string that is long enough for the machine type muddleftpd is running on */ if (strcasecmp(cmd, "include") == 0) { memset(newcmd, 1, sizeof(int) + 2); newcmd[sizeof(int)+1] = 0; cmd = newcmd; } /* add it to the data list */ cache->datacount++; reallocwrapper(sizeof(char *) * cache->datacount, (void *)&(cache->dataindex)); reallocwrapper(sizeof(char *) * cache->datacount, (void *)&(cache->cmdindex)); reallocwrapper(sizeof(int) * cache->datacount, (void *)&cache->datalinenum); cache->dataindex[cache->datacount - 1] = cache->datalen; cache->cmdindex[cache->datacount - 1] = cache->cmdlen; cache->datalinenum[cache->datacount - 1] = linenum; cache->datalen += strlen(data) + 1; cache->cmdlen += strlen(cmd) + 1; reallocwrapper(cache->datalen, (void *)&(cache->datalist)); reallocwrapper(cache->cmdlen, (void *)&(cache->cmdlist)); strcpy(cache->datalist + cache->dataindex[cache->datacount - 1], data); strcpy(cache->cmdlist + cache->cmdindex[cache->datacount - 1], cmd); } return(FALSE); } CONFIGFILECACHE *loadconfigcache(char *filename, int *linenum, int *error) { CONFIGFILECACHE *newcache = NULL; int result, count; newcache = mallocwrapper(sizeof(CONFIGFILECACHE)); newcache->sectioncount = 0; newcache->datacount = 0; newcache->sectionlen = 0; newcache->datalen = 0; newcache->cmdlen = 0; newcache->sectionindex = NULL; newcache->dataindex = NULL; newcache->cmdindex = NULL; newcache->sectionlist = NULL; newcache->datalist = NULL; newcache->cmdlist = NULL; newcache->index = NULL; newcache->sectionlinenum = NULL; newcache->datalinenum = NULL; result = loadconfigfile(filename, cachemaker, newcache, TRUE, error, linenum); if (result != CONFIG_OK) { if (result != CONFIG_HANDLER_ERROR) *error = result; freeconfigcache(newcache); return(NULL); } /* resolve all include references! */ for (count = 0; count < newcache->datacount; count++) { if (*(newcache->cmdlist + newcache->cmdindex[count]) == 1) { /* found an include item, resolve the include reference */ int section = getsectionid(newcache, newcache->datalist + newcache->dataindex[count]); if (section == -1) { *error = CFC_INCLUDE_ERROR; *linenum = newcache->datalinenum[count]; freeconfigcache(newcache); return(NULL); } memcpy((char *)(newcache->cmdlist + newcache->cmdindex[count] + 1), §ion, sizeof(section)); } } /* check for recursive includes! */ for (count = 0; count < newcache->sectioncount; count++) { int deptherror = FALSE; int occur = 1; char *data; /* search for something to check for looping */ data = getconfigdata_r(newcache, count, "[section]", &occur, 1, &deptherror); if (deptherror) { *error = CFC_INCLUDE_LOOP; *linenum = newcache->sectionlinenum[count]; freeconfigcache(newcache); return(NULL); } } freeifnotnull(newcache->sectionlinenum); newcache->sectionlinenum = NULL; freeifnotnull(newcache->datalinenum); newcache->datalinenum = NULL; return(newcache); } char *config_errorstr(int result) { static char longerror[256]; switch(result) { case CONFIG_OK: return("No errors."); case CONFIG_HANDLER_ERROR: return("Config handler returned error result."); case CONFIG_FILE_UNSAFE: return("File was not deemed safe. Must not be group/world writable and must be owned by process owner."); case CONFIG_FILE_ERROR: snprintf(longerror, 256, "Error opening file (%s).", strerror(errno)); return(longerror); case CFC_INCLUDE_ERROR: return("Included section could not be found."); case CFC_SECTION_NONE: return("Section cannot be named 'none'."); case CFC_SECTION_EXISTS: return("Section already exists."); case CFC_NO_SECTION: return("No section has been decleared for config data."); case CFC_INCLUDE_LOOP: return("A possible recursive loop was found in section."); default: return("Unknown error!"); } } int getsectionid(CONFIGFILECACHE *cache, char *section) { int count; for(count = 0; count < cache->sectioncount; count++) if (strcasecmp(section, cache->sectionlist + cache->sectionindex[count]) == 0) return(count); return(-1); } char *getconfigdata_r(CONFIGFILECACHE *cache, int section, char *cmd, int *occur, int depth, int *error) { int count, last; int first; int num; char *res; assert(section < cache->sectioncount); assert(section >= 0); assert(*occur > 0); if (depth > MAXINCLUDEDEPTH) { *error = TRUE; return(NULL); } first = cache->index[section]; /* find the last datalist element to look at */ if (section == cache->sectioncount - 1) last = cache->datacount; else last = cache->index[section + 1]; /* find the occurance wanted */ for(count = first; count < last; count++) { if (*(cache->cmdlist + cache->cmdindex[count]) == 1) { memcpy(&num, (char *)(cache->cmdlist + cache->cmdindex[count] + 1), sizeof(num)); res = getconfigdata_r(cache, num, cmd, occur, depth + 1, error); if (res) return(res); } if (strcasecmp(cmd, cache->cmdlist + cache->cmdindex[count]) == 0) (*occur)--; if (*occur == 0) return(cache->datalist + cache->dataindex[count]); } /* if not found, return NULL */ return(NULL); } char *getconfigdata(CONFIGFILECACHE *cache, int section, char *cmd, int occur) { int error; return(getconfigdata_r(cache, section, cmd, &occur, 1, &error)); } char **makeconfiglist(CONFIGFILECACHE *cache, char *section, char *label) { int sectnum; char **out; char *setting; int occur; sectnum = getsectionid(cache, section); if (sectnum == -1) return(NULL); out = mallocwrapper(sizeof(char *)); occur = 1; while ((setting = getconfigdata(cache, sectnum, label, occur))) { out[occur - 1] = setting; occur++; reallocwrapper(sizeof(char *) * occur, (void *)&out); } out[occur - 1] = NULL; return(out); } void loadintfromconfig(CONFIGFILECACHE *cache, int section, char *setting, int *to, int def) { char *set = getconfigdata(cache, section, setting, 1); if (set) sscanf(set, "%d", to); else *to = def; } void loadstrfromconfig(CONFIGFILECACHE *cache, int section, char *setting, char **to, char *def) { char *set = getconfigdata(cache, section, setting, 1); if (set) *to = set; else *to = def; } void freeconfigcache(CONFIGFILECACHE *cache) { freeifnotnull(cache->sectionindex); freeifnotnull(cache->dataindex); freeifnotnull(cache->cmdindex); freeifnotnull(cache->sectionlist); freeifnotnull(cache->index); freeifnotnull(cache->datalist); freeifnotnull(cache->cmdlist); freeifnotnull(cache->sectionlinenum); freeifnotnull(cache->datalinenum); freewrapper(cache); } muddleftpd-1.3.13.1/src/configfile.h0100644000175000017500000000205307737077255016155 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef CONFIGFILE_H #define CONFIGFILE_H typedef struct { int sectioncount, datacount; int *sectionindex, *dataindex, *cmdindex; int sectionlen, datalen, cmdlen; char *sectionlist, *datalist, *cmdlist; int *index; /* these are for error checking and are only temporarly used */ int *sectionlinenum, *datalinenum; } CONFIGFILECACHE; #endif muddleftpd-1.3.13.1/src/datasock.c0100644000175000017500000001534207737077255015641 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" #include "reply.h" extern int list_write(SELECTER *sel, int fd, void *peerv); extern int download_write(SELECTER *sel, int fd, void *peerv); extern int upload_read(SELECTER *sel, int fd, void *peerv); int datasock_connect(SELECTER *sel, int fd, void *peerv) { FTPSTATE *peer = (FTPSTATE *)peerv; DATAPORT *d = peer->dport; int error = 0; int on, ret = FALSE; char *modstr, transtr[100]; if (d->passive) { unsigned int ip; int temp = get_conn(fd, &ip); if (temp == -1) { reporterror(peer, "data sock", errno); closedatasocket(peer); return(2); } if ((ip != peer->remoteip) && (!peer->fxpallow)) { ftp_write(peer, FALSE, 550, REPLY_PASSIVEBADHOST); close(temp); closedatasocket(peer); return(2); } else { d->socketfd = temp; select_addfd(sel, temp); } ret = 2; /* delete the listening socket */ } else { int intsize = sizeof(int); getsockopt(d->socketfd, SOL_SOCKET, SO_ERROR, &error, &intsize); select_takewrite(sel, d->socketfd); if (error != 0) { reporterror(peer, "data socket", error); closedatasocket(peer); return(2); } } /* Now attempt to throttle data port to maximum throughput and NOPUSH */ /* I disabled logging of setsockopt failure becuase it isn't fatal and seemed to annoy people too much */ #ifdef SO_SNDLOWAT /* If we can set it */ on = LOWATERMARK; setsockopt(d->socketfd, SOL_SOCKET, SO_SNDLOWAT, &on, sizeof(int)); #endif #ifdef SO_RCVLOWAT on = LOWATERMARK; setsockopt(d->socketfd, SOL_SOCKET, SO_RCVLOWAT, &on, sizeof(int)); #endif /* set the socket non-blocking */ fcntl(d->socketfd, F_SETFL, O_NONBLOCK); /* this is here because we have to make sure the data port is connected before we give credits */ if ((d->trans_type == TRANS_SUPLOAD) && (peer->ratioinfo)) ratio_uploadfile(peer->ratioinfo); if (d->binary) modstr = "BINARY"; else modstr = "ASCII"; transtr[0] = 0; if (d->tsize != -1) snprintf(transtr, 99, " (%s bytes)", offt_tostr(d->tsize)); if (d->trans_type == TRANS_LIST) ftp_write(peer, FALSE, 150, REPLY_TRANSLISTSTART); else if ((d->pos == 0) && (d->startpos == 0)) ftp_write(peer, FALSE, 150, REPLY_TRANSSTART(modstr, transtr)); else ftp_write(peer, FALSE, 150, REPLY_TRANSRESUME(modstr, d->pos | d->startpos, transtr)); if (d->filefd != -1) select_addfd(sel, d->filefd); if (d->trans_type == TRANS_LIST) select_addwrite(sel, d->socketfd, list_write, peer); else if (d->trans_type == TRANS_DOWNLOAD) select_addwrite(sel, d->socketfd, download_write, peer); else select_addread(sel, d->socketfd, upload_read, peer); /* Set up a bandwith limiter if it is needed */ if (peer->maxtranspd_up) d->upload_limiter = limiter_new(peer->maxtranspd_up); if (peer->maxtranspd_down) d->download_limiter = limiter_new(peer->maxtranspd_down); if (peer->maxtranspd && (!peer->maxtranspd_up || !peer->maxtranspd_down )) { LIMITER *a = limiter_new(peer->maxtranspd); if (d->download_limiter == NULL) d->download_limiter = a; if (d->upload_limiter == NULL) d->upload_limiter = a; } d->trans_type = TRANS_RUNNING; return(ret); } int startdatasocket(FTPSTATE *peer, int filefd, int trans_type, off_t tsize) { DATAPORT *d = mallocwrapper(sizeof(DATAPORT)); /* if peer->remoteport is not set, use default port, RFC 959 */ if (peer->remoteport == 0) peer->remoteport = peer->connport - 1; d->download_limiter = NULL; d->upload_limiter = NULL; d->filefd = filefd; d->socketfd = -1; d->transbytes = 0; if ((peer->binary) && (trans_type != TRANS_LIST)) { d->pos = peer->restartpos; d->startpos = 0; } else { d->pos = 0; d->startpos = peer->restartpos; } d->binary = peer->binary; if ((trans_type == TRANS_UPLOAD) && (peer->restartpos == 0)) d->trans_type = TRANS_SUPLOAD; else d->trans_type = trans_type; d->tsize = tsize; d->lhandle = NULL; d->passive = (peer->passiveport != 0); d->buffer = NULL; if (!d->passive) { if (peer->epsv_forced) { ftp_write(peer, FALSE, 500, REPLY_EPSVSET); if (filefd != -1) close(filefd); freewrapper(d); return(-1); } file_becomeroot(peer); d->socketfd = conn_server_nonblocking(peer->dataip, peer->remoteport, peer->connport-1, peer->remotefd); file_becomeuser(peer); } else d->socketfd = peer->passiveport; d->buffer = string_new(); peer->remoteport = 0; peer->dataip = peer->remoteip; peer->passiveport = FALSE; peer->dport = d; peer->restartpos = 0; /* can't use default port in epsv all mode */ if (d->socketfd == -1) { reporterror(peer, "data socket", errno); if (filefd != -1) close(filefd); closedatasocket(peer); return(-1); } else { if (d->passive) select_addread(peer->sel, d->socketfd, datasock_connect, peer); else { select_addfd(peer->sel, d->socketfd); select_addwrite(peer->sel, d->socketfd, datasock_connect, peer); } } return(0); } void closedatasocket(FTPSTATE *peer) { if (peer->dport->lhandle) freelisthandle(peer->dport->lhandle); freeifnotnull(peer->dport->buffer); if (peer->dport->download_limiter == peer->dport->upload_limiter) { freeifnotnull(peer->dport->download_limiter); peer->dport->upload_limiter = NULL; } else { freeifnotnull(peer->dport->download_limiter); freeifnotnull(peer->dport->upload_limiter); } freewrapper(peer->dport); peer->dport = NULL; shinfo_changeop("idle"); } void abortdatasocket(FTPSTATE *peer) { if (peer->dport) { if (peer->dport->trans_type == TRANS_RUNNING) { select_delfd(peer->sel, peer->dport->socketfd); if (peer->dport->filefd != -1) select_delfd(peer->sel, peer->dport->filefd); ftp_write(peer, FALSE, 426, REPLY_TRANSABORT(peer->dport->transbytes)); } else { select_delfd(peer->sel, peer->dport->socketfd); ftp_write(peer, FALSE, 530, REPLY_TRANSSTILLBORN); } closedatasocket(peer); } /* also disband any data-ports open, or prepared, since the rfc says so */ peer->remoteport = 0; peer->dataip = peer->remoteip; if (peer->passiveport) { select_delfd(peer->sel, peer->passiveport); peer->passiveport = FALSE; } } muddleftpd-1.3.13.1/src/dir.c0100644000175000017500000000520507737077255014623 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" /* this works correctly for all cased because rootdir has already been corrected using getcwd */ char *dir_getreal(FTPSTATE *peer) { int a; char *dir = getcwd2(); if (dir == NULL) return(NULL); a = strlen(peer->basedir); if (strncmp(peer->basedir, dir, a) == 0) return(dir); freewrapper(dir); errno = EACCES; return(NULL); } /* a quicker way to get the virtual dir, replaces both dir_toreal and dir_tovirtual. Note that the caller must copy the result if it want's to change the source */ char *dir_getvirtual(FTPSTATE *peer, char *normaldir) { int a, b; a = strlen(peer->basedir); b = strlen(normaldir); if (a == 0) return(normaldir); if (b == a) return("/"); return(normaldir + a); } void dir_combine(FTPSTATE *peer, char **pwd, char *newdir) { char *moddir, *nextpos, *curpos; reallocwrapper(strlen(newdir) + strlen(*pwd) + strlen(peer->homedir) + 3, (void *)pwd); moddir = *pwd + strlen(peer->basedir); /* if the directory is /, set it to nothing */ if (moddir[1] == 0) moddir[0] = 0; if (newdir[0] == '/') /* absolute filename */ { /* make newdir relative and clear result */ newdir++; moddir[0] = 0; } else if (newdir[0] == '~') { strcpy(moddir, peer->homedir); newdir++; if (newdir[0] == '/') newdir++; } curpos = newdir; do { nextpos = strchr(curpos, '/'); if (nextpos != NULL) *nextpos = 0; if (strcmp(curpos, "") == 0); else if (strcmp(curpos, ".") == 0); else if (strcmp(curpos, "..") == 0) { char *newpos = strrchr(moddir, '/'); if (newpos) *newpos = 0; } else { strcat(moddir, "/"); strcat(moddir, curpos); } if (nextpos) { /* repair earlier damage, set next component */ *nextpos = '/'; curpos = nextpos + 1; } else curpos = NULL; } while (curpos); /* if the result is nothing, then it means root dir, so say so */ if ((*pwd)[0] == 0) strcpy(*pwd, "/"); } muddleftpd-1.3.13.1/src/file.c0100644000175000017500000002175207737077255014771 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" void file_becomeuser(FTPSTATE *peer) { if (config->rootmode) { if (setegid(peer->gidt_asgid) == -1) log_giveentry(MYLOG_INFO, NULL, safe_snprintf("setegid failed: %s", strerror(errno))); if (seteuid(peer->uidt_asuid) == -1) log_giveentry(MYLOG_INFO, NULL, safe_snprintf("seteuid failed: %s", strerror(errno))); } } void file_becomeroot(FTPSTATE *peer) { if (config->rootmode) { if (seteuid((uid_t)0) == -1) log_giveentry(MYLOG_INFO, NULL, safe_snprintf("seteuid failed: %s", strerror(errno))); if (setegid((gid_t)0) == -1) log_giveentry(MYLOG_INFO, NULL, safe_snprintf("setegid failed: %s", strerror(errno))); } } int checkdir(char *dir) { struct stat check; int result = stat(dir, &check); if (result == 0) if (S_ISDIR(check.st_mode)) return(TRUE); return(FALSE); } int checkfile(char *file) { struct stat check; int result = stat(file, &check); if (result == 0) if (!S_ISDIR(check.st_mode)) return(TRUE); return(FALSE); } int checkchdir(FTPSTATE *peer, char *dir) { int result; char *dir2 = safe_snprintf("%s/", dir); result = (check_acl(peer, dir2, ACL_CHDIR) == 0); if (result) result = (chdir(dir) == 0); freewrapper(dir2); return(result); } /* this needs explaining, send this function a pointer to nine '-' in a string ie "---------" and the file mode of the file, and it will send back the permissions for that file in that string, eg "-rw-r--r--" */ /* this version was inspired by how GNU fileutils does it */ void convertperms(char *permstr, int mode) { int mcpy = mode; int cnt; /* work out the 3 sets of rwx's */ for(cnt = 6; cnt > -1; cnt -= 3) { permstr[cnt+1] = (mcpy & S_IROTH) ? 'r' : '-'; permstr[cnt+2] = (mcpy & S_IWOTH) ? 'w' : '-'; permstr[cnt+3] = (mcpy & S_IXOTH) ? 'x' : '-'; mcpy = (mcpy >> 3); } /* work out special bits. Setuid the setgid the sticky bit */ if (mode & S_ISUID) permstr[3] = (mode & S_IXUSR) ? 's' : 'S'; if (mode & S_ISGID) permstr[6] = (mode & S_IXGRP) ? 's' : 'S'; if (mode & S_ISVTX) permstr[9] = (mode & S_IXOTH) ? 't' : 'T'; /* check for regular files first, better performace! */ if (S_ISREG(mode)) permstr[0] = '-'; else if (S_ISLNK(mode)) permstr[0] = 'l'; else if (S_ISDIR(mode)) permstr[0] = 'd'; else if (S_ISBLK(mode)) permstr[0] = 'b'; else if (S_ISCHR(mode)) permstr[0] = 'c'; else if (S_ISFIFO(mode)) permstr[0] = 'p'; #ifdef S_ISSOCK else if (S_ISSOCK(mode)) permstr[0] = 's'; #endif else permstr[0] = '?'; } char *file_expand(FTPSTATE *peer, char *filename) { char *newfile = strdupwrapper(peer->pwd); dir_combine(peer, &newfile, filename); return(newfile); } int file_isfdregularfile(int fd) { struct stat buf; if (fstat(fd, &buf) == 0) return(S_ISREG(buf.st_mode)); else return(TRUE); /* assume yes! */ } int file_isfdadir(int fd) { struct stat buf; if (fstat(fd, &buf) == 0) return(S_ISDIR(buf.st_mode)); else return(TRUE); /* assume yes, but there is no good reason fstat won't work! */ } /* opens a unique filename, in peers virtual space, returns the real name in rname for logging */ int file_ustoreopen(FTPSTATE *peer, char *infile, int *nounique, char **rname) { char *filename = file_expand(peer, infile); int checknext = TRUE; int pos = 0; int filefd = -1; int epos = strlen(filename); *nounique = FALSE; reallocwrapper(epos + 5, (void **)&filename); if (check_acl(peer, filename, ACL_ADD) == 0) { filefd = open(filename, O_CREAT | O_EXCL | O_WRONLY, 0666 & ~peer->umask); checknext = ((filefd == -1) && (errno == EEXIST)); } while((checknext) && (pos < 1000)) { filename[epos] = '.'; filename[epos+1] = (pos / 100) + '0'; filename[epos+2] = (pos % 100) / 10 + '0'; filename[epos+3] = (pos % 10) + '0'; filename[epos+4] = 0; pos++; if (check_acl(peer, filename, ACL_ADD) == 0) { filefd = open(filename, O_CREAT | O_EXCL | O_WRONLY, 0666 & ~peer->umask); checknext = ((filefd == -1) && (errno == EEXIST)); } } if (pos >= 1000) *nounique = TRUE; *rname = filename; return(filefd); } /* opens a file for storing in peers virtual space, returns the real name for logging in rname */ int file_storeopen(FTPSTATE *peer, char *infile, char **rname) { char *filename = file_expand(peer, infile); int newfd = -1; int openflags = FALSE; int canoverwrite = FALSE; int canadd; canoverwrite = (check_acl(peer, filename, ACL_REPLACE) == 0); canadd = (check_acl(peer, filename, ACL_ADD) == 0); /* if the user can add files, then allow creation */ if (canadd) { openflags |= O_CREAT; /* if the user cannot overwrite files */ if (!canoverwrite) openflags |= O_EXCL; } /* try opening the file, or no-op if no acl perms available */ if (canoverwrite || canadd) newfd = open(filename, openflags | O_WRONLY, 0666 & ~peer->umask); else errno = EACCES; /* now test it against device file access settings */ if ((errno == 0) && (!peer->accessdevices)) if (!file_isfdregularfile(newfd)) { close(newfd); errno = EACCES; newfd = -1; } *rname = filename; return(newfd); } int file_readopen(FTPSTATE *peer, char *infile, char **rname) { int filefd = -1; char *filename = file_expand(peer, infile); check_acl(peer, filename, ACL_READ); if (errno == 0) filefd = open(filename, O_RDONLY); if (errno == 0) if (file_isfdadir(filefd)) { close(filefd); errno = EISDIR; filefd = -1; } if ((errno == 0) && (!peer->accessdevices)) if (!file_isfdregularfile(filefd)) { close(filefd); errno = EACCES; filefd = -1; } *rname = filename; return(filefd); } NEWFILE *file_nfopen(FTPSTATE *peer, char *filename) { char *rname; int fd = file_readopen(peer, filename, &rname); NEWFILE *result = NULL; if (fd > 0) result = nfdopen(fd); freewrapper(rname); return(result); } MYGLOBDATA *file_glob(FTPSTATE *peer, char *dir, char *pattern, int allfiles) { int dirlen = strlen(dir); MYGLOBDATA *mg = NULL; char *pdir = mallocwrapper(dirlen + 2); memcpy(pdir, dir, dirlen); if (pdir[dirlen-1] == '/') dirlen--; pdir[dirlen] = '/'; pdir[dirlen+1] = 0; check_acl(peer, pdir, ACL_LIST); if (errno == 0) mg = myglob(pdir, pattern, allfiles, TRUE); freewrapper(pdir); return(mg); } int file_unlink(FTPSTATE *peer, char *infile) { int result = -1; char *filename = file_expand(peer, infile); check_acl(peer, filename, ACL_DELETE); if (errno == 0) result = unlink(filename); freewrapper(filename); return(result); } /* there is a race here, where the user can get to overwrite a file if it created between checkfile and rename. It appears to be very difficult to prevent */ char *file_rename(FTPSTATE *peer, char *infile, char *infile2) { char *filename = file_expand(peer, infile); char *filename2 = file_expand(peer, infile2); char *badfile = NULL; if (checkfile(filename2)) { if (check_acl(peer, filename2, ACL_DELETE) == -1) badfile = infile2; } else errno = 0; if (errno == 0) if (check_acl(peer, filename2, ACL_ADD) == -1) badfile = infile2; if (errno == 0) if (check_acl(peer, filename, ACL_DELETE) == -1) badfile = infile; if (errno == 0) { if (rename(filename, filename2) == -1) badfile = infile; } freewrapper(filename); freewrapper(filename2); return(badfile); } int file_stat(FTPSTATE *peer, char *infile, struct stat *output) { int result = -1; char *filename = file_expand(peer, infile); check_acl(peer, filename, ACL_READ); if (errno == 0) result = stat(filename, output); freewrapper(filename); return(result); } int file_mkdir(FTPSTATE *peer, char *infile) { int result = -1; char *filename = file_expand(peer, infile); check_acl(peer, filename, ACL_MKDIR); if (errno == 0) result = mkdir(filename, 0777 & ~peer->umask); freewrapper(filename); return(result); } int file_rmdir(FTPSTATE *peer, char *infile) { int result = -1; char *filename = file_expand(peer, infile); check_acl(peer, filename, ACL_RMDIR); if (errno == 0) result = rmdir(filename); freewrapper(filename); return(result); } int file_chmod(FTPSTATE *peer, char *infile, int mode) { int result = -1; char *filename = file_expand(peer, infile); check_acl(peer, filename, ACL_CHMOD); if (errno == 0) /* never allow sticky bit or setgid or setuid to be set */ result = chmod(filename, mode & 0777); freewrapper(filename); return(result); } muddleftpd-1.3.13.1/src/ftp.c0100644000175000017500000006045607737077255014647 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" #include "ftpcmd.h" #include "reply.h" extern FTPCMD mainftpcmd[]; /* This will print a NICE! error to the user */ void reporterror(FTPSTATE *peer, char *filename, int errorno) { ftp_write(peer, FALSE, 550, "'%s': %s", filename, strerror(errorno)); } int readipstr(char *data, int *port, unsigned int *ip) { int a1,a2,a3,a4,a5,a6, result; result = sscanf(data, "%d,%d,%d,%d,%d,%d",&a1, &a2, &a3, &a4, &a5, &a6); if (result != 6) return(FALSE); *ip = (a1 << 24) | (a2 << 16) | (a3 << 8) | (a4); *port = (a5 * 256) + a6; return(TRUE); } int readeipstr(char *ip, unsigned int *outip) { int a1, a2, a3, a4, result; result = sscanf(ip, "%d.%d.%d.%d", &a1, &a2, &a3, &a4); if (result != 4) return(FALSE); *outip = (a1 << 24) | (a2 << 16) | (a3 << 8) | (a4); return(TRUE); } int ftp_dele(FTPSTATE *peer, char *filename) { if (file_unlink(peer, filename) == 0) ftp_write(peer, FALSE, 250, REPLY_DELETE(filename)); else reporterror(peer, filename, errno); return(FALSE); } int ftp_chmod(FTPSTATE *peer, char *filename, int mode) { if (file_chmod(peer, filename, mode) == 0) ftp_write(peer, FALSE, 250, REPLY_CHMOD(filename, mode)); else reporterror(peer, filename, errno); return(FALSE); } int ftp_size(FTPSTATE *peer, char *filename) { int filefd; off_t size = 0; int asize; struct stat statdata; if (peer->binary) { filefd = file_stat(peer, filename, &statdata); if (filefd == 0) size = statdata.st_size; } else { char *rname; size = 0; filefd = file_readopen(peer, filename, &rname); freewrapper(rname); if (filefd > 0) { char *chin, buffer[BUFFERSIZE]; asize = read(filefd, buffer, BUFFERSIZE-1); while (asize > 0) { buffer[asize] = 0; size += asize; chin = buffer; while ((chin = strchr(chin, 10)) != NULL) { chin++; size++; } asize = read(filefd, buffer, BUFFERSIZE-1); } close(filefd); } } if (filefd >= 0) ftp_write(peer, FALSE, 213, "%s", offt_tostr(size)); else reporterror(peer, filename, errno); return(FALSE); } int ftp_mdtm(FTPSTATE *peer, char *filename) { struct stat statdata; if (file_stat(peer, filename, &statdata) == 0) { char timestr[20]; struct tm *resulttm = gmtime(&statdata.st_mtime); strftime(timestr, 20, "%Y%m%d%H%M%S", resulttm); ftp_write(peer, FALSE, 213, timestr); } else reporterror(peer, filename, errno); return(FALSE); } void setdumptokens(FTPSTATE *peer, TOKENSET *ts) { char *outstr; time_t mytime = time(NULL); outstr = ctime(&mytime); outstr[strlen(outstr) - 1] = 0; tokenset_settoken(ts, 'T', strdupwrapper(outstr)); tokenset_settoken(ts, 'U', strdupwrapper(peer->username)); if (peer->pwd) tokenset_settoken(ts, 'C', strdupwrapper(dir_getvirtual(peer, peer->pwd))); tokenset_settoken(ts, 'E', strdupwrapper(peer->vserver->email)); tokenset_settoken(ts, 'M', safe_snprintf("%d", peer->maxusers)); if (peer->loggedin) tokenset_settoken(ts, 'N', safe_snprintf("%d", peer->usercount)); tokenset_settoken(ts, 'R', strdupwrapper(peer->hostname)); tokenset_settoken(ts, 'L', strdupwrapper(peer->vserver->vhostname)); tokenset_settoken(ts, 'f', safe_snprintf("%d", peer->downloadedfiles)); tokenset_settoken(ts, 'F', safe_snprintf("%d", peer->uploadedfiles)); tokenset_settoken(ts, 'b', safe_snprintf("%s", offt_tostr(peer->downloadedfilebytes))); tokenset_settoken(ts, 'B', safe_snprintf("%s", offt_tostr(peer->uploadedfilebytes))); tokenset_settoken(ts, 'I', safe_snprintf("%s", offt_tostr(peer->listdownloadedbytes))); tokenset_settoken(ts, 'i', safe_snprintf("%d", peer->listconns)); tokenset_settoken(ts, 'D', safe_snprintf("%s", offt_tostr(peer->listdownloadedbytes + peer->downloadedfilebytes))); tokenset_settoken(ts, 't', safe_snprintf("%s", offt_tostr(peer->listdownloadedbytes + peer->downloadedfilebytes + peer->uploadedfilebytes))); tokenset_settoken(ts, 'c', safe_snprintf("%d", peer->listconns + peer->downloadedfiles + peer->uploadedfiles)); tokenset_settoken(ts, 'd', safe_snprintf("%d", peer->listconns + peer->downloadedfiles)); if (peer->ratioinfo) ratio_settokens(peer->ratioinfo, ts); tokenset_settoken(ts, 'v', strdupwrapper(peer->vserver->sectionname)); } int ftp_dumper(FTPSTATE *peer, NEWFILE *infile, int number, char *fmessage, int dotokens, int endtokens) { TOKENSET *ts = NULL; char *inp, *tfmessage; int first; if (dotokens) if ((infile != NULL) || (endtokens)) { ts = tokenset_new(); setdumptokens(peer, ts); } if (infile != NULL) { first = TRUE; while ((inp = nfgetcs(infile, '\n')) != NULL) { if (inp[strlen(inp)-1] == '\n') inp[strlen(inp)-1] = 0; if (dotokens) inp = tokenset_apply(ts, inp, FALSE); if (first || config->altlongreplies) { ftp_write(peer, TRUE, 0, "%d-%s", number, inp); first = FALSE; } else ftp_write(peer, TRUE, 0, " %s", inp); freewrapper(inp); } nfclose(infile); } if (endtokens) { tfmessage = tokenset_apply(ts, strdupwrapper(fmessage), FALSE); ftp_write(peer, FALSE, number, "%s", tfmessage); freewrapper(tfmessage); } else ftp_write(peer, FALSE, number, "%s", fmessage); if (ts) tokenset_finish(ts); return(FALSE); } int ftp_dumpstr(FTPSTATE *peer, char *dumpstr, int number, char *fmessage, int endtokens) { TOKENSET *ts = NULL; char *oldinp = dumpstr; char *inp = dumpstr; char *datline, *tfmessage; int first; ts = tokenset_new(); setdumptokens(peer, ts); first = TRUE; while (oldinp != NULL) { inp = strchr(inp, '\n'); if (inp != NULL) *inp = 0; datline = strdupwrapper(oldinp); if (inp != NULL) { *inp = '\n'; inp++; } oldinp = inp; datline = tokenset_apply(ts, datline, FALSE); if (first || config->altlongreplies) { ftp_write(peer, TRUE, 0, "%d-%s", number, datline); first = FALSE; } else ftp_write(peer, TRUE, 0, " %s", datline); freewrapper(datline); } if (endtokens) { tfmessage = tokenset_apply(ts, strdupwrapper(fmessage), FALSE); ftp_write(peer, FALSE, number, "%s", tfmessage); freewrapper(tfmessage); } else ftp_write(peer, FALSE, number, "%s", fmessage); tokenset_finish(ts); return(FALSE); } VSERVER *find_vserver_byname(char *name) { VSERVER *v = config->vservers; while((v != NULL) && (strcasecmp(v->vhostname, name) != 0)) v = v->next; return(v); } int host_isip(char *name) { while(((*name >= '0') && (*name <= '9')) || (*name == '.')) name++; return(*name == 0); } int ftp_host(FTPSTATE *peer, char *params) { VSERVER *v; /* if there are no vservers, or hostname vservers are not defined, return with not implemented */ if ((!config->vservers) || (!config->hostvservers)) return(ftp_write(peer, FALSE, 502, REPLY_NOHOSTS)); /* if a vserver has already been selected, return 530 */ if (peer->vserver != config->defaults) return(ftp_write(peer, FALSE, 530, REPLY_HOSTSELECTED)); if (config->defaulthost && (host_isip(params))) v = config->defaulthost; else v = find_vserver_byname(params); if (!v) return(ftp_write(peer, FALSE, 533, REPLY_HOSTNOTFOUND(params))); switch(vserver_select(peer, v)) { case 1: return(ftp_write(peer, FALSE, 533, REPLY_HOSTMISCONF(params))); case 2: return(ftp_write(peer, FALSE, 533, REPLY_HOSTNOTFOUND(params))); case 3: ftp_write(peer, FALSE, 421, REPLY_HOSTTOOBUSY(params)); return(TRUE); } ftp_write(peer, FALSE, 202, REPLY_HOSTSEL(v->vhostname)); return(3); } int ftp_rnto(FTPSTATE *peer, char *filename) { char *badfile; char *oldname; if (!peer->renameoldname) return(ftp_write(peer, FALSE, 503, REPLY_RENAMENOSOURCE)); oldname = dir_getvirtual(peer, peer->renameoldname); if ((badfile = file_rename(peer, oldname, filename)) == NULL) ftp_write(peer, FALSE, 250, REPLY_RENAME(oldname, filename)); else reporterror(peer, badfile, errno); freewrapper(peer->renameoldname); peer->renameoldname = NULL; return(FALSE); } int ftp_mkd(FTPSTATE *peer, char *filename) { if (file_mkdir(peer, filename) == 0) { char *newfile = file_expand(peer, filename); ftp_write(peer, FALSE, 257, REPLY_MKDIR(dir_getvirtual(peer, newfile))); freewrapper(newfile); } else reporterror(peer, filename, errno); return(FALSE); } int ftp_rmd(FTPSTATE *peer, char *filename) { if (file_rmdir(peer, filename) == 0) ftp_write(peer, FALSE, 250, REPLY_RMDIR(filename)); else reporterror(peer, filename, errno); return(FALSE); } int ftp_cwddo(FTPSTATE *peer, char *newdir, int dump) { char *tmp = strdupwrapper(peer->pwd); dir_combine(peer, &tmp, newdir); if (!checkchdir(peer, tmp)) { freewrapper(tmp); reporterror(peer, newdir, errno); return(FALSE); } chdir(tmp); if (peer->realdir) { char *nt; /* this relies on the side effect of checkchdir where the server changes dir to check */ nt = (char *)dir_getreal(peer); if (nt != NULL) { freewrapper(tmp); tmp = nt; } } { NEWFILE *nfile = NULL; char *outstr; int ret = 257; /* If we need to print a file, then open it */ /* Oh bugger, crap, and other things, I left a big security hole here! :-(, now fixed */ if (dump) ret = 250; freewrapper(peer->pwd); peer->pwd = tmp; if ((dump) && (peer->cwddump) && (!peer->cwddumpdata)) { if (peer->cwddump[0] == '/') /* if it is an absolute file, don't worry about permissions accessing file */ nfile = nfopen(peer->cwddump); else /* worry like hell and pass request via both ACL's and file permissions! */ nfile = file_nfopen(peer, peer->cwddump); } outstr = safe_snprintf(REPLY_PWD(dir_getvirtual(peer, peer->pwd))); if ((dump) && (peer->cwddumpdata)) ftp_dumpstr(peer, peer->cwddumpdata, ret, outstr, FALSE); else ftp_dumper(peer, nfile, ret, outstr, TRUE, FALSE); freewrapper(outstr); } return(FALSE); } int ftp_cwd(FTPSTATE *peer, char *newdir) { return(ftp_cwddo(peer, newdir, TRUE)); } int ftp_run(FTPSTATE *peer, INPUTLINE *cmd, char *token) { if ((cmd->command->ftpfunc) == NULL) return(ftp_write(peer, FALSE, 500, REPLY_CMDNOTKNOWN(token))); if (cmd->command->paramnum) { if (cmd->parameters == NULL) return(ftp_write(peer, FALSE, 500, REPLY_NOPARAM(token))); else if (cmd->parameters[0] == 0) return(ftp_write(peer, FALSE, 500, REPLY_NOPARAM(token))); } if ((cmd->command->needslogin) && (peer->loggedin != TRUE)) return(ftp_write(peer, FALSE, 530, REPLY_NOLOGIN)); if ((!cmd->command->dataportok) && (peer->dport)) return(ftp_write(peer, FALSE, 520, REPLY_DATACONNINVALID(token))); else return(cmd->command->ftpfunc(peer, cmd->parameters)); } int ftp_quit(FTPSTATE *peer, char *param) { if (peer->quitdump) { NEWFILE *nfile = nfopen(peer->quitdump); ftp_dumper(peer, nfile, 221, REPLY_QUIT, TRUE, FALSE); } else if (peer->quitdumpdata) ftp_dumpstr(peer, peer->quitdumpdata, 221, REPLY_QUIT, FALSE); else ftp_write(peer, FALSE, 221, REPLY_QUIT); return(TRUE); } int ftp_user(FTPSTATE *peer, char *param) { if (peer->jailenabled) return(ftp_write(peer, FALSE, 530, REPLY_JAILUSER)); if (peer->loginsleft == 0) return(ftp_write(peer, FALSE, 530, REPLY_NOCREDITS)); if (peer->loggedin) shinfo_delusergroup(peer->groupname); shinfo_changeuser(param); peer->loggedin = 0; freewrapper(peer->username); peer->username = strdupwrapper(param); return(ftp_write(peer, FALSE, 331, REPLY_USER(peer->username))); } int ftp_host_compat(FTPSTATE *peer) { VSERVER *v; char *name; /* if there are no vservers, or hostname vservers are not defined, return with not implemented */ if ((!config->vservers) || (!config->hostvservers)) return(1); /* if a vserver has already been selected, return 530 */ if (peer->vserver != config->defaults) return(1); name = strchr(peer->username, '%'); if (!name) v = config->defaulthost; else { *name = 0; name++; if (config->defaulthost && (host_isip(name))) v = config->defaulthost; else v = find_vserver_byname(name); } if (!v) return(0); switch(vserver_select(peer, v)) { case 1: case 2: return(0); case 3: return(2); } return(1); } int ftp_pass(FTPSTATE *peer, char *param) { int result = FALSE; int loginok, oldnice = peer->nicevalue; int toomany = FALSE; char *errmsg = NULL; switch(ftp_host_compat(peer)) { case 0: return(ftp_write(peer, FALSE, 530, REPLY_LOGINFAIL(peer->username, "Bad password"))); case 2: ftp_write(peer, FALSE, 421, REPLY_TOOMANYUSERS); return(TRUE); } if (peer->loggedin) return(ftp_write(peer, FALSE, 530, REPLY_ALREADYLOGGEDIN)); if (strcmp(peer->username, "") == 0) return(ftp_write(peer, FALSE, 503, REPLY_USEUSERFIRST)); loginok = (param != NULL); if (loginok) { file_becomeroot(peer); setgroups(0, NULL); errmsg = setuseropts(peer, param); loginok = (errmsg == NULL); } /* check some stuff, set basedir to real pathname */ if (loginok) { file_becomeuser(peer); if (chdir(peer->basedir) == -1) { loginok = FALSE; log_giveentry(MYLOG_INFO, NULL, safe_snprintf("rootdir(%s) for user '%s' is not accessable. Check rootdir and rootdir permissions", peer->basedir, peer->username)); } else { char *curdir = getcwd2(); if (strcmp(curdir, peer->basedir) != 0) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("rootdir changed from '%s' to '%s', symbolic links resolved for user '%s'", peer->basedir, curdir, peer->username)); freewrapper(peer->basedir); peer->basedir = curdir; } else freewrapper(curdir); } file_becomeroot(peer); } if (loginok) { peer->usercount = toomany = shinfo_addusergroup(peer->groupname, peer->maxusers); toomany = (toomany == -1); if (toomany) loginok = FALSE; } if (loginok) { char *outstr; NEWFILE *nfile; log_addentry(MYLOG_LOGIN, peer, "Login successful."); outstr = safe_snprintf(REPLY_PASSOK(peer->username)); /* perform chroot if needed */ if (peer->chroot) dochroot(peer); if (nice(peer->nicevalue + (-oldnice)) == -1) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("nice(%d) gave error %s", peer->nicevalue + (-oldnice), strerror(errno))); peer->nicevalue = oldnice; } if (config->rootmode) setgroups(peer->supgids[0], peer->supgids + 1); /* see if rootdir == "/", change to "" */ if (peer->basedir[1] == 0) peer->basedir[0] = 0; if ((peer->droproot) && (config->rootmode)) { if (giveuproot(peer->uidt_asuid, peer->gidt_asgid)) log_addentry(MYLOG_INFO, peer, "Failed to set capabilities!"); peer->jailenabled = TRUE; /* we are not root anymore and can never be root again! */ config->rootmode = FALSE; } file_becomeuser(peer); nfile = nfopen(peer->logindump); peer->pwd = strdupwrapper(peer->basedir); dir_combine(peer, &(peer->pwd), peer->homedir); if (peer->logindumpdata) result = ftp_dumpstr(peer, peer->logindumpdata, 230, outstr, FALSE); else result = ftp_dumper(peer, nfile, 230, outstr, TRUE, FALSE); freewrapper(outstr); } else { peer->loggedin = FALSE; log_addentry(MYLOG_LOGIN, peer, "Login failed"); peer->timeout = peer->vserver->timeout; if (toomany) { NEWFILE *nfile = nfopen(peer->busydump); logfullmessage(GROUPFULL, peer->remoteip); if (peer->busydumpdata) ftp_dumpstr(peer, peer->busydumpdata, 421, REPLY_TOOMANYUSERS, FALSE); else ftp_dumper(peer, nfile, 421, REPLY_TOOMANYUSERS, TRUE, FALSE); } else { usleep(peer->vserver->authwait); if (errmsg == NULL) errmsg = strdupwrapper("Bad password"); result = ftp_write(peer, FALSE, 530, REPLY_LOGINFAIL(peer->username, errmsg)); if (peer->loginsleft > 0) peer->loginsleft--; freewrapper(errmsg); } freewrapper(peer->username); peer->username = strdupwrapper(""); } if (toomany) return(TRUE); /* quit */ return(3); /* make sure timeout gets updated */ } int ftp_rest(FTPSTATE *peer, char *param) { off_t newpos; int res; res = strto_offt(param, &newpos); if ((res != 0) || (newpos < 0)) return(ftp_write(peer, FALSE, 501, REPLY_INVALIDREST)); else { peer->restartpos = newpos; return(ftp_write(peer, FALSE, 350, REPLY_RESTOK(peer->restartpos))); } } int ftp_syst(FTPSTATE *peer, char *param) { return(ftp_write(peer, FALSE, 215, "UNIX Type: L8")); } int ftp_port(FTPSTATE *peer, char *param) { if (peer->epsv_forced) return(ftp_write(peer, FALSE, 500, REPLY_EPSVSET)); /* reset remoteport */ peer->remoteport = 0; if (peer->passiveport) { select_delfd(peer->sel, peer->passiveport); peer->passiveport = 0; } if (readipstr(param, &(peer->remoteport), &(peer->dataip))) { if ((peer->remoteport <= 1024) || (peer->remoteport >= 65536)) { peer->remoteport = 0; return(ftp_write(peer, FALSE, 500, REPLY_PORTBADPORT)); } if ((peer->dataip != peer->remoteip) && (!peer->fxpallow)) { peer->remoteport = 0; peer->dataip = peer->remoteip; return(ftp_write(peer, FALSE, 500, REPLY_PORTBADFXP)); } return(ftp_write(peer, FALSE, 200, REPLY_PORTOK( peer->dataip >> 24, peer->dataip >> 16 & 255, peer->dataip >> 8 & 255, peer->dataip & 255, peer->remoteport))); } else return(ftp_write(peer, FALSE, 501, REPLY_PORTBADPARM)); } int ftp_eprt(FTPSTATE *peer, char *param) { char *ipstr; int proto, tcpport; unsigned int remote_ip; if (peer->epsv_forced) return(ftp_write(peer, FALSE, 500, REPLY_EPSVSET)); ipstr = mallocwrapper(strlen(param) + 1); /* clear off old ports */ peer->remoteport = 0; if (peer->passiveport) { select_delfd(peer->sel, peer->passiveport); peer->passiveport = 0; } if (sscanf(param, "|%d|%[0-9.]|%d|", &proto, ipstr, &tcpport) != 3) ftp_write(peer, FALSE, 500, REPLY_EPRTBADPARM); else if (proto != FTP_IPV4) ftp_write(peer, FALSE, 522, REPLY_BADPROTO); else if (!readeipstr(ipstr, &(remote_ip))) ftp_write(peer, FALSE, 500, REPLY_EPRTBADPARM); else if (tcpport <= 1024) ftp_write(peer, FALSE, 500, REPLY_EPRTBADPORT); else if ((remote_ip != peer->remoteip) && (!peer->fxpallow)) ftp_write(peer, FALSE, 500, REPLY_EPRTBADFXP); else { /* everything seems to be ok */ peer->remoteport = tcpport; peer->dataip = remote_ip; ftp_write(peer, FALSE, 200, REPLY_EPRTOK( peer->dataip >> 24, peer->dataip >> 16 & 255, peer->dataip >> 8 & 255, peer->dataip & 255, peer->remoteport)); } freewrapper(ipstr); return(FALSE); } int ftp_pwd(FTPSTATE *peer, char *param) { return(ftp_cwddo(peer, ".", FALSE)); } int ftp_type(FTPSTATE *peer, char *param) { if ((param[0] & (255-32)) == 'A') { peer->binary = FALSE; return(ftp_write(peer, FALSE, 200, REPLY_TYPEASCII)); } else if ((param[0] & (255-32)) == 'I') { peer->binary = TRUE; return(ftp_write(peer, FALSE, 200, REPLY_TYPEBINARY)); } else return(ftp_write(peer, FALSE, 504, REPLY_TYPEUNIMP)); } int ftp_abor(FTPSTATE *peer, char *param) { /* abort any active or pending data port */ abortdatasocket(peer); return(ftp_write(peer, FALSE, 226, REPLY_ABORT)); } int ftp_pasv(FTPSTATE *peer, char *param) { unsigned int a1, a2, a3, a4, a5, a6; if (peer->epsv_forced) return(ftp_write(peer, FALSE, 500, REPLY_EPSVSET)); if (peer->passiveport != 0) select_delfd(peer->sel, peer->passiveport); peer->remoteport = 0; peer->passiveport = listenparrelelport(peer->remotefd, &(peer->remoteport), &a1, 5); if (peer->passiveport == -1) { peer->passiveport = 0; reporterror(peer, "passive port", errno); return(FALSE); } select_addfd(peer->sel, peer->passiveport); a2 = ((a1 >> 8) & 255); a3 = ((a1 >> 16) & 255); a4 = ((a1 >> 24) & 255); a1 = a1 & 255; a5 = (peer->remoteport >> 8); a6 = (peer->remoteport & 255); return(ftp_write(peer, FALSE, 227, REPLY_PASV(a4, a3, a2, a1, a5, a6))); } int ftp_epsv(FTPSTATE *peer, char *param) { int proto, a1; /* the all parameter means that only epsv can be used from now on */ if (peer->passiveport != 0) select_delfd(peer->sel, peer->passiveport); peer->remoteport = 0; peer->passiveport = 0; if (param) { if (strcasecmp(param, "ALL") == 0) { peer->epsv_forced = 1; return(ftp_write(peer, FALSE, 200, REPLY_EPSVON)); } else if (sscanf(param, "%d", &proto) == 1) { if (proto != FTP_IPV4) return(ftp_write(peer, FALSE, 522, REPLY_BADPROTO)); } else return(ftp_write(peer, FALSE, 500, REPLY_EPSVERR)); } peer->passiveport = listenparrelelport(peer->remotefd, &(peer->remoteport), &a1, 5); if (peer->passiveport == -1) { peer->passiveport = 0; reporterror(peer, "passive port", errno); return(FALSE); } select_addfd(peer->sel, peer->passiveport); return(ftp_write(peer, FALSE, 229, REPLY_EPSV(peer->remoteport))); } int ftp_list(FTPSTATE *peer, char *param) { char *p = param; int done = FALSE; int parm = 0; while (!done) { if (p == NULL) done = TRUE; else if ((p[0] != '-') && (p[0] != ' ') && (p[0] != 0)) done = TRUE; else { parm = parm | ftplist_parseflags(p + 1); p = strchr(p, ' '); if (p != NULL) p++; } } return(ftp_lister(peer, p, FALSE, parm)); } int ftp_nlst(FTPSTATE *peer, char *param) { char *p = param; int done = FALSE; int parm = 0; while (!done) { if (p == NULL) done = TRUE; else if ((p[0] != '-') && (p[0] != ' ') && (p[0] != 0)) done = TRUE; else { parm = parm | ftplist_parseflags(p + 1); p = strchr(p, ' '); if (p != NULL) p++; } } return(ftp_lister(peer, p, TRUE, parm)); } int ftp_cdup(FTPSTATE *peer, char *param) { return(ftp_cwd(peer, "..")); } int ftp_rnfr(FTPSTATE *peer, char *param) { freeifnotnull(peer->renameoldname); peer->renameoldname = file_expand(peer, param); return(ftp_write(peer, FALSE, 350, REPLY_RENAMESOURCE)); } int ftp_noop(FTPSTATE *peer, char *param) { return(ftp_write(peer, FALSE, 200, REPLY_NOOP)); } int ftp_rein(FTPSTATE *peer, char *param) { if (peer->jailenabled) return(ftp_write(peer, FALSE, 530, REPLY_JAILUSER)); if (peer->loggedin) shinfo_delusergroup(peer->groupname); peer->loggedin = FALSE; abortdatasocket(peer); return(ftp_write(peer, FALSE, 220, "Reinitialize successful, enter username.")); } int ftp_none(FTPSTATE *peer, char *param) { return(FALSE); } int ftp_help(FTPSTATE *peer, char *param) { return(ftp_dohelp(peer, mainftpcmd, param, peer->cmddisableset)); } int ftp_dohelp(FTPSTATE *peer, FTPCMD *ftpcmds, char *command, int *disableset) { char outstr[128]; char cmd[10]; int result = FALSE; int count2,count = 0; if (command != NULL) { while(((strcasecmp(ftpcmds[count].command, command) != 0) && (ftpcmds[count].ftpfunc != NULL)) || (peer->loggedin ? disableset[count] : ftpcmds[count].needslogin)) count++; if (ftpcmds[count].ftpfunc == NULL) ftp_write(peer, FALSE, 502, REPLY_HELPUNKNOWN(command)); else ftp_write(peer, FALSE, 214, "%-8s : %s", ftpcmds[count].command, ftpcmds[count].helpdesc); return(FALSE); } ftp_write(peer, TRUE, 0, REPLY_HELPSTART); while (ftpcmds[count].ftpfunc != NULL) { count2 = 0; if (config->altlongreplies) strcpy(outstr, "214-"); else strcpy(outstr, " "); /* now increment past disabled commands */ while((peer->loggedin ? disableset[count] : ftpcmds[count].needslogin)) count++; while ((count2 < 7) && (ftpcmds[count].ftpfunc != NULL)) { snprintf(cmd, 10, "%-9s", ftpcmds[count].command); strcat(outstr, cmd); count2++; count++; /* now increment past disabled commands */ while((peer->loggedin ? disableset[count] : ftpcmds[count].needslogin)) count++; } ftp_write(peer, TRUE, 0, outstr); } result = ftp_write(peer, FALSE, 214, REPLY_HELPEND(peer->vserver->email)); return(result); } int ftp_allo(FTPSTATE *peer, char *param) { return(ftp_write(peer, FALSE, 202, REPLY_ALLO)); } int ftp_acct(FTPSTATE *peer, char *param) { return(ftp_write(peer, FALSE, 200, REPLY_ACCT)); } int ftp_stru(FTPSTATE *peer, char *param) { if ((param[0] & (255-32)) == 'F') return(ftp_write(peer, FALSE, 200, REPLY_STRUFILE)); else return(ftp_write(peer, FALSE, 500, REPLY_STRUUNKNOWN)); } muddleftpd-1.3.13.1/src/ftpcmd.h0100644000175000017500000000475007737077256015334 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ int ftp_none(FTPSTATE *peer, char *param); int ftp_dele(FTPSTATE *peer, char *filename); int ftp_size(FTPSTATE *peer, char *filename); int ftp_mdtm(FTPSTATE *peer, char *filename); int ftp_rnto(FTPSTATE *peer, char *filename); int ftp_mkd(FTPSTATE *peer, char *filename); int ftp_rmd(FTPSTATE *peer, char *filename); int ftp_retr(FTPSTATE *peer, char *filename); int ftp_stor(FTPSTATE *peer, char *filename); int ftp_stou(FTPSTATE *peer, char *filename); int ftp_appe(FTPSTATE *peer, char *filename); int ftp_quit(FTPSTATE *peer, char *param); int ftp_user(FTPSTATE *peer, char *param); int ftp_pass(FTPSTATE *peer, char *param); int ftp_rest(FTPSTATE *peer, char *param); int ftp_syst(FTPSTATE *peer, char *param); int ftp_port(FTPSTATE *peer, char *param); int ftp_pwd(FTPSTATE *peer, char *param); int ftp_type(FTPSTATE *peer, char *param); int ftp_cwd(FTPSTATE *peer, char *param); int ftp_abor(FTPSTATE *peer, char *param); int ftp_pasv(FTPSTATE *peer, char *param); int ftp_list(FTPSTATE *peer, char *param); int ftp_nlst(FTPSTATE *peer, char *param); int ftp_cdup(FTPSTATE *peer, char *param); int ftp_rnfr(FTPSTATE *peer, char *param); int ftp_dump(FTPSTATE *peer, char *param); int ftp_noop(FTPSTATE *peer, char *param); int ftp_rein(FTPSTATE *peer, char *param); int ftp_help(FTPSTATE *peer, char *param); int ftp_allo(FTPSTATE *peer, char *param); int ftp_acct(FTPSTATE *peer, char *param); int ftp_stru(FTPSTATE *peer, char *param); int ftp_host(FTPSTATE *peer, char *param); int ftp_epsv(FTPSTATE *peer, char *param); int ftp_eprt(FTPSTATE *peer, char *param); int ftpsite_dump(FTPSTATE *peer, char *cmd); int ftpsite_umask(FTPSTATE *peer, char *cmd); int ftpsite_help(FTPSTATE *peer, char *cmd); int ftpsite_chmod(FTPSTATE *peer, char *cmd); int ftpsite_access(FTPSTATE *peer, char *cmd); int ftpsite_idle(FTPSTATE *peer, char *cmd); muddleftpd-1.3.13.1/src/ftpd.h0100644000175000017500000006130207751225317014775 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Includes */ #ifndef DEBUG /* If we are not debuging, disable assertions! */ #define NDEBUG #endif #include "../config.h" /* Insert the config header */ #include "../defaults.h" /* insert default info */ #include /* enable assertions */ #include "myglob.h" /* use our simple glob */ #include "util/strerror.h" #include #ifdef HAVE_SYS_CAPABILITY_H #include #undef WNOHANG #undef WUNTRACED #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_DLFCN_H #include #endif #ifdef HAVE_CRYPT_H #include #endif #ifdef HAVE_GETSPNAM #include #endif #ifndef INT_MAX #define INT_MAX 0x7FFFFFFF #endif #include "pnums.h" #include "configfile.h" #include "acl.h" #include "tokset.h" #include "ratio.h" #include "string.h" /* Inportant Constants */ #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE !FALSE #endif #define SYSLOG 1 #define TERMINAL 2 #define MUDLOG 3 #define MYLOG_DACCESS 1 #define MYLOG_FTRANS 2 #define MYLOG_COMMAND 4 #define MYLOG_RESPONSE 8 #define MYLOG_INFO 16 #define MYLOG_LOGIN 32 #define MYLOG_DEBUG 64 #define TRANS_LIST 1 #define TRANS_UPLOAD 2 #define TRANS_DOWNLOAD 3 #define TRANS_SUPLOAD 4 #define TRANS_RUNNING 5 /* used in authentication modules */ #define AUTH_OK 0 #define AUTH_USERNKNOW 1 #define AUTH_ERROR 2 /* used for config errors */ #define CONFIG_OK 0 #define CONFIG_HANDLER_ERROR 1 #define CONFIG_FILE_UNSAFE 2 #define CONFIG_FILE_ERROR 3 #define CFC_INCLUDE_ERROR 10 #define CFC_SECTION_NONE 11 #define CFC_SECTION_EXISTS 12 #define CFC_NO_SECTION 13 #define CFC_INCLUDE_LOOP 14 /* used to define maximum IP address size (for ipv6 support) */ #define MAX_IPSIZE 16 #define FTP_IPV4 1 #define FTP_IPV6 2 /* DO NOT CHANGE THESE DEFINES. THEY ARE REQUIRED CONSTANTS */ #define CR 13 #define LF 10 /* Macros */ #define MAXIMUM(x, y) ((x) > (y) ? (x) : (y)) #define MINIMUM(x, y) ((x) > (y) ? (y) : (x)) #define ERRORMSG(x) errormsg(x, __FILE__, __LINE__) #define ERRORMSGFATAL(x) errormsgfatal(x, __FILE__, __LINE__) #ifndef FNM_PATHNAME #define FNM_PATHNAME 1 #endif /* this specifies that the operation cannot be stopped by a signal */ #define NOSIGNALINTR(x) while(((x) == -1) && (errno == EINTR)) /* Typedefs */ typedef unsigned int ipaddr_mt[MAX_IPSIZE]; typedef struct { int fd; STRING *buffer; int eof; } NEWFILE; typedef struct strcache { int size; struct { int num; char *str; } data[STRCACHESIZE]; } STRCACHE; struct selector; struct selectorobj { int (* readsockopt)(struct selector *, int, void *); int (* writesockopt)(struct selector *, int,void *); void *readdata; void *writedata; int next; /* linked list of file descriptors */ int last; }; typedef struct selector { fd_set readset; fd_set writeset; struct selectorobj **fdtable; int firstfd; int maxfds; int smax; } SELECTER; typedef struct limiter { int maxspeed; struct timeval current_time; int bytes_transfered; } LIMITER; typedef struct { int pos; MYGLOBDATA *dirdata; int nlist; int recursive; int all; STRCACHE *uidcache; STRCACHE *gidcache; char *dir; char *rdir; int odirlen; int numsubdirs; char **subdirs; unsigned int year; /* this is stored as 4 chars */ } LISTHANDLE; typedef struct dataport { int filefd; int socketfd; off_t pos; off_t startpos; off_t tsize; STRING *buffer; LISTHANDLE *lhandle; int trans_type; int binary; int passive; off_t transbytes; LIMITER *download_limiter; LIMITER *upload_limiter; } DATAPORT; typedef struct { unsigned int ipaddr; unsigned int netmask; char *fnstr; int type; int accept; } IPACL; typedef struct { int count; IPACL *list; } IPACLLIST; typedef struct vserver { IPACLLIST *ipaccess; int maxusers; int loglevel; int timeout; char *logfile; char *email; int logincount; int authwait; int umask; int maxperip; char *sectionname; char **grouplist; char *vhostname; char *prelogindump; char *prelogindumpdata; char *greetline; char *toobusy; struct vserver *next; } VSERVER; typedef struct vserverconn { int port; int ip; int fd; VSERVER *vptr; struct vserverconn *next; } VSERVERCONN; typedef struct configdata { CONFIGFILECACHE *configfile; pid_t parentpid; /* the pid to signal when an fatal error occurs */ int rootmode; /* are we in root mode or not */ int logout; /* log context */ uid_t uidt_asuid; /* change to this user after listening to port */ gid_t gidt_asgid; int toobusycount; /* number of connections being given too busy messages by main thread */ char *username; /* the username muddleftpd will run as */ uid_t uidt_nobodyuid; /* uid for user nobody */ gid_t gidt_nobodygid; /* gid for user nobody */ int inetd; /* are we running as inetd */ int hostvservers; /* are we running with hostname only virtual servers */ int dnstimeout; /* maximum time to wait for reversedns */ int altlongreplies; /* use alternate long replies, more compatible with crappy clients */ int smartbind; /* specifies whether to search for effecient fd usage, or correct binding */ int zerobind; /* bind all ports using address 0.0.0.0, use with smartbind on Freebsd to use virtual servers */ char *hostname; /* Computer host name */ VSERVER *defaults; /* Default values for VSERVER */ VSERVER *defaulthost; /* The default host for hostvservers */ char **vserverlist; /* list of virtual servers names */ VSERVER *vservers; /* virtual server list */ VSERVERCONN *inports; /* input ports */ } CONFIGDATA; typedef struct ftpstate { int remotefd; /* fd of the port to the remote system */ unsigned int remoteip; /* the systems IP number */ int connport; /* port connected to */ char *username; /* the username of the ftp user */ char *pwd; /* the current dir the ftp user is in */ char *homedir; /* the home directory of the ftp user */ char *basedir; /* the / directory for that user */ int passiveport; /* the fd of the listening passive port */ char *renameoldname; /* the source file to rename */ int loggedin; /* true if the user is logged in */ off_t restartpos; /* the position to start a download or upload */ int remoteport; /* the port number to connect to for data conns */ int binary; /* true if binary mode is set */ int threadnum; /* the number of the thread in ftpd terms (not pid) */ int *cmddisableset; /* a set of integers used to disable commands */ int *sitedisableset; /* a set of integers used to disable site commands */ STRING *inbuffer; /* the input buffer */ char *logindump; /* file to print after login */ char *cwddump; /* dump this file when you move to this dir */ char *busydump; /* dump this file if too many users are logged in */ char *quitdump; /* dump this file when the user quits */ char *logindumpdata; /* this is for login dump */ char *cwddumpdata; /* this is when we change dir */ char *busydumpdata; /* this is when we are too busy */ char *quitdumpdata; /* this is when we quit */ ACLLIST *acldata; /* The access lists for this user */ int umask; /* the umask of newly created files */ gid_t gidt_asgid; /* all file work is done as this gid (if possible) */ uid_t uidt_asuid; /* all file work is done as this uid (if possible) */ int maxusers; /* maximum instances of this user allowed to be logged in */ int maxtimeout; /* maximum time out for this user */ int timeout; /* timeout for this user */ int chmodable; /* can do chmod and change umask */ SELECTER *sel; /* select data stored here */ DATAPORT *dport; /* Data port information */ int loginsleft; /* number of login attempts left */ int jailenabled; /* is this user a jail */ int chroot; /* does a chroot occur */ int droproot; /* do we drop root when logging in */ int nicevalue; /* what niceness to run as */ int realdir; /* use real directory instead of built up name */ int fxpallow; /* allow fxp(server-server) transfers */ int usercount; /* the number of users in the current group when the user logged on */ char *hostname; /* the hostname of the remote host */ int accessdevices; /* can the user access device files */ char *groupname; int fakemode; char *fakename; char *fakegroup; VSERVER *vserver; /* vserver the user is connected to */ RATIOHANDLE *ratioinfo; /* ratio info */ gid_t *supgids; /* user supplementary gids */ unsigned int dataip; /* ip to connect data port to */ STRING *outbuffer; /* output coalessing buffer */ int maxtranspd; /* Maximum transfer speed */ int maxtranspd_down; /* Maximum download speed, overrides maxtranspd */ int maxtranspd_up; /* Maximum upload speed, overrides maxtranspd */ int epsv_forced; /* EPSV ALL was called, deny everything else */ /* Counters for stats */ int downloadedfiles; int uploadedfiles; off_t downloadedfilebytes; off_t uploadedfilebytes; off_t listdownloadedbytes; int listconns; } FTPSTATE; typedef struct ftpcmd { char *command; int (* ftpfunc)(FTPSTATE *peer, char *params); int paramnum; int needslogin; int dataportok; char *helpdesc; } FTPCMD; typedef struct inputline { FTPCMD *command; char *parameters; } INPUTLINE; /* GLOBAL VARIABLES */ CONFIGDATA *config; /* configuration data stored here for easy access */ int inetd; /* is process running as inetd */ int logerrors; /* do we log config errors to screen, syslog, or screen */ /* these prototypes are mostly auto generated by scribe */ /* procnum.h */ void writescratch(int pos, int size, char *buff); void writeshmem(int num, int pos, int len, void *buff); void shinfo_addtogrouplist(VSERVER *vs); void shinfo_setuparea(void); void shinfo_init(char *scfilename); void inetd_init(char *scfile); void shinfo_reinit(void); int shinfo_addstandalone(int newthid, char *vservername, unsigned int ip, int viplimit, int iplimit); int shinfo_adduser_inetd(unsigned int ip, int slimit, int iplimit, int *error); int shinfo_adduser(char *vserver, unsigned int ip, int vlimit, int slimit, int viplimit, int iplimit); int shinfo_setvserver(int thid, char *vservername, unsigned int ip, int vlimit, int viplimit, int *error); int shinfo_newuser_standalone(unsigned int ip, int iplimit, int *error); void shinfo_changeop(char *operation); void shinfo_changeuser(char *username); void shinfo_sethost(char *hostname); int shinfo_addusergroup(char *groupname, int limit); void shinfo_setpid(int thrid, int pid); void shinfo_delbypid(int pid); void shinfo_delusergroup(char *groupname); void shinfo_freebynum(int threadnum); void shinfo_freethreads(int freecount, pid_t *freelist); void pnums_signalchildren(int signalnum); void shinfo_shutdown(void); /* socket.h */ char *getipstr(unsigned int server); void takentoolong(int sig); char *getnetworkstr(unsigned int server); int getnetworkint(char *server, unsigned int *out); int conn_server(unsigned int ip, int port); int conn_server_nonblocking(unsigned int ip, int port, int localport, int fd); int listenport(int port, unsigned int ip, int maxconnect); int get_conn(int socketin, unsigned int *addr); int listenparrelelport(int fd, int *port, unsigned int *ip, int maxconnect); void getsockinfo(int fd, unsigned int *ip, int *port); unsigned int getremoteip(int fd); void socket_flush_wait(int fd, int timeout); /* select.h */ SELECTER *select_new(void); void select_addfd(SELECTER *sel, int newport); void select_delfd(SELECTER *sel, int deadport); void select_addread(SELECTER *sel, int port, int (* proc)(SELECTER *, int, void *), void *dat); void select_addwrite(SELECTER *sel, int port, int (* proc)(SELECTER *, int, void *), void *dat); void select_takeread(SELECTER *sel, int port); void select_takewrite(SELECTER *sel, int port); int select_do(SELECTER *sel, int *signum, int timeout); void select_shutdown(SELECTER *sel); /* ftpsite.h */ int ftp_site(FTPSTATE *peer, char *cmd); int ftpsite_dump(FTPSTATE *peer, char *cmd); int ftpsite_umask(FTPSTATE *peer, char *cmd); int ftpsite_help(FTPSTATE *peer, char *cmd); int ftpsite_idle(FTPSTATE *peer, char *cmd); int ftpsite_chmod(FTPSTATE *peer, char *cmd); int ftpsite_access(FTPSTATE *peer, char *cmd); /* proxy.h */ int controlportgotdata(SELECTER *sel, int fd, void *peerdata); char *remove_rootcomponent(FTPSTATE *peer, char *filename, char *descript); void dochroot(FTPSTATE *peer); void rotatelogs(FTPSTATE *peer); void ftpserverside_main(int remotefd, int remoteip, int threadnum, int portnum, VSERVER *vserver); int inport_bind(int portid, unsigned int bindip, int dodie); int inport_getconn(SELECTER *mainsel, int fd, void *vs); int vserver_select(FTPSTATE *peer, VSERVER *vserver); /* version.h */ void showversion(char *desc); /* acl.h */ ACLLIST *acllist_create(void); char *acllist_makepermstr(ACLLIST *acl, int cnt, char *ret); void acllist_add(ACLLIST *acl, char *dir, char *attribs, int is_regexp); void acllist_tokendo(ACLLIST *acl, TOKENSET *tset); int acllist_check(ACLLIST *acl, char *dir, int attr); int check_acl(FTPSTATE *peer, char *path, int perm); void acllist_dest(ACLLIST *acl); /* ftpout.h */ void control_timeout(int num); int ftp_write(FTPSTATE *peer, int bare, int messnum, char *fmt, ...); /* utils.h */ void *mallocwrapper(int size); void reallocwrapper(int size, void **inarea); char *strdupwrapper(char *s); void freewrapper(void *tofree); void freeifnotnull(void *); char *offt_tostr(off_t size); int strto_offt(char *str, off_t *ret); #ifndef HAVE_MEMMOVE void *memmove(void *, const void *, int); #endif void strtrimspace(char *string); int strchrcount(char *string, char tok); char *safe_vsnprintf(int size, char *format, va_list ap); char *safe_snprintf(char *format, ...); char *getcwd2(void); void pathname_simplify(char *pathname); void test_libc(int verbose); #ifndef HAVE_USLEEP int usleep(int usecs); #endif STRCACHE *strcache_new(void); char *strcache_check(STRCACHE *cache, int num); void strcache_add(STRCACHE *cache, int num, char *str); void strcache_free(STRCACHE *cache); TOKENSET *tokenset_new(void); void tokenset_settoken(TOKENSET *tset, unsigned char tok, char *data); void tokenset_deltoken(TOKENSET *tset, unsigned char tok); char *tokenset_apply(TOKENSET *tok, char *inputstr, int); void tokenset_finish(TOKENSET *tset); void init_pwgrfiles(void); char *get_passwdname(uid_t inuid, int usefile); char *get_groupname(gid_t ingid, int usefile); gid_t *getusergrouplist(char *username); gid_t *newgidlist(void); gid_t *addgidlist(gid_t *list, gid_t new); void delgidlist(gid_t *list, gid_t old); gid_t *parsegidlist(char *str); char *makegidliststr(gid_t *list); void kill_uidgidfiles(void); int isfilesafe(int fd); LIMITER *limiter_new(int maxspeed); void limiter_add(LIMITER *l, int byte_count, int force); int giveuproot(uid_t uid, gid_t gid); void errormsg( char *errmessage, char *file, int line ); void errormsgfatal( char *errmessage, char *file, int line ); void blockallsignals( void ); void unblockallsignals( void ); /* init.h */ void ftpd_setnogroups(void); void ftpd_preinit(void); void ftpd_init(char *filename, int verbose); /* ftp.h */ void reporterror(FTPSTATE *peer, char *filename, int errorno); int readipstr(char *data, int *port, unsigned int *ip); int ftp_dele(FTPSTATE *peer, char *filename); int ftp_chmod(FTPSTATE *peer, char *filename, int mode); int ftp_size(FTPSTATE *peer, char *filename); int ftp_mdtm(FTPSTATE *peer, char *filename); void setdumptokens(FTPSTATE *peer, TOKENSET *ts); int ftp_dumper(FTPSTATE *peer, NEWFILE *infile, int number, char *fmessage, int dotokens, int endtokens); int ftp_dumpstr(FTPSTATE *peer, char *dumpstr, int number, char *fmessage, int endtokens); int ftp_rnto(FTPSTATE *peer, char *filename); int ftp_mkd(FTPSTATE *peer, char *filename); int ftp_rmd(FTPSTATE *peer, char *filename); int ftp_cwddo(FTPSTATE *peer, char *newdir, int dump); int ftp_cwd(FTPSTATE *peer, char *newdir); int ftp_run(FTPSTATE *peer, INPUTLINE *cmd, char *token); int ftp_quit(FTPSTATE *peer, char *param); int ftp_user(FTPSTATE *peer, char *param); int ftp_pass(FTPSTATE *peer, char *param); int ftp_rest(FTPSTATE *peer, char *param); int ftp_syst(FTPSTATE *peer, char *param); int ftp_port(FTPSTATE *peer, char *param); int ftp_pwd(FTPSTATE *peer, char *param); int ftp_type(FTPSTATE *peer, char *param); int ftp_abor(FTPSTATE *peer, char *param); int ftp_pasv(FTPSTATE *peer, char *param); int ftp_list(FTPSTATE *peer, char *param); int ftp_nlst(FTPSTATE *peer, char *param); int ftp_cdup(FTPSTATE *peer, char *param); int ftp_rnfr(FTPSTATE *peer, char *param); int ftp_noop(FTPSTATE *peer, char *param); int ftp_rein(FTPSTATE *peer, char *param); int ftp_none(FTPSTATE *peer, char *param); int ftp_help(FTPSTATE *peer, char *param); int ftp_dohelp(FTPSTATE *peer, FTPCMD *ftpcmds, char *command, int *disableset); int ftp_allo(FTPSTATE *peer, char *param); int ftp_acct(FTPSTATE *peer, char *param); int ftp_stru(FTPSTATE *peer, char *param); /* ftpstat.h */ int ftp_stat(FTPSTATE *peer, char *param); /* cmd.h */ int *disableset_create(void); void disableset_disablecmd(int *set, FTPCMD *ctable, char *cmd); char *getkeyword(char **iline); void cmd_split(FTPSTATE *peer, INPUTLINE *cmd, char* inpline, FTPCMD *ctable, int log, int *disableset); /* logger.h */ int log_initcontext(char *logname); void log_setcontext(int logfd, int logmask); void log_addentry(int type, FTPSTATE *peer, char *desc); void log_giveentry(int type, FTPSTATE *peer, char *desc); void debuglog(char *format, ...); void log_shutdown(void); /* dir.h */ char *dir_getreal(FTPSTATE *peer); char *dir_getvirtual(FTPSTATE *peer, char *); void dir_combine(FTPSTATE *peer, char **pwd, char *newdir); /* shmem.h */ void shmem_finish(int shmemnum); void *shmem_get(char *ipcfile, int size, int *shmemnum, int *isnew, int *lockfd); /* ftplist.h */ int ftplist_parseflags(char *params); char *listmakeline(FTPSTATE *peer, char *longname, char *filename, struct stat *fileinfo, STRCACHE *uidcache, STRCACHE *gidcache, int year); LISTHANDLE *getlisthandle(FTPSTATE *peer, char *dirpattern, int nlist, char *reldir, int params); char *getlisthandleline(FTPSTATE *peer, LISTHANDLE *lh); void freelisthandle(LISTHANDLE *lh); int list_write(SELECTER *sel, int fd, void *peerv); char *listmakepattern(FTPSTATE *peer, char *parm, char **rdir, int flags); int ftp_lister(FTPSTATE *peer, char *parm, int nlist, int params); /* checkip.h */ int checknamelist(CONFIGFILECACHE *cf, int section, char *username); IPACLLIST *ipacllist_new(CONFIGFILECACHE *cf, int section, char *name); void ipacllist_destroy(IPACLLIST *list); int user_allowed(IPACLLIST *list, int ip, char *hostname); /* ftpstate.h */ void ftpstate_init(FTPSTATE *ftp, int fd, int ip, int threadnum, int portnum, VSERVER *vs); void ftpstate_dest(FTPSTATE *ftp); /* bufread.h */ int popcmd(FTPSTATE *peer, char **outstr); int readcmd(FTPSTATE *peer); /* config.h */ int loadconfigfile(char *filename, int (* confighandler)(char *, char *, int, void *), void *configdata, int bescure, int *handlererror, int *linenum); int cachemaker(char *cmd, char *data, int linenum, void *c); CONFIGFILECACHE *loadconfigcache(char *filename, int *linenum, int *error); char *config_errorstr(int result); int getsectionid(CONFIGFILECACHE *cache, char *section); char *getconfigdata_r(CONFIGFILECACHE *cache, int section, char *cmd, int *occur, int depth, int *error); char *getconfigdata(CONFIGFILECACHE *cache, int section, char *cmd, int occur); char **makeconfiglist(CONFIGFILECACHE *cache, char *section, char *label); void loadintfromconfig(CONFIGFILECACHE *cache, int section, char *setting, int *to, int def); void loadstrfromconfig(CONFIGFILECACHE *cache, int section, char *setting, char **to, char *def); void freeconfigcache(CONFIGFILECACHE *cache); /* ftptrans.h */ int sigio_handler(int signum); int filter_toascii(char *data, int *len); int filter_fromascii(char *data, int *len); int download_write(SELECTER *sel, int fd, void *peerv); int upload_read(SELECTER *sel, int fd, void *peerv); int ftp_retr(FTPSTATE *peer, char *filename); int ftp_stor(FTPSTATE *peer, char *filename); int ftp_stou(FTPSTATE *peer, char *filename); int ftp_appe(FTPSTATE *peer, char *filename); /* newfile.h */ int readbuffer(NEWFILE *file); NEWFILE *nfopen(char *filename); NEWFILE *nfdopen(int fd); char *nfgetcs(NEWFILE *file, char testchar); void nfclose(NEWFILE *file); /* main.h */ void logfullmessage(int error, unsigned int ip); VSERVER *findvserver(unsigned int ip, int port); void smartbind(SELECTER *selset, VSERVERCONN *list, int dodie); void dumbbind(SELECTER *selset, VSERVERCONN *list, int dodie); void sighandler(int signum); int mainprog(char *fconfig, int runforeground, int verbose); void mainprog_inetd(char *fconfig, unsigned int ip); void diehandler(int signum); int main(int argc, char **argv); /* datasock.h */ int datasock_connect(SELECTER *sel, int fd, void *peerv); int startdatasocket(FTPSTATE *peer, int filefd, int trans_type, off_t tsize); void closedatasocket(FTPSTATE *peer); void abortdatasocket(FTPSTATE *peer); /* auth.h */ void converttorealstr(char *strbuf); int chkpassword(char *encrypass, char *password); int checkexploits(FTPSTATE *peer); int authlogmsg(char *directive, char *groupname); int checkabsdir(char *dir); void clearauth(FTPSTATE *peer); char *mkconfrealstr(int sectionid, char *item, char *defaul); char *mktokconfstr(TOKENSET *tset, int sectionid, char *item, char *defaul); int mktokconfint(TOKENSET *tset, int sectionid, char *item, char *format, char *defaultstr, int defaultint); void setupacls(FTPSTATE *peer, TOKENSET *tset, int section, char *funcname, int aclfunc); int transferconfig(FTPSTATE *peer, TOKENSET *tset, int section); int auth_getcursectionid(FTPSTATE *peer); void *auth_getconfigcache(void); char *setuseropts(FTPSTATE *peer, char *password); /* file.h */ void file_becomeuser(FTPSTATE *peer); void file_becomeroot(FTPSTATE *peer); int checkdir(char *dir); int checkfile(char *file); int checkchdir(FTPSTATE *peer, char *dir); void convertperms(char *permstr, int mode); char *file_expand(FTPSTATE *peer, char *filename); int file_isfdregularfile(int fd); int file_isfdadir(int fd); int file_ustoreopen(FTPSTATE *peer, char *, int *, char **rname); int file_storeopen(FTPSTATE *peer, char *infile, char **rname); int file_readopen(FTPSTATE *peer, char *infile, char **rname); NEWFILE *file_nfopen(FTPSTATE *peer, char *filename); MYGLOBDATA *file_glob(FTPSTATE *peer, char *dir, char *pattern, int allfiles); int file_unlink(FTPSTATE *peer, char *infile); char *file_rename(FTPSTATE *peer, char *infile, char *infile2); int file_stat(FTPSTATE *peer, char *infile, struct stat *output); int file_mkdir(FTPSTATE *peer, char *infile); int file_rmdir(FTPSTATE *peer, char *infile); int file_chmod(FTPSTATE *peer, char *infile, int mode); /* cfloader.h */ char *gethostname2(void); void configerror(char *str); void vserver_kill(VSERVER *c); VSERVER *vserver_load(CONFIGDATA *cf, char *sectionname, VSERVER *def, VSERVERCONN ***vp); void ftpd_killconfig(CONFIGDATA *dc); CONFIGDATA *ftpd_loadconfig(char *inidata, int as_inetd, int use_umask); int ftpd_checkvserver(CONFIGDATA *cdat, VSERVER *vs); int ftpd_checkconfig(CONFIGDATA *cdat); /* ratio.h */ int lockarea(int fd, int pos, int len, int locktype, int do_wait); void lock_n_read(RATIOHANDLE *rh); void write_n_unlock(RATIOHANDLE *rh); int openratiofile(char *filename); int decoderatiostr(char *ratstr, int *pa, int *pb); RATIOHANDLE *ratio_loaduser(char *username, int section); void ratio_uploadbytes(RATIOHANDLE *rh, int bytes); int ratio_downloadbytes(RATIOHANDLE *rh, int bytes); void ratio_uploadfile(RATIOHANDLE *rh); int ratio_downloadfile(RATIOHANDLE *rh); void ratio_reread(RATIOHANDLE *rh); void ratio_stat(FTPSTATE *peer, RATIOHANDLE *rh, char *replystr); void ratio_settokens(RATIOHANDLE *rh, TOKENSET *ts); void ratio_finish(RATIOHANDLE *rh); muddleftpd-1.3.13.1/src/ftplist.c0100644000175000017500000002477407737077256015547 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" #include "reply.h" #define LISTALL 1 #define LISTDIR 2 #define LISTRECURSE 4 int ftplist_parseflags(char *params) { int count, output = 0; for (count = 0; count < strlen(params); count++) { if (params[count] == 'a') output = output | LISTALL; if (params[count] == 'd') output = output | LISTDIR; if (params[count] == 'R') output = output | LISTRECURSE; if (params[count] == ' ') return(output); } return(output); } char *listmakeline(FTPSTATE *peer, char *longname, char *filename, struct stat *fileinfo, STRCACHE *uidcache, STRCACHE *gidcache, int year) { char *output = NULL; char *datastr; char permissions[11]; char date[20]; char size[40]; char *username; char *group; int links; /* make sure the stat did work */ if (fileinfo->st_nlink > 0) { char numuserstr[20]; char numgroupstr[20]; /* insert the permissions/ filetype */ if (peer->fakemode != -1) { int dirmode = (peer->fakemode & 0777) | S_IFDIR; dirmode |= (dirmode & 0444) >> 2; if (S_ISDIR(fileinfo->st_mode)) convertperms(permissions, dirmode); else convertperms(permissions, peer->fakemode | S_IFREG); } else convertperms(permissions, fileinfo->st_mode); permissions[10] = 0; /* Insert links */ links = MINIMUM(fileinfo->st_nlink, 999); /* Insert size */ if (S_ISCHR(fileinfo->st_mode) || S_ISBLK(fileinfo->st_mode)) { snprintf(size, 39, "%3d, %3d", (int)(fileinfo->st_rdev) >> 8, (int)(fileinfo->st_rdev) & 255); } else snprintf(size, 39, "%8s", offt_tostr(fileinfo->st_size)); /* Insert date */ datastr = ctime(&(fileinfo->st_mtime)); memcpy(date, datastr + 4, 12); if (memcmp(&year, datastr + 20, 4) != 0) { date[7] = ' '; memcpy(date + 8, datastr + 20, 4); } date[12] = 0; /* do owner */ if (peer->fakename) username = peer->fakename; else if ((username = strcache_check(uidcache, (int)fileinfo->st_uid)) == NULL) { username = get_passwdname(fileinfo->st_uid, peer->chroot); if (username == NULL) { sprintf(numuserstr, "%d", (int)fileinfo->st_uid); username = numuserstr; } strcache_add(uidcache, (int)fileinfo->st_uid, username); } username[8] = 0; /* do group */ if (peer->fakegroup) group = peer->fakegroup; else if ((group = strcache_check(gidcache, fileinfo->st_gid)) == NULL) { group = get_groupname(fileinfo->st_gid, peer->chroot); if (group == NULL) { sprintf(numgroupstr, "%d", (int)fileinfo->st_gid); group = numgroupstr; } strcache_add(gidcache, (int)fileinfo->st_gid, group); } group[8] = 0; /* Do symbolic links */ if (permissions[0] == 'l') { char linkname[BUFFERSIZE]; int linklen = readlink(filename, linkname, BUFFERSIZE - 1); if (linklen != -1) { linkname[linklen] = 0; output = safe_snprintf("%s %3d %-8s %-8s %s %12s %s -> %s\r\n", permissions, links, username, group, size, date, filename, linkname); } } if (!output) output = safe_snprintf("%s %3d %-8s %-8s %s %12s %s\r\n", permissions, links, username, group, size, date, filename); } else output = safe_snprintf("---------- 1 unknown unknown 0 Jan 1 00:00 %s\r\n", filename); return(output); } void list_decodesubdirs(LISTHANDLE *lh) { int count; /* no need to do this if no files in this dir */ if (lh->dirdata->namecount == 0) return; reallocwrapper(sizeof(char *) * (lh->dirdata->namecount + lh->numsubdirs), (void *)&(lh->subdirs)); for (count = lh->dirdata->namecount - 1; count >= 0; count--) { if (S_ISDIR(lh->dirdata->stat_buf[count].st_mode)) { if ((strcmp(lh->dirdata->name[count], "..") != 0) && (strcmp(lh->dirdata->name[count], ".") != 0)) { lh->subdirs[lh->numsubdirs] = safe_snprintf("%s/%s", lh->dir, lh->dirdata->name[count]); lh->numsubdirs++; } } } } int buildnextdir(FTPSTATE *peer, LISTHANDLE *lh) { MYGLOBDATA *dirlisting = NULL; myglobfree(lh->dirdata); lh->dirdata = NULL; /* loop while there are still subdirectories to look at until an accessable one is found */ while ((!dirlisting) && (lh->numsubdirs > 0)) { freewrapper(lh->dir); lh->numsubdirs--; lh->dir = lh->subdirs[lh->numsubdirs]; dirlisting = file_glob(peer, lh->dir, "*", lh->all); lh->subdirs[lh->numsubdirs] = NULL; } if (dirlisting) { lh->dirdata = dirlisting; lh->pos = -1; list_decodesubdirs(lh); return(TRUE); } return(FALSE); } LISTHANDLE *getlisthandle(FTPSTATE *peer, char *dirpattern, int nlist, char *reldir, int params) { char *mypat = strdupwrapper(dirpattern); char *dir, *pattern; char *t; time_t ct; LISTHANDLE *lh; /* manufacture original listing dir and pattern */ dir = mypat; *(strrchr(mypat, '/')) = 0; pattern = strrchr(dirpattern, '/') + 1; lh = mallocwrapper(sizeof(LISTHANDLE)); lh->dirdata = file_glob(peer, dir, pattern, params & LISTALL); if (!lh->dirdata) { freewrapper(lh); freewrapper(mypat); return(NULL); } ct = time(NULL); t = ctime(&ct); memcpy(&(lh->year), t + 20, 4); lh->uidcache = strcache_new(); lh->gidcache = strcache_new(); lh->pos = 0; lh->nlist = nlist; lh->rdir = reldir; lh->odirlen = strlen(dir); lh->dir = dir; lh->recursive = params & LISTRECURSE; lh->all = params & LISTALL; lh->numsubdirs = 0; lh->subdirs = NULL; if (lh->recursive) { list_decodesubdirs(lh); lh->pos = -1; } return(lh); } char *getlisthandleline(FTPSTATE *peer, LISTHANDLE *lh) { char *longname; char *ret; char *relativename; if (lh == NULL) return(NULL); if (lh->pos == -1) { relativename = lh->dir + lh->odirlen; if (relativename[0] == 0) { if (lh->rdir[0] == 0) ret = strdupwrapper(".:\r\n"); else ret = safe_snprintf("%s:\r\n", lh->rdir); } else { if (lh->rdir[0] == 0) ret = safe_snprintf("%s:\r\n", relativename + 1); else if ((lh->rdir[0] == '/') && (lh->rdir[1] == 0)) ret = safe_snprintf("%s:\r\n", relativename); else ret = safe_snprintf("%s%s:\r\n", lh->rdir, relativename); } lh->pos++; return(ret); } if (lh->pos == 0) { lh->pos++; if (!(lh->nlist)) return(safe_snprintf("total %d\r\n", lh->dirdata->blocks)); } if (lh->pos > lh->dirdata->namecount) { if (lh->recursive) if (buildnextdir(peer, lh)) return(strdupwrapper("\r\n")); return(NULL); } if (lh->nlist) { ret = safe_snprintf("%s\r\n", lh->dirdata->name[lh->pos-1]); lh->pos++; return(ret); } longname = safe_snprintf("%s/%s", lh->dir, lh->dirdata->name[lh->pos-1]); ret = listmakeline(peer, longname, lh->dirdata->name[lh->pos-1], &(lh->dirdata->stat_buf[lh->pos-1]), lh->uidcache, lh->gidcache, lh->year); lh->pos++; freewrapper(longname); return(ret); } void freelisthandle(LISTHANDLE *lh) { if (!lh) return; while(lh->numsubdirs > 0) { lh->numsubdirs--; freewrapper(lh->subdirs[lh->numsubdirs]); } freeifnotnull(lh->subdirs); if (lh->dirdata) myglobfree(lh->dirdata); freewrapper(lh->dir); freewrapper(lh->rdir); strcache_free(lh->uidcache); strcache_free(lh->gidcache); freewrapper(lh); return; } int list_write(SELECTER *sel, int fd, void *peerv) { FTPSTATE *peer = (FTPSTATE *)peerv; DATAPORT *d = peer->dport; int finish = FALSE; int size = 0; int maxsize; if (STRLENGTH(d->buffer) == 0) { int ret = FALSE; while (!ret) { char *line = getlisthandleline(peer, d->lhandle); if (line) { string_cat(&(d->buffer), line, -1); freewrapper(line); if (STRLENGTH(d->buffer) > BUFFERSIZE) ret = TRUE; } else { ret = TRUE; finish = TRUE; } } } if (STRLENGTH(d->buffer) > 0) { if (peer->maxtranspd_down) maxsize = MINIMUM(peer->maxtranspd_down, STRLENGTH(d->buffer)); else if (peer->maxtranspd) maxsize = MINIMUM(peer->maxtranspd, STRLENGTH(d->buffer)); else maxsize = STRLENGTH(d->buffer); size = write(d->socketfd, STRTOCHAR(d->buffer), maxsize); } if (size > 0) { peer->listdownloadedbytes += size; d->transbytes += size; string_dropfront(&(d->buffer), size); } if ((size <= 0) || (finish && (STRLENGTH(d->buffer) == 0))) { if ((peer->maxtranspd) || (peer->maxtranspd_down)) limiter_add(d->download_limiter, 0, TRUE); socket_flush_wait(d->socketfd, peer->timeout); close(d->socketfd); if (finish) ftp_write(peer, FALSE, 226, REPLY_TRANSDONE(d->transbytes)); else ftp_write(peer, FALSE, 426, REPLY_TRANSABORT(d->transbytes)); closedatasocket(peer); return(2); } if ((peer->maxtranspd) || (peer->maxtranspd_down)) limiter_add(d->download_limiter, size, FALSE); return(FALSE); } char *listmakepattern(FTPSTATE *peer, char *parm, char **rdir, int flags) { char *dir; char *parm2; int l; if (parm == NULL) parm2 = strdupwrapper("*"); else parm2 = strdupwrapper(parm); dir = file_expand(peer, parm2); freewrapper(parm2); if (parm) *rdir = strdupwrapper(parm); else *rdir = strdupwrapper(""); /* This will check for directory names and changes them to the files in the directory instead unless user specifiess -d */ if (checkdir(dir) && !(flags & LISTDIR)) { int a = strlen(dir); reallocwrapper(a + 6, (void *)&dir); dir[a] = '/'; dir[a+1] = '*'; dir[a+2] = 0; } else { char *pos = strrchr(*rdir, '/'); if (pos) *(strrchr(*rdir, '/')) = 0; else **rdir = 0; } l = strlen(*rdir); if (l > 1) while((*rdir)[l - 1] == '/') { (*rdir)[l - 1] = 0; l--; } return(dir); } int ftp_lister(FTPSTATE *peer, char *parm, int nlist, int params) { char *fpattern; char *reldir; /* if -d used, recursion gets turned off */ if ((params & LISTDIR) && (params & LISTRECURSE)) params = params & ~LISTRECURSE; fpattern = listmakepattern(peer, parm, &reldir, params); if (startdatasocket(peer, -1, TRANS_LIST, -1) == 0) { peer->dport->lhandle = getlisthandle(peer, fpattern, nlist, reldir, params); peer->listconns++; } freewrapper(fpattern); return(FALSE); } muddleftpd-1.3.13.1/src/ftpout.c0100644000175000017500000000446307751225317015361 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" #define OUTBUFSIZE 1024 void control_timeout(int num) { signal(SIGALRM, control_timeout); } int ftp_write(FTPSTATE *peer, int bare, int messnum, char *fmt, ...) { int error, outlen, errornum, count; va_list printfargs; char number[10]; int logstartpos = STRLENGTH(peer->outbuffer); /* Make the output string, and store it in the buffer */ if (!bare) { number[0] = messnum / 100 + '0'; number[1] = messnum % 100 / 10 + '0'; number[2] = messnum % 10 + '0'; number[3] = ' '; string_cat(&(peer->outbuffer), number, 4); } va_start(printfargs, fmt); outlen = vsnprintf(NULL, 0, fmt, printfargs); va_end(printfargs); va_start(printfargs, fmt); string_catvprintf(&(peer->outbuffer), outlen, fmt, printfargs); va_end(printfargs); if (!bare) log_addentry(MYLOG_RESPONSE, peer, STRTOCHAR(peer->outbuffer) + logstartpos); /* add the end-of-line chars to the string */ string_cat(&(peer->outbuffer), "\r\n", 2); outlen = STRLENGTH(peer->outbuffer); /* dump the buffer if it is full enough or if end of response! */ error = 0; errornum = 0; if ((!bare) || (outlen > BUFFERSIZE)) { count = 0; signal(SIGALRM, control_timeout); /* make sure all data is written! */ while ((count < outlen) && (error != -1)) { alarm(peer->timeout); error = write(peer->remotefd, STRTOCHAR(peer->outbuffer) + count, outlen - count); count += error; } string_clear(&(peer->outbuffer)); errornum = errno; alarm(0); } if (error == -1) { log_giveentry(MYLOG_LOGIN, peer, safe_snprintf("Dropping connection, reason: %s", strerror(errornum))); exit(0); } return(FALSE); } muddleftpd-1.3.13.1/src/ftpsite.c0100644000175000017500000001022007737077256015515 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" #include "ftpcmd.h" #include "reply.h" extern FTPCMD siteftpcmd[]; int ftp_site(FTPSTATE *peer, char *cmd) { int result = FALSE; INPUTLINE acmd; /* if we were invoked without parameters */ if (cmd == NULL) return(ftp_write(peer, FALSE, 500, REPLY_NOPARAM("SITE"))); /* separate the site command from the site command parameters */ cmd_split(peer, &acmd, cmd, siteftpcmd, FALSE, peer->sitedisableset); result = ftp_run(peer, &acmd, "SITE"); if (acmd.parameters != NULL) freewrapper(acmd.parameters); return(result); } int ftpsite_dump(FTPSTATE *peer, char *cmd) { NEWFILE *nfile = file_nfopen(peer, cmd); if (nfile != NULL) /* Log the transfer */ { char *lfile = file_expand(peer, cmd); log_giveentry(MYLOG_FTRANS, peer, safe_snprintf("dump %s", lfile)); freewrapper(lfile); } return(ftp_dumper(peer, nfile, 200, "SITE DUMP done!", FALSE, FALSE)); } int ftpsite_umask(FTPSTATE *peer, char *cmd) { int result = FALSE; int newumask = 0; if (peer->chmodable && cmd) { int res = sscanf(cmd, "%o", &newumask); newumask &= 0777; if (res == 0) result = ftp_write(peer, FALSE, 501, REPLY_UMASKBAD); else { result = ftp_write(peer, FALSE, 200, REPLY_UMASKNEW(newumask, peer->umask)); peer->umask = newumask; } } else { result = ftp_write(peer, FALSE, 200, REPLY_UMASKCUR(peer->umask)); } return(result); } int ftpsite_help(FTPSTATE *peer, char *cmd) { return(ftp_dohelp(peer, siteftpcmd, cmd, peer->sitedisableset)); } int ftpsite_idle(FTPSTATE *peer, char *cmd) { int newtimeout; if (!cmd) return(ftp_write(peer, FALSE, 200, REPLY_TIMEOUTCURRENT(peer->timeout))); if (peer->maxtimeout < 30) return(ftp_write(peer, FALSE, 500, REPLY_TIMEOUTFIXED(peer->maxtimeout))); if (sscanf(cmd, "%d", &newtimeout) < 1) return(ftp_write(peer, FALSE, 500, REPLY_TIMEOUTNOTINT)); if ((newtimeout >= 30) && (newtimeout <= peer->maxtimeout)) { peer->timeout = newtimeout; ftp_write(peer, FALSE, 200, REPLY_TIMEOUTOK(peer->timeout)); } else return(ftp_write(peer, FALSE, 500, REPLY_TIMEOUTRANGE(30, peer->maxtimeout))); return(3); /* make sure timeout gets updated! */ } int ftpsite_chmod(FTPSTATE *peer, char *cmd) { int result = FALSE; if (peer->chmodable) { int newmode; char *mode = NULL; if (cmd != NULL) mode = getkeyword(&cmd); if (cmd == NULL) result = ftp_write(peer, FALSE, 501, REPLY_CHMODNOPARMS); else if (sscanf(mode, "%o", &newmode) == 0) result = ftp_write(peer, FALSE, 501, REPLY_CHMODBADMODE); else { newmode &= 0777; result = ftp_chmod(peer, cmd, newmode); } freeifnotnull(mode); } else result = ftp_write(peer, FALSE, 500, REPLY_CHMODDENIED); return(result); } int ftpsite_access(FTPSTATE *peer, char *cmd) { int count = 0; char aclinfo[12]; char replystr[5]; if (config->altlongreplies) strcpy(replystr, "211-"); else strcpy(replystr, " "); ftp_write(peer, TRUE, 0, REPLY_ACCESSFIRST(peer->username)); ftp_write(peer, TRUE, 0, REPLY_ACCESSSECOND(replystr)); ftp_write(peer, TRUE, 0, replystr); /* this accesses the insides of the acllist. I shouldn't, but it is the easiest way of doing it */ while(count < peer->acldata->aclcount) { acllist_makepermstr(peer->acldata, count, aclinfo); if (aclinfo[0] == 0) strcpy(aclinfo, "no access"); ftp_write(peer, TRUE, 0, "%s%-60s %s", replystr, peer->acldata->acls[count].dir, aclinfo); count++; } ftp_write(peer, FALSE, 211, REPLY_ACCESSEND); return(FALSE); } muddleftpd-1.3.13.1/src/ftpstat.c0100644000175000017500000000540407737077256015534 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" #include "reply.h" int ftp_stat(FTPSTATE *peer, char *param) { char replystr[5]; if (config->altlongreplies) strcpy(replystr, "211-"); else strcpy(replystr, " "); if (param == NULL) { char *curdir = dir_getvirtual(peer, peer->pwd); ftp_write(peer, TRUE, 0, REPLY_STAT1(peer)); ftp_write(peer, TRUE, 0, REPLY_STAT2(peer)); ftp_write(peer, TRUE, 0, REPLY_STAT3(curdir)); /* this does current dir */ ftp_write(peer, TRUE, 0, REPLY_STAT4(peer)); ftp_write(peer, TRUE, 0, REPLY_STAT5(peer)); ftp_write(peer, TRUE, 0, REPLY_STAT6(peer)); ftp_write(peer, TRUE, 0, REPLY_STAT7(peer)); ftp_write(peer, TRUE, 0, REPLY_STAT8(peer)); if (peer->ratioinfo) ratio_stat(peer, peer->ratioinfo, replystr); if (peer->dport) { ftp_write(peer, TRUE, 0, REPLY_STAT9); if (peer->dport->trans_type != TRANS_RUNNING) ftp_write(peer, TRUE, 0, REPLY_STAT10); else if (peer->dport->tsize == -1) ftp_write(peer, TRUE, 0, REPLY_STAT11(peer)); else ftp_write(peer, TRUE, 0, REPLY_STAT12(peer)); } } else { /* do a listing */ char *line; char *rdir; char *cmd = getkeyword(¶m); char *pattern = (char *)listmakepattern(peer, cmd, &rdir, 0); LISTHANDLE *lh = getlisthandle(peer, pattern, FALSE, rdir, 0); LIMITER *lim = NULL; if (peer->maxtranspd_down) lim = limiter_new(peer->maxtranspd_down); else if (peer->maxtranspd) lim = limiter_new(peer->maxtranspd); ftp_write(peer, TRUE, 0, REPLY_STATLIST(cmd)); while ((line = getlisthandleline(peer, lh)) != NULL) { int sline = strlen(line); line[sline - 2] = 0; if (config->altlongreplies) { ftp_write(peer, TRUE, 0, "211-%s", line); if (lim) limiter_add(lim, sline + 4, FALSE); } else { ftp_write(peer, TRUE, 0, "%s", line); if (lim) limiter_add(lim, sline, FALSE); } freewrapper(line); } if (lim) limiter_add(lim, 0, TRUE); freeifnotnull(lim); freewrapper(pattern); freewrapper(cmd); freelisthandle(lh); } ftp_write(peer, FALSE, 211, REPLY_STATEND); return(FALSE); } muddleftpd-1.3.13.1/src/ftpstate.c0100644000175000017500000000630607737077256015703 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" void ftpstate_init(FTPSTATE *ftp, int fd, int ip, int threadnum, int portnum, VSERVER *vs) { ftp->remotefd = fd; ftp->remoteip = ip; ftp->dataip = ip; ftp->hostname = getnetworkstr(ip); ftp->threadnum = threadnum; ftp->connport = portnum; ftp->username = strdupwrapper(""); ftp->outbuffer = string_new(); ftp->pwd = NULL; ftp->homedir = NULL; ftp->renameoldname = NULL; ftp->loggedin = FALSE; ftp->restartpos = 0; ftp->binary = TRUE; ftp->remoteport = 0; ftp->passiveport = 0; ftp->nicevalue = 0; ftp->chroot = 0; ftp->droproot = 0; ftp->realdir = 0; ftp->maxtranspd = 0; ftp->maxtranspd_up = 0; ftp->maxtranspd_down = 0; ftp->epsv_forced = 0; ftp->basedir = NULL; ftp->logindump = NULL; ftp->inbuffer = string_new(); ftp->maxusers = vs->maxusers; ftp->maxtimeout = ftp->timeout = vs->timeout; ftp->acldata = NULL; ftp->umask = vs->umask; /* set default umask */ ftp->chmodable = FALSE; ftp->dport = NULL; ftp->cwddump = NULL; ftp->busydump = NULL; ftp->quitdump = NULL; ftp->cwddumpdata = NULL; ftp->busydumpdata = NULL; ftp->quitdumpdata = NULL; ftp->logindumpdata = NULL; ftp->groupname = NULL; ftp->fakegroup = NULL; ftp->fakename = NULL; ftp->fakemode = -1; ftp->loginsleft = vs->logincount; ftp->jailenabled = FALSE; ftp->ratioinfo = NULL; ftp->supgids = NULL; ftp->accessdevices = FALSE; ftp->cmddisableset = disableset_create(); ftp->sitedisableset = disableset_create(); /* set session stats stuff! */ ftp->downloadedfiles = 0; ftp->uploadedfiles = 0; ftp->downloadedfilebytes = 0; ftp->uploadedfilebytes = 0; ftp->listdownloadedbytes = 0; ftp->listconns = 0; } void ftpstate_dest(FTPSTATE *ftp) { freeifnotnull(ftp->cmddisableset); freeifnotnull(ftp->sitedisableset); freeifnotnull(ftp->username); freeifnotnull(ftp->pwd); freeifnotnull(ftp->homedir); freeifnotnull(ftp->renameoldname); freeifnotnull(ftp->basedir); freeifnotnull(ftp->logindump); freeifnotnull(ftp->inbuffer); freeifnotnull(ftp->outbuffer); freeifnotnull(ftp->cwddump); freeifnotnull(ftp->busydump); freeifnotnull(ftp->quitdump); freeifnotnull(ftp->hostname); freeifnotnull(ftp->fakename); freeifnotnull(ftp->fakegroup); if (ftp->ratioinfo) ratio_finish(ftp->ratioinfo); freeifnotnull(ftp->supgids); freeifnotnull(ftp->logindumpdata); freeifnotnull(ftp->cwddumpdata); freeifnotnull(ftp->quitdumpdata); freeifnotnull(ftp->busydumpdata); if (ftp->dport) { freewrapper(ftp->dport->buffer); freewrapper(ftp->dport); } freewrapper(ftp); } muddleftpd-1.3.13.1/src/ftptrans.c0100644000175000017500000002072307737077256015711 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" #include "ftpcmd.h" #include "reply.h" extern FTPCMD ftpcommandtable[]; int filter_toascii(char *data, int *len) { int count, len2 = *len; char buffer2[BUFFERSIZE * 2]; int last = 0; char *b2ptr = buffer2; for (count = 0; count < len2; count++) { if ((data[count] == 10) && (last != 13)) { *b2ptr = 13; b2ptr++; (*len)++; } *b2ptr = data[count]; last = *b2ptr; b2ptr++; } memcpy(data, buffer2, *len); return(*len); } int filter_fromascii(char *data, int *len) { char *dptr = data; int count, len2 = *len; for (count = 0; count < len2; count++) { if (data[count] != 13) { *dptr = data[count]; dptr++; } else (*len)--; } return(len2); } int download_write(SELECTER *sel, int fd, void *peerv) { FTPSTATE *peer = (FTPSTATE *)peerv; DATAPORT *d = peer->dport; int startp, size, size2, finished = FALSE; char indata[BUFFERSIZE * 2]; int maxsize; /* determine maximum transfer size */ if (peer->maxtranspd_down) maxsize = MINIMUM(peer->maxtranspd_down, BUFFERSIZE); else if (peer->maxtranspd) maxsize = MINIMUM(peer->maxtranspd, BUFFERSIZE); else maxsize = BUFFERSIZE; /* if we have binary mode and no ratios to worry about, use sendfile to improve performace. A huge amount of data may be transmitted at a time using sendfile. But at the moment sendfile in Linux REALLY SUCKS. Must keep size small otherwise I hog processor/machine from other processes. Even other CPUS are halted during a sendfile! (also any file operation) */ #ifdef HAVE_SENDFILE #ifdef Linux /* Don't know if this will work all the time */ if ((d->binary) && (!peer->ratioinfo)) { if (d->startpos != 0) { d->pos = d->startpos; d->startpos = 0; } size2 = size = sendfile(d->socketfd, d->filefd, &(d->pos), maxsize); } else #endif #ifdef FreeBSD if ((d->binary) && (!peer->ratioinfo)) { int result; if (d->startpos != 0) { d->pos = d->startpos; d->startpos = 0; } result = sendfile(d->filefd, d->socketfd, d->pos, maxsize, NULL, (off_t *)&size, 0); d->pos += size; if ((result == -1) && (errno != EAGAIN)) size = -1; size2 = size; } else #endif #endif if (STRLENGTH(d->buffer) == 0) { size = read(d->filefd, indata, maxsize); size2 = 0; if ((size > 0) && (!d->binary)) filter_toascii(indata, &size); d->pos += size; if (d->pos < d->startpos) return(FALSE); else startp = MAXIMUM(0, size - (d->pos - d->startpos)); if (((size - startp) > 0) && (peer->ratioinfo)) if (ratio_downloadbytes(peer->ratioinfo, (size - startp))) { finished = TRUE; size = 0; ftp_write(peer, TRUE, 0, REPLY_BYTELIMIT); } if ((size > 0) && (startp != size)) size2 = write(d->socketfd, indata + startp, size - startp); if ((size2 > 0) && ((size2 + startp) < size)) string_cat(&(d->buffer), indata + startp + size2, size - (startp + size2)); } else { size = size2 = write(d->socketfd, STRTOCHAR(d->buffer), STRLENGTH(d->buffer)); if (size2 > 0) string_dropfront(&(d->buffer), size); } if ((size <= 0) || (size2 <= 0) || finished) { if (d->download_limiter) limiter_add(d->download_limiter, 0, TRUE); select_delfd(sel, d->filefd); if ((size == 0) && (!finished)) ftp_write(peer, FALSE, 226, REPLY_TRANSDONE(peer->dport->transbytes)); else ftp_write(peer, FALSE, 426, REPLY_TRANSABORT(peer->dport->transbytes)); closedatasocket(peer); return(2); } if (d->download_limiter) limiter_add(d->download_limiter, size, FALSE); d->transbytes += size; peer->downloadedfilebytes += size; return(FALSE); } int upload_read(SELECTER *sel, int fd, void *peerv) { FTPSTATE *peer = (FTPSTATE *)peerv; DATAPORT *d = peer->dport; int size, size2; int finished = FALSE; char indata[BUFFERSIZE * 2]; int maxsize; /* determine maximum read size */ if (peer->maxtranspd_up) maxsize = MINIMUM(peer->maxtranspd_up, BUFFERSIZE); else if (peer->maxtranspd) maxsize = MINIMUM(peer->maxtranspd, BUFFERSIZE); else maxsize = BUFFERSIZE; size = read(d->socketfd, indata, maxsize); /* false alarm, no data, return */ if ((size == -1) && (errno == EAGAIN)) return FALSE; if (size > 0) { d->transbytes += size; peer->uploadedfilebytes += size; if (peer->maxtranspd || peer->maxtranspd_up) limiter_add(d->upload_limiter, size, FALSE); if (peer->ratioinfo) ratio_uploadbytes(peer->ratioinfo, size); } if ((size > 0) && (!d->binary)) filter_fromascii(indata, &size); if (size > 0) { int re = 0; size2 = 0; while(((size - size2) > 0) && (re != -1)) { re = write(d->filefd, indata + size2, size - size2); if (re == -1) finished = TRUE; else size2 += re; } } if ((size <= 0) || finished) { select_delfd(sel, d->filefd); if (peer->maxtranspd || peer->maxtranspd_up) limiter_add(d->upload_limiter, size, FALSE); if ((size == 0) && (!finished)) ftp_write(peer, FALSE, 226, REPLY_TRANSDONE(peer->dport->transbytes)); else ftp_write(peer, FALSE, 426, REPLY_TRANSABORT(peer->dport->transbytes)); closedatasocket(peer); return(2); } return(FALSE); } int ftp_retr(FTPSTATE *peer, char *filename) { int filefd; off_t size; char *fullname; if ((filefd = file_readopen(peer, filename, &fullname)) < 0) reporterror(peer, filename, errno); else { if (peer->ratioinfo) if (ratio_downloadfile(peer->ratioinfo)) { ftp_write(peer, FALSE, 550, REPLY_FILELIMIT); return(FALSE); } peer->downloadedfiles++; /* if ascii transfer size is set to -1, else size is binary filesize */ size = -1; if (peer->binary) { size = lseek(filefd, 0, SEEK_END); lseek(filefd, MINIMUM(size, peer->restartpos), SEEK_SET); } if (startdatasocket(peer, filefd, TRANS_DOWNLOAD, size) == 0) log_giveentry(MYLOG_FTRANS, peer, safe_snprintf("retrieve %s", fullname)); } freewrapper(fullname); return(FALSE); } int ftp_stor_core(FTPSTATE *peer, char *filename, int unique) { int filefd; int nounique = FALSE; char *fullname; /* There is 2 good reasons thus is here: 1) My code won't work for resume ASCII upload. 2) It is impossible to do. Telnet ascii to unix ascii is irreversible. Therefore you don't know where the user wants to start saving. */ if ((peer->restartpos != 0) && (!peer->binary)) return(ftp_write(peer, FALSE, 500, REPLY_RESUMEASCIIUP)); /* if the user asked for a unique filename, find one */ if (unique) filefd = file_ustoreopen(peer, filename, &nounique, &fullname); else filefd = file_storeopen(peer, filename, &fullname); if (nounique) ftp_write(peer, FALSE, 500, REPLY_STOUNOUNIQUE); else if (filefd < 0) reporterror(peer, filename, errno); else { peer->uploadedfiles++; if (startdatasocket(peer, filefd, TRANS_UPLOAD, -1) == 0) { log_giveentry(MYLOG_FTRANS, peer, safe_snprintf("store %s", fullname)); /* now truncate the file to the restart pos length */ ftruncate(filefd, peer->dport->pos); lseek(filefd, peer->dport->pos, SEEK_SET); } } freewrapper(fullname); return(FALSE); } int ftp_stor(FTPSTATE *peer, char *filename) { return(ftp_stor_core(peer, filename, FALSE)); } int ftp_stou(FTPSTATE *peer, char *filename) { return(ftp_stor_core(peer, filename, TRUE)); } int ftp_appe(FTPSTATE *peer, char *filename) { int filefd; char *fullname; peer->restartpos = 0; filefd = file_storeopen(peer, filename, &fullname); if (filefd < 0) reporterror(peer, filename, errno); else { peer->uploadedfiles++; if (startdatasocket(peer, filefd, TRANS_UPLOAD, -1) == 0) { log_giveentry(MYLOG_FTRANS, peer, safe_snprintf("append %s", fullname)); /* this is for ratios, If the final file position is 0, then it is a fresh upload. */ if (lseek(filefd, 0, SEEK_END) == 0) /* set to append */ peer->dport->trans_type = TRANS_SUPLOAD; } } freewrapper(fullname); return(FALSE); } muddleftpd-1.3.13.1/src/ftpwho.c0100644000175000017500000003545107737077256015363 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper hmmm, could be setuid root. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" int lockfd; SHRMEMHEADER *shrmemptr; #define FALSE 0 #define TRUE !FALSE char *getipstr(unsigned int server) { static char ipstr[20]; snprintf(ipstr, 20, "%d.%d.%d.%d", server >> 24, (server >> 16) & 0xFF, (server >> 8) & 0xFF, server & 0xFF); return(ipstr); } int lockarea(int fd, int pos, int len, int locktype, int do_wait) { struct flock lock; int lockt; register int err; lockt = (do_wait == TRUE ? F_SETLKW : F_SETLK); lock.l_type = locktype; lock.l_whence = SEEK_SET; lock.l_start = pos; lock.l_len = len; err = fcntl(fd, lockt, &lock); if (err == -1) { if (errno != EAGAIN) ERRORMSGFATAL(strerror(errno)); else return(FALSE); } return(TRUE); } void *shmem_connect(char *configfile) { int shmemnum; key_t ipckey = ftok(configfile, '/'); lockfd = open(configfile, O_RDWR); if (lockfd == -1) ERRORMSGFATAL(safe_snprintf("Could not open lock file, reason: %s", strerror(errno))); #ifdef DEBUG printf("[shmat_init]\n"); #endif shmemnum = shmget(ipckey, 0, 0); if (shmemnum == -1) return(NULL); shrmemptr = shmat(shmemnum, NULL, 0600); if ((int)shrmemptr == -1) ERRORMSGFATAL(safe_snprintf("Could not connect to shared memory: %s", strerror(errno))); /* get semaphores. Using the config file so others can join in (we use file locks for portability, simplicity and usability.) */ /* assume that if standalone isn't active, inetd is */ if (lockarea(lockfd, 3, 1, F_WRLCK, FALSE)) return(NULL); if (shrmemptr->magic != CURRENTMAGIC) ERRORMSGFATAL("Incorrect version!"); return(shrmemptr); } void pnums_showpid(void) { int pid; lockarea(lockfd, 0, 1, F_WRLCK, TRUE); pid = (int)shrmemptr->pid; lockarea(lockfd, 0, 1, F_UNLCK, TRUE); printf("%d\n", pid); exit(0); } void pnums_count(char *username) { SHRMEMDATA *dpos; SHRMEMHEADER *shdata; int count; shdata = mallocwrapper(SHMEMPROCSTART); /* make a working copy of the stuff we want to display so I can release the locks quickly */ lockarea(lockfd, 0, 3, F_WRLCK, TRUE); memcpy(shdata, shrmemptr, sizeof(SHRMEMHEADER) + sizeof(SHRMEMDATA) * (shrmemptr->numvserver + shrmemptr->numgroups)); lockarea(lockfd, 0, 3, F_UNLCK, TRUE); dpos = SHRMEMDATPOS(shdata, 0); if (username) { int done = FALSE; for (count = 0; count < shdata->numvserver + shdata->numgroups; count++) { if (strncmp(dpos->name, username, MAXNAMELEN) == 0) { done = TRUE; printf("%d %d\n", dpos->count, dpos->max); } dpos++; } if (!done) printf("Group/virtual server not found!\n"); } else { printf("User counts: (%d users, maximum %d users)\n", shdata->serverusercount, shdata->servermaxcount); if (shdata->numvserver > 0) { printf("Virtual Server Current Users Max Users\n"); for (count = 0; count < shdata->numvserver; count++) { printf("%-50s %-15d %d\n", dpos->name, dpos->count, dpos->max); dpos++; } printf("\n"); } printf("Group Current Users Max Users\n"); for (count = 0; count < shdata->numgroups; count++) { printf("%-50s %-15d %d\n", dpos->name, dpos->count, dpos->max); dpos++; } printf("\n"); } exit(0); } char **buildgrouplist(CONFIGFILECACHE *c, char **vserverlist) { char **temp_grouplist, **grouplist; char **vserver, **group, **currentgroup; int doadd, len; /* this is cheating, but is easier */ grouplist = (char **)mallocwrapper(sizeof(char *) * c->sectioncount); grouplist[0] = NULL; vserver = vserverlist; len = 0; while(*vserver != NULL) { temp_grouplist = makeconfiglist(c, *vserver, "group"); currentgroup = temp_grouplist; while(*currentgroup != NULL) { doadd = TRUE; group = grouplist; while (*group != NULL) { if (strcmp(*group, *currentgroup) == 0) doadd = FALSE; group++; } if (doadd) { *group = *currentgroup; group++; *group = NULL; } currentgroup++; } vserver++; } return(grouplist); } void inetd_count(CONFIGFILECACHE *c, char *username) { SCRFILEREC dat; int count, pos, sectionid, count2; int max, defmax, isvserver, found; int usercount, *vcnt, *gcnt; char **vserverlist, **grouplist; /* build required information from config file */ sectionid = getsectionid(c, "main"); loadintfromconfig(c, sectionid, "maxusers", &defmax, MAXUSERS); vserverlist = makeconfiglist(c, "main", "vserver"); if (vserverlist[0] == NULL) grouplist = makeconfiglist(c, "main", "group"); else grouplist = buildgrouplist(c, vserverlist); /* check name lengths */ count = 0; while (vserverlist[count] != NULL) { if (strlen(vserverlist[count]) >= MAXSECTIONLEN) ERRORMSGFATAL(safe_snprintf("Vserver '%s', name too long.", vserverlist[count])); count++; } count = 0; while (grouplist[count] != NULL) { if (strlen(grouplist[count]) >= MAXSECTIONLEN) ERRORMSGFATAL(safe_snprintf("Group '%s', name too long.", grouplist[count])); count++; } if (username) { /* get information about part user asked for */ sectionid = getsectionid(c, username); count = 0; isvserver = FALSE; found = FALSE; while((vserverlist[count] != NULL) && (!isvserver)) { if (strcmp(vserverlist[count], username) == 0) isvserver = TRUE; count++; } count = 0; found = isvserver; while((grouplist[count] != NULL) && (!found)) { if (strcmp(grouplist[count], username) == 0) found = TRUE; count++; } if ((sectionid == -1) || (!found)) ERRORMSGFATAL("Group/virtual server not found!\n"); loadintfromconfig(c, sectionid, "maxusers", &max, defmax); lockarea(lockfd, 0, 1, F_WRLCK, TRUE); lseek(lockfd, 0, SEEK_SET); count = 0; pos = 0; while(read(lockfd, &dat, sizeof(SCRFILEREC)) == sizeof(SCRFILEREC)) { if (lockarea(lockfd, 10 + pos, 1, F_WRLCK, FALSE)) lockarea(lockfd, 10 + pos, 1, F_UNLCK, TRUE); else { if (isvserver) { if (strcmp(username, dat.vserver) == 0) count++; } else { if (strcmp(username, dat.groupname) == 0) count++; } } pos++; } lockarea(lockfd, 0, 1, F_UNLCK, TRUE); printf("%d %d\n", count, max); } else { vcnt = (int *)mallocwrapper(sizeof(int) * c->sectioncount * 2); gcnt = (int *)mallocwrapper(sizeof(int) * c->sectioncount * 2); memset(vcnt, 0, c->sectioncount * sizeof(int)* 2); memset(gcnt, 0, c->sectioncount * sizeof(int)* 2); /* determine maximum users */ count2 = 0; while(vserverlist[count2]) { sectionid = getsectionid(c, vserverlist[count2]); if (sectionid == -1) ERRORMSGFATAL(safe_snprintf("could not find vserver section '%s'", vserverlist[count2])); loadintfromconfig(c, sectionid, "maxusers", vcnt + (c->sectioncount + count2), defmax); count2++; } count2 = 0; while(grouplist[count2]) { sectionid = getsectionid(c, grouplist[count2]); if (sectionid == -1) ERRORMSGFATAL(safe_snprintf("could not find group section '%s'", vserverlist[count2])); loadintfromconfig(c, sectionid, "maxusers", gcnt + (c->sectioncount + count2), defmax); count2++; } lockarea(lockfd, 0, 1, F_WRLCK, TRUE); lseek(lockfd, 0, SEEK_SET); count = 0; pos = 0; usercount = 0; while(read(lockfd, &dat, sizeof(SCRFILEREC)) == sizeof(SCRFILEREC)) { if (lockarea(lockfd, 10 + pos, 1, F_WRLCK, FALSE)) lockarea(lockfd, 10 + pos, 1, F_UNLCK, TRUE); else { usercount++; count2 = 0; while(vserverlist[count2]) { if (strcmp(vserverlist[count2], dat.vserver) == 0) vcnt[count2]++; count2++; } count2 = 0; while(grouplist[count2]) { if (strcmp(grouplist[count2], dat.groupname) == 0) gcnt[count2]++; count2++; } } pos++; } lockarea(lockfd, 0, 1, F_UNLCK, TRUE); printf("User counts: (%d users, maximum %d users)\n", usercount, defmax); if (vserverlist[0] != NULL) { printf("Virtual Server Current Users Max Users\n"); for (count = 0; vserverlist[count] != NULL; count++) printf("%-50s %-15d %d\n", vserverlist[count], vcnt[count], vcnt[c->sectioncount + count]); printf("\n"); } printf("Group Current Users Max Users\n"); for (count = 0; grouplist[count]; count++) if (gcnt[c->sectioncount + count] != 0) printf("%-50s %-15d %d\n", grouplist[count], gcnt[count], gcnt[c->sectioncount + count]); printf("\n"); } exit(0); } void pnums_listdisplay(SCRMEMREC *newdat, SHRMEMHEADER *shdata, int useips) { char *usergroupstr = NULL; SHRMEMDATA *dpos; if (newdat->group == -1) usergroupstr = safe_snprintf("not logged in", newdat->username); else if (newdat->group == -2) usergroupstr = safe_snprintf("%s/none", newdat->username); else { dpos = SHRMEMDATPOS(shdata, newdat->group + shdata->numvserver); usergroupstr = safe_snprintf("%s/%s", newdat->username, dpos->name); } if (useips) printf("%-5d %-20s %-20s %s\n", newdat->pid, usergroupstr, getipstr(newdat->ip), newdat->currentop); else printf("%-5d %-20s %-20s %s\n", newdat->pid, usergroupstr, newdat->remotehost, newdat->currentop); freewrapper(usergroupstr); } void inetd_listdisplay(STRING **s, SCRFILEREC *newdat, int useips) { char *usergroupstr = NULL; if (strcmp(newdat->groupname, "none") == 0) usergroupstr = strdupwrapper("not logged in"); else usergroupstr = safe_snprintf("%s/%s", newdat->username, newdat->groupname); if (useips) string_catprintf(s, "%-5d %-20s %-20s %s\n", newdat->pid, usergroupstr, getipstr(newdat->ip), newdat->currentop); else string_catprintf(s, "%-5d %-20s %-20s %s\n", newdat->pid, usergroupstr, newdat->remotehost, newdat->currentop); freewrapper(usergroupstr); } void pnums_list(char *username, int useips) { SCRMEMREC *dat, *newdat; SHRMEMHEADER *shdata; int count; int count2 = 0; shdata = mallocwrapper(SHMEMPROCSTART); newdat = mallocwrapper(sizeof(SCRMEMREC)); lockarea(lockfd, 0, 3, F_WRLCK, TRUE); memcpy(shdata, shrmemptr, sizeof(SHRMEMHEADER) + sizeof(SHRMEMDATA) * (shrmemptr->numvserver + shrmemptr->numgroups)); lockarea(lockfd, 0, 3, F_UNLCK, TRUE); dat = (SCRMEMREC *)((char *)shrmemptr + (SHMEMPROCSTART)); printf("Pid Username/Group Host Operation\n"); for (count = 0; count < shrmemptr->numrecs; count++) { lockarea(lockfd, 10+count, 1, F_WRLCK, TRUE); memcpy(newdat, dat, sizeof(SCRMEMREC)); lockarea(lockfd, 10+count, 1, F_UNLCK, TRUE); if (newdat->pid > 0) { if (username != NULL) { if ((strcmp(username, newdat->username) == 0) && (newdat->group != -1)) { pnums_listdisplay(newdat, shdata, useips); count2++; } } else { pnums_listdisplay(newdat, shdata, useips); count2++; } } dat++; } printf("------- %d users.\n", count2); } void inetd_list(char *username, int useips) { SCRFILEREC dat; /* I need to cache the output into memory instead of to the terminal so that the master lock on the scratchfile is held as little as possible! */ STRING *outstring = string_new(); int count; int count2 = 0; lockarea(lockfd, 0, 1, F_WRLCK, TRUE); lseek(lockfd, 0, SEEK_SET); string_catprintf(&outstring, "Pid Username/Group Host Operation\n"); count = 0; while(read(lockfd, &dat, sizeof(SCRFILEREC)) == sizeof(SCRFILEREC)) { if (lockarea(lockfd, 10 + count, 1, F_WRLCK, FALSE)) lockarea(lockfd, 10 + count, 1, F_UNLCK, TRUE); else { if (username != NULL) { if (strcmp(username, dat.username) == 0) { inetd_listdisplay(&outstring, &dat, useips); count2++; } } else { inetd_listdisplay(&outstring, &dat, useips); count2++; } } count++; } lockarea(lockfd, 0, 1, F_UNLCK, TRUE); string_catprintf(&outstring, "------- %d users.\n", count2); /* now print the output */ printf("%s", STRTOCHAR(outstring)); } void usage(char *name) { printf("ftpwho, shows who is logged in and what they are doing.\n\n"); printf("Usage: %s [-V][-h][-c configfile]\n\n", name); printf(" -V Show version information.\n"); printf(" -h Show usage information.\n"); printf(" -p Get pid of "PROGNAME" deamon.\n"); printf(" -c configfile Specify config file "PROGNAME" is running as.\n"); printf(" -C Return counts of groups and vservers.\n"); printf(" -n Return IP's instead of hostnames.\n"); printf(" -u namespec Return logins of user 'namespec' or if\n"); printf(" -C is used, counts of specific group or vserver.\n\n"); exit(1); } int main(int argc, char **argv) { CONFIGFILECACHE *cfiledata; int count = FALSE; int do_getpid = FALSE; int useips = FALSE; char *username = NULL; char *fconfig = NULL; char *scratchfile = NULL; int section, line, error; void *sharea; int ch; int saved_uid = geteuid(); int saved_gid = getegid(); int extraperms = FALSE; extern char *optarg; if ((saved_uid != getuid()) || (saved_gid != getgid())) extraperms = TRUE; while((ch = getopt(argc, argv, "Vc:hu:Cnp")) != EOF) { switch(ch) { case 'V': showversion("ftpwho"); case 'c': fconfig = optarg; break; case 'u': username = optarg; break; case 'C': count = TRUE; break; case 'n': useips = TRUE; break; case 'p': do_getpid = TRUE; break; case 'h': default: usage(argv[0]); } } if (fconfig == NULL) fconfig = CONFIGFILE; if ((do_getpid && count) || (do_getpid && username)) { printf("invalid arguments.\n"); usage(argv[0]); } cfiledata = loadconfigcache(fconfig, &line, &error); /* obtain scratchfile name */ if (cfiledata == NULL) ERRORMSGFATAL(safe_snprintf("Could not load line %d of config file: %s", line, config_errorstr(error))); section = getsectionid(cfiledata, "main"); if (section == -1) ERRORMSGFATAL("Could not find main section in config file"); loadstrfromconfig(cfiledata, section, "scratchfile", &scratchfile, SCRATCHFILE); if (scratchfile[0] != '/') ERRORMSGFATAL("Scratchfile is not a valid absolute filename"); sharea = shmem_connect(scratchfile); if (sharea != NULL) { if (do_getpid) pnums_showpid(); else if (count) pnums_count(username); else pnums_list(username, useips); } else { if (do_getpid) ERRORMSGFATAL("No parent pid in inetd mode."); else if (count) inetd_count(cfiledata, username); else inetd_list(username, useips); } return(0); } muddleftpd-1.3.13.1/src/init.c0100644000175000017500000000371707737077256015017 0ustar joergjoerg/* init.c main program initalization This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" /* Initalializes the program, and reads configuration */ void ftpd_setnogroups(void) { setgroups(0, NULL); } void ftpd_preinit(void) { config = NULL; } void ftpd_init(char *filename, int verbose) { int result = TRUE; char *scratchfile; ftpd_preinit(); if (verbose) { printf("Starting "PROGNAME" server. (Version "VERSTR")\n"); printf("Copyright (C) 1999,2000 Beau Kuiper\n"); printf("License under GPL. See the http://www.fsf.org for more info.\n\n"); printf("LOADING CONFIG FILE: %s\n", filename); } config = ftpd_loadconfig(filename, FALSE, umask(0)); if (config) result = ftpd_checkconfig(config); if ((!config) || (!result)) ERRORMSGFATAL("Errors loading config file, cannot continue!"); log_setcontext(config->logout, config->defaults->loglevel); if (verbose) { if (config->rootmode) printf("Running as root, using full capibilities.\n"); else printf("Running as normal user, change uid not possible.\n"); } result = getsectionid(config->configfile, "main"); loadstrfromconfig(config->configfile, result, "scratchfile", &scratchfile, SCRATCHFILE); if (scratchfile[0] != '/') ERRORMSGFATAL("Scratchfile is not a valid absolute filename"); shinfo_init(scratchfile); ftpd_setnogroups(); } muddleftpd-1.3.13.1/src/logger.c0100644000175000017500000000653107751225320015307 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" int logoutfd = -1; int logoutmask = 0; int log_initcontext(char *logname) { return(open(logname, O_APPEND | O_CREAT | O_WRONLY, 0600)); } void log_setcontext(int logfd, int logmask) { logoutfd = logfd; logoutmask = logmask; } void log_addentry(int type, FTPSTATE *peer, char *desc) { if ((logoutfd != -1) && (((logoutmask) & type) == type)) { int currenttime = time(NULL); int outlen,i; char *timestr = ctime((time_t *)¤ttime); char *outstring; int writeresult; timestr[strlen(timestr) - 1] = '\0'; switch(type) { case MYLOG_DACCESS: /* access denied */ outstring = safe_snprintf("-- %s : %s(%s) : Access Denied to ftp server.\n", timestr, peer->hostname, getipstr(peer->remoteip)); break; case MYLOG_FTRANS: /* transfer log */ outstring = safe_snprintf("++ %s : %s@%s(%s)/%d : %s\n", timestr, peer->username, peer->hostname, getipstr(peer->remoteip), peer->threadnum, desc); break; case MYLOG_COMMAND: /* command log */ outstring = safe_snprintf("<< %s : %s@%s(%s)/%d : %s\n", timestr, peer->username, peer->hostname, getipstr(peer->remoteip), peer->threadnum, desc); break; case MYLOG_RESPONSE: /* response log */ outstring = safe_snprintf(">> %s : %s@%s(%s)/%d : %s\n", timestr, peer->username, peer->hostname, getipstr(peer->remoteip), peer->threadnum, desc); break; case MYLOG_LOGIN: /* login log */ outstring = safe_snprintf("!! %s : %s@%s(%s)/%d : %s\n", timestr, peer->username, peer->hostname, getipstr(peer->remoteip), peer->threadnum, desc); break; case MYLOG_INFO: /* info log */ outstring = safe_snprintf("** %s : Info - %s\n", timestr, desc); break; case MYLOG_DEBUG: /* debug log */ outstring = safe_snprintf("dd %s : DEBUG - %s\n", timestr, desc); break; default: outstring = safe_snprintf("uu Unknown log type, report as a bug!\n"); } outlen = strlen(outstring); writeresult = write(logoutfd, outstring, outlen); if (writeresult != outlen) ERRORMSGFATAL(strerror(errno)); freewrapper(outstring); } } /* this one assumes it must free desc after doing the log */ void log_giveentry(int type, FTPSTATE *peer, char *desc) { log_addentry(type, peer, desc); freewrapper(desc); } void debuglog(char *format, ...) { #ifdef DEBUG char *logmsg; va_list ap; int len; va_start(ap, format); len = vsnprintf(NULL, 0, format, ap); va_end(ap); va_start(ap, format); logmsg = safe_vsnprintf(len, format, ap); va_end(ap); log_addentry(MYLOG_DEBUG, NULL, logmsg); freewrapper(logmsg); #endif } void log_shutdown(void) { if (logoutfd != -1) close(logoutfd); } muddleftpd-1.3.13.1/src/main.c0100644000175000017500000003041407737077256014772 0ustar joergjoerg/* Copyright 2000 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" #include "reply.h" extern int nummalloc; /* number of areas malloced at once */ int signumber; pid_t *deadlist; int deadcount; void logfullmessage(int error, unsigned int ip) { switch(error) { case HOSTFULL: log_addentry(MYLOG_INFO, NULL, "main maxusers limit reached. Server full"); break; case GROUPFULL: log_addentry(MYLOG_INFO, NULL, "group maxusers limit reached. User denied"); break; case VSERVERFULL: log_addentry(MYLOG_INFO, NULL, "virtual server maxusers limit reached. User denied"); break; case IPHOSTFULL: log_giveentry(MYLOG_INFO, NULL, safe_snprintf("main connections per ip reached for %s", getipstr(ip))); break; case IPVSERVERFULL: log_giveentry(MYLOG_INFO, NULL, safe_snprintf("virtual server maximum connections per ip reached for %s", getipstr(ip))); break; default: log_addentry(MYLOG_INFO, NULL, "Unknown host error."); } } VSERVER *findvserver(unsigned int ip, int port) { VSERVERCONN *vs; vs = config->inports; while (vs != NULL) { if (vs->port == port) if ((vs->ip == 0) || (vs->ip == ip)) return(vs->vptr); vs = vs->next; } return(NULL); } /* this function finds all ports binding to multiple ip and uses a single bind to use fewer fd's. It runs in N^2 time, but shouldn't be too slow even for very large sites. */ void smartbind(SELECTER *selset, VSERVERCONN *list, int dodie) { VSERVERCONN *pos, *spos; int dobind, fd; unsigned int bindip; pos = list; while(pos != NULL) { /* make sure port hasn't already been bound */ spos = list; dobind = TRUE; /* assume the bind goes ahead */ bindip = pos->ip; /* assume binding to a single port */ fd = -1; /* see if port number is in any ealier binds. If so, then no need to bind this address */ while((spos != pos) && (dobind)) { if (spos->port == pos->port) { fd = spos->fd; dobind = FALSE; } spos = spos->next; } if (dobind) { unsigned int zeroip; getnetworkint("0.0.0.0", &zeroip); spos = pos->next; /* now search for binds to this address later in the chain. Set ip to 0.0.0.0 if this is the case */ while((spos != NULL) && (bindip != zeroip)) { if (spos->port == pos->port) bindip = zeroip; spos = spos->next; } /* see if we need to bind to zero instead of bindip */ if ((config->zerobind) && (bindip != zeroip)) { bindip = zeroip; } /* now actually bind it */ pos->fd = inport_bind(pos->port, bindip, dodie); if (pos->fd != -1) { select_addfd(selset, pos->fd); if (bindip == pos->ip) select_addread(selset, pos->fd, inport_getconn, pos); else select_addread(selset, pos->fd, inport_getconn, NULL); } } else pos->fd = fd; pos = pos->next; } } /* This function does binding the dumb way. It runs in N time, but consumes more file descriptors. However, it also doesn't bind to unneeded ip/port combinations and is more robust. */ void dumbbind(SELECTER *selset, VSERVERCONN *list, int dodie) { VSERVERCONN *pos = list; while(pos != NULL) { pos->fd = inport_bind(pos->port, pos->ip, dodie); if (pos->fd != -1) { select_addfd(selset, pos->fd); select_addread(selset, pos->fd, inport_getconn, pos); } pos = pos->next; } } void sighandler(int signum) { signumber = signum; debuglog("main got a signal %d", signum); if (signum == SIGCHLD) { int errno2, result; pid_t deadpid; debuglog("sighandler - main waiting for child!"); errno2 = errno; while((deadpid = waitpid(0, &result, WNOHANG)) > 0) { debuglog("pid %d died with result %d!", deadpid, result); deadlist[deadcount] = deadpid; deadcount += 1; } errno = errno2; debuglog("sighandler - main child %d finished!", (int)deadpid); signal(SIGCHLD, sighandler); } else if (signum == SIGUSR1) { signal(SIGUSR1, sighandler); } } int mainprog(char *fconfig, int runforeground, int verbose) { int signum = 0; SELECTER *mainports; #ifdef RLIMIT_NPROC struct rlimit newlimit; #endif test_libc(verbose); setsid(); signal(SIGIO, SIG_IGN); signal(SIGPIPE, SIG_IGN); signal(SIGTERM, sighandler); signal(SIGHUP, sighandler); signal(SIGCHLD, sighandler); signal(SIGUSR1, sighandler); signal(SIGINT, sighandler); logerrors = TERMINAL; /* close all file descriptiors */ fd_closeall_nonterminal(); init_pwgrfiles(); ftpd_init(fconfig, verbose); config->toobusycount = 0; deadlist = mallocwrapper(sizeof(pid_t) * config->defaults->maxusers + 1); deadcount = 0; logerrors = MUDLOG; mainports = select_new(); /* Set process limit very high so that the 'poor user' doesn't need to worry about setting it */ #ifdef RLIMIT_NPROC getrlimit(RLIMIT_NPROC, &newlimit); newlimit.rlim_cur += config->defaults->maxusers + 1; newlimit.rlim_max += config->defaults->maxusers + 1; setrlimit(RLIMIT_NPROC, &newlimit); #endif /* Listen to all the input sockets, they are changed to the fd */ if (config->smartbind) smartbind(mainports, config->inports, TRUE); else dumbbind(mainports, config->inports, TRUE); if (((int)config->uidt_asuid != (int)getuid()) || ((int)config->gidt_asgid != (int)getgid())) { if ((int)getuid() == 0) { if (verbose) printf("Switching to user '%s' (UID: %d, GID %d)\n", config->username, (int)config->uidt_asuid, (int)config->gidt_asgid); /* Tell the parent the terminal can be given back! */ /* It must be done before we change uid because we lose permission to do so after the setuid! */ if (!runforeground) kill(getppid(), SIGHUP); /* Changing user to the one the user wanted */ setgid(config->gidt_asgid); setuid(config->uidt_asuid); } else ERRORMSGFATAL("The server does not have permission to switch to the specified user."); } else { if (!runforeground) /* Tell the parent the terminal can be given back! */ kill(getppid(), SIGHUP); } /* close terminal file descriptors */ if (!runforeground) { close(0); close(1); close(2); } log_addentry(MYLOG_INFO, NULL, PROGNAME" ("VERSTR") server started. Waiting on connections."); while ((signum != SIGTERM) && (signum != SIGINT)) { select_do(mainports, &signum, -1); blockallsignals(); if (deadcount > 0) { shinfo_freethreads(deadcount, deadlist); deadcount = 0; } if ((signum == SIGHUP) && (config->username == NULL)) { /* rebuild configuration */ CONFIGDATA *newdata; int result; log_addentry(MYLOG_INFO, NULL, "Received SIGHUP, reloading configuration"); newdata = ftpd_loadconfig(fconfig, FALSE, config->defaults->umask); if (newdata) result = ftpd_checkconfig(newdata); if ((!newdata) || (!result)) { log_addentry(MYLOG_INFO, NULL, "Errors reloading config file, resuming old config"); if (newdata) ftpd_killconfig(newdata); } else { int t = config->toobusycount; ftpd_killconfig(config); config = newdata; config->toobusycount = t; log_shutdown(); log_setcontext(config->logout, config->defaults->loglevel); log_addentry(MYLOG_INFO, NULL, "New configuration loaded, using new configuration"); select_shutdown(mainports); mainports = select_new(); if (config->smartbind) smartbind(mainports, config->inports, FALSE); else dumbbind(mainports, config->inports, FALSE); shinfo_reinit(); } signal(SIGHUP, sighandler); } else if ((signum == SIGHUP) && (config->username != NULL)) log_addentry(MYLOG_INFO, NULL, "You cannot reload the configuration while using the runasuser directive"); else if (signum == SIGUSR1) { int newcontext = log_initcontext(config->defaults->logfile); if (newcontext == -1) log_giveentry(MYLOG_INFO, NULL, safe_snprintf("Could not open logfile '%s', couldn't reopen.", config->defaults->logfile)); else { config->logout = newcontext; log_shutdown(); pnums_signalchildren(SIGUSR1); log_setcontext(config->logout, config->defaults->loglevel); log_addentry(MYLOG_INFO, NULL, "Log file reopened after SIGUSR1."); } } unblockallsignals(); signal(SIGIO, SIG_IGN); signal(SIGHUP, sighandler); } shinfo_shutdown(); select_shutdown(mainports); log_addentry(MYLOG_INFO, NULL, PROGNAME" ("VERSTR") server shutting down."); freewrapper(deadlist); ftpd_killconfig(config); log_shutdown(); kill_uidgidfiles(); exit(0); } void mainprog_inetd(char *fconfig, unsigned int ip) { char *scratchfile; int tnum, port, result; unsigned int ipl; VSERVER *vserver; int error; test_libc(0); inetd = TRUE; signal(SIGUSR1, sighandler); init_pwgrfiles(); logerrors = SYSLOG; ftpd_preinit(); config = ftpd_loadconfig(fconfig, TRUE, umask(0)); if (config) result = ftpd_checkconfig(config); if ((!config) || (!result)) ERRORMSGFATAL("Errors loading config file, cannot continue!"); log_setcontext(config->logout, config->defaults->loglevel); result = getsectionid(config->configfile, "main"); loadstrfromconfig(config->configfile, result, "scratchfile", &scratchfile, SCRATCHFILE); if (scratchfile[0] != '/') ERRORMSGFATAL("Scratchfile is not a valid absolute filename"); ftpd_setnogroups(); signal(SIGPIPE, SIG_IGN); signal(SIGTERM, sighandler); signal(SIGHUP, sighandler); inetd_init(scratchfile); if (((int)config->uidt_asuid != (int)getuid()) || ((int)config->gidt_asgid != (int)getgid())) { if (getuid() == 0) { setgid(config->gidt_asgid); setuid(config->uidt_asuid); } } /* get the virtual server the user connected to! */ getsockinfo(0, &ipl, &port); vserver = findvserver(ipl, port); if (vserver == NULL) exit(0); tnum = shinfo_adduser_inetd(ip, config->defaults->maxusers, config->defaults->maxperip, &error); if (tnum != -1) result = shinfo_setvserver(tnum, vserver->sectionname, ip, vserver->maxusers, vserver->maxperip, &error); if ((result) && (tnum != -1)) ftpserverside_main(0, ip, tnum, port, vserver); else { if (vserver->toobusy) write(0, vserver->toobusy, strlen(vserver->toobusy)); else write(0, REPLY_SERVERBUSY, strlen(REPLY_SERVERBUSY)); logfullmessage(error, ip); } ftpd_killconfig(config); kill_uidgidfiles(); exit(0); } void diehandler(int signum) { exit(0); } void usage(char *name) { printf(PROGNAME": ftp daemon.\n\n"); printf("Usage: %s [-V][-d][-h][-c configfile]\n\n", name); printf(" -V Show version information.\n"); printf(" -v Verbose startup.\n"); printf(" -d Debug mode. Does not fork into background.\n"); printf(" -h Show usage information.\n"); printf(" -c configfile Specify an alternative config file.\n\n"); exit(1); } int main(int argc, char **argv) { unsigned int ip; pid_t forkresult; int verbose = FALSE; int ch; int runforeground = FALSE; char *fconfig = NULL; extern char *optarg; while((ch = getopt(argc, argv, "Vvc:hd")) != EOF) { switch(ch) { case 'V': showversion(PROGNAME); case 'v': verbose = TRUE; break; case 'c': fconfig = optarg; break; case 'd': runforeground = TRUE; break; case 'h': default: usage(argv[0]); } } if (fconfig == NULL) fconfig = CONFIGFILE; if ((ip = getremoteip(fileno(stdin))) != 1) mainprog_inetd(fconfig, ip); inetd = FALSE; signal(SIGCHLD, diehandler); signal(SIGHUP, diehandler); if (!runforeground) { forkresult = fork(); if ((int)forkresult == -1) ERRORMSGFATAL("Could not fork into background"); if ((int)forkresult == 0) mainprog(fconfig, FALSE, verbose); /* wait forever for the child to die or give us a Hangup signal */ while(TRUE) pause(); } else mainprog(fconfig, TRUE, verbose); return(0); } muddleftpd-1.3.13.1/src/malloc.c0100644000175000017500000031400107737077257015313 0ustar joergjoerg/* ---------- To make a malloc.h, start cutting here ------------ */ /* A version of malloc/free/realloc written by Doug Lea and released to the public domain. Send questions/comments/complaints/performance data to dl@cs.oswego.edu * VERSION 2.6.6 Sun Mar 5 19:10:03 2000 Doug Lea (dl at gee) Note: There may be an updated version of this malloc obtainable at ftp://g.oswego.edu/pub/misc/malloc.c Check before installing! * Why use this malloc? This is not the fastest, most space-conserving, most portable, or most tunable malloc ever written. However it is among the fastest while also being among the most space-conserving, portable and tunable. Consistent balance across these factors results in a good general-purpose allocator. For a high-level description, see http://g.oswego.edu/dl/html/malloc.html * Synopsis of public routines (Much fuller descriptions are contained in the program documentation below.) malloc(size_t n); Return a pointer to a newly allocated chunk of at least n bytes, or null if no space is available. free(Void_t* p); Release the chunk of memory pointed to by p, or no effect if p is null. realloc(Void_t* p, size_t n); Return a pointer to a chunk of size n that contains the same data as does chunk p up to the minimum of (n, p's size) bytes, or null if no space is available. The returned pointer may or may not be the same as p. If p is null, equivalent to malloc. Unless the #define REALLOC_ZERO_BYTES_FREES below is set, realloc with a size argument of zero (re)allocates a minimum-sized chunk. memalign(size_t alignment, size_t n); Return a pointer to a newly allocated chunk of n bytes, aligned in accord with the alignment argument, which must be a power of two. valloc(size_t n); Equivalent to memalign(pagesize, n), where pagesize is the page size of the system (or as near to this as can be figured out from all the includes/defines below.) pvalloc(size_t n); Equivalent to valloc(minimum-page-that-holds(n)), that is, round up n to nearest pagesize. calloc(size_t unit, size_t quantity); Returns a pointer to quantity * unit bytes, with all locations set to zero. cfree(Void_t* p); Equivalent to free(p). malloc_trim(size_t pad); Release all but pad bytes of freed top-most memory back to the system. Return 1 if successful, else 0. malloc_usable_size(Void_t* p); Report the number usable allocated bytes associated with allocated chunk p. This may or may not report more bytes than were requested, due to alignment and minimum size constraints. malloc_stats(); Prints brief summary statistics on stderr. mallinfo() Returns (by copy) a struct containing various summary statistics. mallopt(int parameter_number, int parameter_value) Changes one of the tunable parameters described below. Returns 1 if successful in changing the parameter, else 0. * Vital statistics: Alignment: 8-byte 8 byte alignment is currently hardwired into the design. This seems to suffice for all current machines and C compilers. Assumed pointer representation: 4 or 8 bytes Code for 8-byte pointers is untested by me but has worked reliably by Wolfram Gloger, who contributed most of the changes supporting this. Assumed size_t representation: 4 or 8 bytes Note that size_t is allowed to be 4 bytes even if pointers are 8. Minimum overhead per allocated chunk: 4 or 8 bytes Each malloced chunk has a hidden overhead of 4 bytes holding size and status information. Minimum allocated size: 4-byte ptrs: 16 bytes (including 4 overhead) 8-byte ptrs: 24/32 bytes (including, 4/8 overhead) When a chunk is freed, 12 (for 4byte ptrs) or 20 (for 8 byte ptrs but 4 byte size) or 24 (for 8/8) additional bytes are needed; 4 (8) for a trailing size field and 8 (16) bytes for free list pointers. Thus, the minimum allocatable size is 16/24/32 bytes. Even a request for zero bytes (i.e., malloc(0)) returns a pointer to something of the minimum allocatable size. Maximum allocated size: 4-byte size_t: 2^31 - 8 bytes 8-byte size_t: 2^63 - 16 bytes It is assumed that (possibly signed) size_t bit values suffice to represent chunk sizes. `Possibly signed' is due to the fact that `size_t' may be defined on a system as either a signed or an unsigned type. To be conservative, values that would appear as negative numbers are avoided. Requests for sizes with a negative sign bit when the request size is treaded as a long will return null. Maximum overhead wastage per allocated chunk: normally 15 bytes Alignnment demands, plus the minimum allocatable size restriction make the normal worst-case wastage 15 bytes (i.e., up to 15 more bytes will be allocated than were requested in malloc), with two exceptions: 1. Because requests for zero bytes allocate non-zero space, the worst case wastage for a request of zero bytes is 24 bytes. 2. For requests >= mmap_threshold that are serviced via mmap(), the worst case wastage is 8 bytes plus the remainder from a system page (the minimal mmap unit); typically 4096 bytes. * Limitations Here are some features that are NOT currently supported * No user-definable hooks for callbacks and the like. * No automated mechanism for fully checking that all accesses to malloced memory stay within their bounds. * No support for compaction. * Synopsis of compile-time options: People have reported using previous versions of this malloc on all versions of Unix, sometimes by tweaking some of the defines below. It has been tested most extensively on Solaris and Linux. It is also reported to work on WIN32 platforms. People have also reported adapting this malloc for use in stand-alone embedded systems. The implementation is in straight, hand-tuned ANSI C. Among other consequences, it uses a lot of macros. Because of this, to be at all usable, this code should be compiled using an optimizing compiler (for example gcc -O2) that can simplify expressions and control paths. __STD_C (default: derived from C compiler defines) Nonzero if using ANSI-standard C compiler, a C++ compiler, or a C compiler sufficiently close to ANSI to get away with it. DEBUG (default: NOT defined) Define to enable debugging. Adds fairly extensive assertion-based checking to help track down memory errors, but noticeably slows down execution. REALLOC_ZERO_BYTES_FREES (default: NOT defined) Define this if you think that realloc(p, 0) should be equivalent to free(p). Otherwise, since malloc returns a unique pointer for malloc(0), so does realloc(p, 0). HAVE_MEMCPY (default: defined) Define if you are not otherwise using ANSI STD C, but still have memcpy and memset in your C library and want to use them. Otherwise, simple internal versions are supplied. USE_MEMCPY (default: 1 if HAVE_MEMCPY is defined, 0 otherwise) Define as 1 if you want the C library versions of memset and memcpy called in realloc and calloc (otherwise macro versions are used). At least on some platforms, the simple macro versions usually outperform libc versions. HAVE_MMAP (default: defined as 1) Define to non-zero to optionally make malloc() use mmap() to allocate very large blocks. HAVE_MREMAP (default: defined as 0 unless Linux libc set) Define to non-zero to optionally make realloc() use mremap() to reallocate very large blocks. malloc_getpagesize (default: derived from system #includes) Either a constant or routine call returning the system page size. HAVE_USR_INCLUDE_MALLOC_H (default: NOT defined) Optionally define if you are on a system with a /usr/include/malloc.h that declares struct mallinfo. It is not at all necessary to define this even if you do, but will ensure consistency. INTERNAL_SIZE_T (default: size_t) Define to a 32-bit type (probably `unsigned int') if you are on a 64-bit machine, yet do not want or need to allow malloc requests of greater than 2^31 to be handled. This saves space, especially for very small chunks. INTERNAL_LINUX_C_LIB (default: NOT defined) Defined only when compiled as part of Linux libc. Also note that there is some odd internal name-mangling via defines (for example, internally, `malloc' is named `mALLOc') needed when compiling in this case. These look funny but don't otherwise affect anything. WIN32 (default: undefined) Define this on MS win (95, nt) platforms to compile in sbrk emulation. LACKS_UNISTD_H (default: undefined if not WIN32) Define this if your system does not have a . LACKS_SYS_PARAM_H (default: undefined if not WIN32) Define this if your system does not have a . MORECORE (default: sbrk) The name of the routine to call to obtain more memory from the system. MORECORE_FAILURE (default: -1) The value returned upon failure of MORECORE. MORECORE_CLEARS (default 1) True (1) if the routine mapped to MORECORE zeroes out memory (which holds for sbrk). DEFAULT_TRIM_THRESHOLD DEFAULT_TOP_PAD DEFAULT_MMAP_THRESHOLD DEFAULT_MMAP_MAX Default values of tunable parameters (described in detail below) controlling interaction with host system routines (sbrk, mmap, etc). These values may also be changed dynamically via mallopt(). The preset defaults are those that give best performance for typical programs/systems. USE_DL_PREFIX (default: undefined) Prefix all public routines with the string 'dl'. Useful to quickly avoid procedure declaration conflicts and linker symbol conflicts with existing memory allocation routines. */ /* Preliminaries */ #ifndef __STD_C #ifdef __STDC__ #define __STD_C 1 #else #if __cplusplus #define __STD_C 1 #else #define __STD_C 0 #endif /*__cplusplus*/ #endif /*__STDC__*/ #endif /*__STD_C*/ #ifndef Void_t #if (__STD_C || defined(WIN32)) #define Void_t void #else #define Void_t char #endif #endif /*Void_t*/ #if __STD_C #include /* for size_t */ #else #include #endif #ifdef __cplusplus extern "C" { #endif #include /* needed for malloc_stats */ /* Compile-time options */ /* Debugging: Because freed chunks may be overwritten with link fields, this malloc will often die when freed memory is overwritten by user programs. This can be very effective (albeit in an annoying way) in helping track down dangling pointers. If you compile with -DDEBUG, a number of assertion checks are enabled that will catch more memory errors. You probably won't be able to make much sense of the actual assertion errors, but they should help you locate incorrectly overwritten memory. The checking is fairly extensive, and will slow down execution noticeably. Calling malloc_stats or mallinfo with DEBUG set will attempt to check every non-mmapped allocated and free chunk in the course of computing the summmaries. (By nature, mmapped regions cannot be checked very much automatically.) Setting DEBUG may also be helpful if you are trying to modify this code. The assertions in the check routines spell out in more detail the assumptions and invariants underlying the algorithms. */ #if DEBUG #include #else #define assert(x) ((void)0) #endif /* INTERNAL_SIZE_T is the word-size used for internal bookkeeping of chunk sizes. On a 64-bit machine, you can reduce malloc overhead by defining INTERNAL_SIZE_T to be a 32 bit `unsigned int' at the expense of not being able to handle requests greater than 2^31. This limitation is hardly ever a concern; you are encouraged to set this. However, the default version is the same as size_t. */ #ifndef INTERNAL_SIZE_T #define INTERNAL_SIZE_T size_t #endif /* REALLOC_ZERO_BYTES_FREES should be set if a call to realloc with zero bytes should be the same as a call to free. Some people think it should. Otherwise, since this malloc returns a unique pointer for malloc(0), so does realloc(p, 0). */ /* #define REALLOC_ZERO_BYTES_FREES */ /* WIN32 causes an emulation of sbrk to be compiled in mmap-based options are not currently supported in WIN32. */ /* #define WIN32 */ #ifdef WIN32 #define MORECORE wsbrk #define HAVE_MMAP 0 #define LACKS_UNISTD_H #define LACKS_SYS_PARAM_H /* Include 'windows.h' to get the necessary declarations for the Microsoft Visual C++ data structures and routines used in the 'sbrk' emulation. Define WIN32_LEAN_AND_MEAN so that only the essential Microsoft Visual C++ header files are included. */ #define WIN32_LEAN_AND_MEAN #include #endif /* HAVE_MEMCPY should be defined if you are not otherwise using ANSI STD C, but still have memcpy and memset in your C library and want to use them in calloc and realloc. Otherwise simple macro versions are defined here. USE_MEMCPY should be defined as 1 if you actually want to have memset and memcpy called. People report that the macro versions are often enough faster than libc versions on many systems that it is better to use them. */ #define HAVE_MEMCPY #ifndef USE_MEMCPY #ifdef HAVE_MEMCPY #define USE_MEMCPY 1 #else #define USE_MEMCPY 0 #endif #endif #if (__STD_C || defined(HAVE_MEMCPY)) #if __STD_C void* memset(void*, int, size_t); void* memcpy(void*, const void*, size_t); #else #ifdef WIN32 // On Win32 platforms, 'memset()' and 'memcpy()' are already declared in // 'windows.h' #else Void_t* memset(); Void_t* memcpy(); #endif #endif #endif #if USE_MEMCPY /* The following macros are only invoked with (2n+1)-multiples of INTERNAL_SIZE_T units, with a positive integer n. This is exploited for fast inline execution when n is small. */ #define MALLOC_ZERO(charp, nbytes) \ do { \ INTERNAL_SIZE_T mzsz = (nbytes); \ if(mzsz <= 9*sizeof(mzsz)) { \ INTERNAL_SIZE_T* mz = (INTERNAL_SIZE_T*) (charp); \ if(mzsz >= 5*sizeof(mzsz)) { *mz++ = 0; \ *mz++ = 0; \ if(mzsz >= 7*sizeof(mzsz)) { *mz++ = 0; \ *mz++ = 0; \ if(mzsz >= 9*sizeof(mzsz)) { *mz++ = 0; \ *mz++ = 0; }}} \ *mz++ = 0; \ *mz++ = 0; \ *mz = 0; \ } else memset((charp), 0, mzsz); \ } while(0) #define MALLOC_COPY(dest,src,nbytes) \ do { \ INTERNAL_SIZE_T mcsz = (nbytes); \ if(mcsz <= 9*sizeof(mcsz)) { \ INTERNAL_SIZE_T* mcsrc = (INTERNAL_SIZE_T*) (src); \ INTERNAL_SIZE_T* mcdst = (INTERNAL_SIZE_T*) (dest); \ if(mcsz >= 5*sizeof(mcsz)) { *mcdst++ = *mcsrc++; \ *mcdst++ = *mcsrc++; \ if(mcsz >= 7*sizeof(mcsz)) { *mcdst++ = *mcsrc++; \ *mcdst++ = *mcsrc++; \ if(mcsz >= 9*sizeof(mcsz)) { *mcdst++ = *mcsrc++; \ *mcdst++ = *mcsrc++; }}} \ *mcdst++ = *mcsrc++; \ *mcdst++ = *mcsrc++; \ *mcdst = *mcsrc ; \ } else memcpy(dest, src, mcsz); \ } while(0) #else /* !USE_MEMCPY */ /* Use Duff's device for good zeroing/copying performance. */ #define MALLOC_ZERO(charp, nbytes) \ do { \ INTERNAL_SIZE_T* mzp = (INTERNAL_SIZE_T*)(charp); \ long mctmp = (nbytes)/sizeof(INTERNAL_SIZE_T), mcn; \ if (mctmp < 8) mcn = 0; else { mcn = (mctmp-1)/8; mctmp %= 8; } \ switch (mctmp) { \ case 0: for(;;) { *mzp++ = 0; \ case 7: *mzp++ = 0; \ case 6: *mzp++ = 0; \ case 5: *mzp++ = 0; \ case 4: *mzp++ = 0; \ case 3: *mzp++ = 0; \ case 2: *mzp++ = 0; \ case 1: *mzp++ = 0; if(mcn <= 0) break; mcn--; } \ } \ } while(0) #define MALLOC_COPY(dest,src,nbytes) \ do { \ INTERNAL_SIZE_T* mcsrc = (INTERNAL_SIZE_T*) src; \ INTERNAL_SIZE_T* mcdst = (INTERNAL_SIZE_T*) dest; \ long mctmp = (nbytes)/sizeof(INTERNAL_SIZE_T), mcn; \ if (mctmp < 8) mcn = 0; else { mcn = (mctmp-1)/8; mctmp %= 8; } \ switch (mctmp) { \ case 0: for(;;) { *mcdst++ = *mcsrc++; \ case 7: *mcdst++ = *mcsrc++; \ case 6: *mcdst++ = *mcsrc++; \ case 5: *mcdst++ = *mcsrc++; \ case 4: *mcdst++ = *mcsrc++; \ case 3: *mcdst++ = *mcsrc++; \ case 2: *mcdst++ = *mcsrc++; \ case 1: *mcdst++ = *mcsrc++; if(mcn <= 0) break; mcn--; } \ } \ } while(0) #endif /* Define HAVE_MMAP to optionally make malloc() use mmap() to allocate very large blocks. These will be returned to the operating system immediately after a free(). */ #ifndef HAVE_MMAP #define HAVE_MMAP 1 #endif /* Define HAVE_MREMAP to make realloc() use mremap() to re-allocate large blocks. This is currently only possible on Linux with kernel versions newer than 1.3.77. */ #ifndef HAVE_MREMAP #ifdef INTERNAL_LINUX_C_LIB #define HAVE_MREMAP 1 #else #define HAVE_MREMAP 0 #endif #endif #if HAVE_MMAP #include #include #include #if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) #define MAP_ANONYMOUS MAP_ANON #endif #endif /* HAVE_MMAP */ /* Access to system page size. To the extent possible, this malloc manages memory from the system in page-size units. The following mechanics for getpagesize were adapted from bsd/gnu getpagesize.h */ #ifndef LACKS_UNISTD_H # include #endif #ifndef malloc_getpagesize # ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */ # ifndef _SC_PAGE_SIZE # define _SC_PAGE_SIZE _SC_PAGESIZE # endif # endif # ifdef _SC_PAGE_SIZE # define malloc_getpagesize sysconf(_SC_PAGE_SIZE) # else # if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE) extern size_t getpagesize(); # define malloc_getpagesize getpagesize() # else # ifdef WIN32 # define malloc_getpagesize (4096) /* TBD: Use 'GetSystemInfo' instead */ # else # ifndef LACKS_SYS_PARAM_H # include # endif # ifdef EXEC_PAGESIZE # define malloc_getpagesize EXEC_PAGESIZE # else # ifdef NBPG # ifndef CLSIZE # define malloc_getpagesize NBPG # else # define malloc_getpagesize (NBPG * CLSIZE) # endif # else # ifdef NBPC # define malloc_getpagesize NBPC # else # ifdef PAGESIZE # define malloc_getpagesize PAGESIZE # else # define malloc_getpagesize (4096) /* just guess */ # endif # endif # endif # endif # endif # endif # endif #endif /* This version of malloc supports the standard SVID/XPG mallinfo routine that returns a struct containing the same kind of information you can get from malloc_stats. It should work on any SVID/XPG compliant system that has a /usr/include/malloc.h defining struct mallinfo. (If you'd like to install such a thing yourself, cut out the preliminary declarations as described above and below and save them in a malloc.h file. But there's no compelling reason to bother to do this.) The main declaration needed is the mallinfo struct that is returned (by-copy) by mallinfo(). The SVID/XPG malloinfo struct contains a bunch of fields, most of which are not even meaningful in this version of malloc. Some of these fields are are instead filled by mallinfo() with other numbers that might possibly be of interest. HAVE_USR_INCLUDE_MALLOC_H should be set if you have a /usr/include/malloc.h file that includes a declaration of struct mallinfo. If so, it is included; else an SVID2/XPG2 compliant version is declared below. These must be precisely the same for mallinfo() to work. */ /* #define HAVE_USR_INCLUDE_MALLOC_H */ #if HAVE_USR_INCLUDE_MALLOC_H #include "/usr/include/malloc.h" #else /* SVID2/XPG mallinfo structure */ struct mallinfo { int arena; /* total space allocated from system */ int ordblks; /* number of non-inuse chunks */ int smblks; /* unused -- always zero */ int hblks; /* number of mmapped regions */ int hblkhd; /* total space in mmapped regions */ int usmblks; /* unused -- always zero */ int fsmblks; /* unused -- always zero */ int uordblks; /* total allocated space */ int fordblks; /* total non-inuse space */ int keepcost; /* top-most, releasable (via malloc_trim) space */ }; /* SVID2/XPG mallopt options */ #define M_MXFAST 1 /* UNUSED in this malloc */ #define M_NLBLKS 2 /* UNUSED in this malloc */ #define M_GRAIN 3 /* UNUSED in this malloc */ #define M_KEEP 4 /* UNUSED in this malloc */ #endif /* mallopt options that actually do something */ #define M_TRIM_THRESHOLD -1 #define M_TOP_PAD -2 #define M_MMAP_THRESHOLD -3 #define M_MMAP_MAX -4 #ifndef DEFAULT_TRIM_THRESHOLD #define DEFAULT_TRIM_THRESHOLD (128 * 1024) #endif /* M_TRIM_THRESHOLD is the maximum amount of unused top-most memory to keep before releasing via malloc_trim in free(). Automatic trimming is mainly useful in long-lived programs. Because trimming via sbrk can be slow on some systems, and can sometimes be wasteful (in cases where programs immediately afterward allocate more large chunks) the value should be high enough so that your overall system performance would improve by releasing. The trim threshold and the mmap control parameters (see below) can be traded off with one another. Trimming and mmapping are two different ways of releasing unused memory back to the system. Between these two, it is often possible to keep system-level demands of a long-lived program down to a bare minimum. For example, in one test suite of sessions measuring the XF86 X server on Linux, using a trim threshold of 128K and a mmap threshold of 192K led to near-minimal long term resource consumption. If you are using this malloc in a long-lived program, it should pay to experiment with these values. As a rough guide, you might set to a value close to the average size of a process (program) running on your system. Releasing this much memory would allow such a process to run in memory. Generally, it's worth it to tune for trimming rather tham memory mapping when a program undergoes phases where several large chunks are allocated and released in ways that can reuse each other's storage, perhaps mixed with phases where there are no such chunks at all. And in well-behaved long-lived programs, controlling release of large blocks via trimming versus mapping is usually faster. However, in most programs, these parameters serve mainly as protection against the system-level effects of carrying around massive amounts of unneeded memory. Since frequent calls to sbrk, mmap, and munmap otherwise degrade performance, the default parameters are set to relatively high values that serve only as safeguards. The default trim value is high enough to cause trimming only in fairly extreme (by current memory consumption standards) cases. It must be greater than page size to have any useful effect. To disable trimming completely, you can set to (unsigned long)(-1); */ #ifndef DEFAULT_TOP_PAD #define DEFAULT_TOP_PAD (0) #endif /* M_TOP_PAD is the amount of extra `padding' space to allocate or retain whenever sbrk is called. It is used in two ways internally: * When sbrk is called to extend the top of the arena to satisfy a new malloc request, this much padding is added to the sbrk request. * When malloc_trim is called automatically from free(), it is used as the `pad' argument. In both cases, the actual amount of padding is rounded so that the end of the arena is always a system page boundary. The main reason for using padding is to avoid calling sbrk so often. Having even a small pad greatly reduces the likelihood that nearly every malloc request during program start-up (or after trimming) will invoke sbrk, which needlessly wastes time. Automatic rounding-up to page-size units is normally sufficient to avoid measurable overhead, so the default is 0. However, in systems where sbrk is relatively slow, it can pay to increase this value, at the expense of carrying around more memory than the program needs. */ #ifndef DEFAULT_MMAP_THRESHOLD #define DEFAULT_MMAP_THRESHOLD (128 * 1024) #endif /* M_MMAP_THRESHOLD is the request size threshold for using mmap() to service a request. Requests of at least this size that cannot be allocated using already-existing space will be serviced via mmap. (If enough normal freed space already exists it is used instead.) Using mmap segregates relatively large chunks of memory so that they can be individually obtained and released from the host system. A request serviced through mmap is never reused by any other request (at least not directly; the system may just so happen to remap successive requests to the same locations). Segregating space in this way has the benefit that mmapped space can ALWAYS be individually released back to the system, which helps keep the system level memory demands of a long-lived program low. Mapped memory can never become `locked' between other chunks, as can happen with normally allocated chunks, which menas that even trimming via malloc_trim would not release them. However, it has the disadvantages that: 1. The space cannot be reclaimed, consolidated, and then used to service later requests, as happens with normal chunks. 2. It can lead to more wastage because of mmap page alignment requirements 3. It causes malloc performance to be more dependent on host system memory management support routines which may vary in implementation quality and may impose arbitrary limitations. Generally, servicing a request via normal malloc steps is faster than going through a system's mmap. All together, these considerations should lead you to use mmap only for relatively large requests. */ #ifndef DEFAULT_MMAP_MAX #if HAVE_MMAP #define DEFAULT_MMAP_MAX (64) #else #define DEFAULT_MMAP_MAX (0) #endif #endif /* M_MMAP_MAX is the maximum number of requests to simultaneously service using mmap. This parameter exists because: 1. Some systems have a limited number of internal tables for use by mmap. 2. In most systems, overreliance on mmap can degrade overall performance. 3. If a program allocates many large regions, it is probably better off using normal sbrk-based allocation routines that can reclaim and reallocate normal heap memory. Using a small value allows transition into this mode after the first few allocations. Setting to 0 disables all use of mmap. If HAVE_MMAP is not set, the default value is 0, and attempts to set it to non-zero values in mallopt will fail. */ /* USE_DL_PREFIX will prefix all public routines with the string 'dl'. Useful to quickly avoid procedure declaration conflicts and linker symbol conflicts with existing memory allocation routines. */ /* #define USE_DL_PREFIX */ /* Special defines for linux libc Except when compiled using these special defines for Linux libc using weak aliases, this malloc is NOT designed to work in multithreaded applications. No semaphores or other concurrency control are provided to ensure that multiple malloc or free calls don't run at the same time, which could be disasterous. A single semaphore could be used across malloc, realloc, and free (which is essentially the effect of the linux weak alias approach). It would be hard to obtain finer granularity. */ #ifdef INTERNAL_LINUX_C_LIB #if __STD_C Void_t * __default_morecore_init (ptrdiff_t); Void_t *(*__morecore)(ptrdiff_t) = __default_morecore_init; #else Void_t * __default_morecore_init (); Void_t *(*__morecore)() = __default_morecore_init; #endif #define MORECORE (*__morecore) #define MORECORE_FAILURE 0 #define MORECORE_CLEARS 1 #else /* INTERNAL_LINUX_C_LIB */ #if __STD_C extern Void_t* sbrk(ptrdiff_t); #else extern Void_t* sbrk(); #endif #ifndef MORECORE #define MORECORE sbrk #endif #ifndef MORECORE_FAILURE #define MORECORE_FAILURE -1 #endif #ifndef MORECORE_CLEARS #define MORECORE_CLEARS 1 #endif #endif /* INTERNAL_LINUX_C_LIB */ #if defined(INTERNAL_LINUX_C_LIB) && defined(__ELF__) #define cALLOc __libc_calloc #define fREe __libc_free #define mALLOc __libc_malloc #define mEMALIGn __libc_memalign #define rEALLOc __libc_realloc #define vALLOc __libc_valloc #define pvALLOc __libc_pvalloc #define mALLINFo __libc_mallinfo #define mALLOPt __libc_mallopt #pragma weak calloc = __libc_calloc #pragma weak free = __libc_free #pragma weak cfree = __libc_free #pragma weak malloc = __libc_malloc #pragma weak memalign = __libc_memalign #pragma weak realloc = __libc_realloc #pragma weak valloc = __libc_valloc #pragma weak pvalloc = __libc_pvalloc #pragma weak mallinfo = __libc_mallinfo #pragma weak mallopt = __libc_mallopt #else #ifdef USE_DL_PREFIX #define cALLOc dlcalloc #define fREe dlfree #define mALLOc dlmalloc #define mEMALIGn dlmemalign #define rEALLOc dlrealloc #define vALLOc dlvalloc #define pvALLOc dlpvalloc #define mALLINFo dlmallinfo #define mALLOPt dlmallopt #else /* USE_DL_PREFIX */ #define cALLOc calloc #define fREe free #define mALLOc malloc #define mEMALIGn memalign #define rEALLOc realloc #define vALLOc valloc #define pvALLOc pvalloc #define mALLINFo mallinfo #define mALLOPt mallopt #endif /* USE_DL_PREFIX */ #endif /* Public routines */ #if __STD_C Void_t* mALLOc(size_t); void fREe(Void_t*); Void_t* rEALLOc(Void_t*, size_t); Void_t* mEMALIGn(size_t, size_t); Void_t* vALLOc(size_t); Void_t* pvALLOc(size_t); Void_t* cALLOc(size_t, size_t); void cfree(Void_t*); int malloc_trim(size_t); size_t malloc_usable_size(Void_t*); void malloc_stats(); int mALLOPt(int, int); struct mallinfo mALLINFo(void); #else Void_t* mALLOc(); void fREe(); Void_t* rEALLOc(); Void_t* mEMALIGn(); Void_t* vALLOc(); Void_t* pvALLOc(); Void_t* cALLOc(); void cfree(); int malloc_trim(); size_t malloc_usable_size(); void malloc_stats(); int mALLOPt(); struct mallinfo mALLINFo(); #endif #ifdef __cplusplus }; /* end of extern "C" */ #endif /* ---------- To make a malloc.h, end cutting here ------------ */ /* Emulation of sbrk for WIN32 All code within the ifdef WIN32 is untested by me. Thanks to Martin Fong and others for supplying this. */ #ifdef WIN32 #define AlignPage(add) (((add) + (malloc_getpagesize-1)) & \ ~(malloc_getpagesize-1)) #define AlignPage64K(add) (((add) + (0x10000 - 1)) & ~(0x10000 - 1)) /* resrve 64MB to insure large contiguous space */ #define RESERVED_SIZE (1024*1024*64) #define NEXT_SIZE (2048*1024) #define TOP_MEMORY ((unsigned long)2*1024*1024*1024) struct GmListElement; typedef struct GmListElement GmListElement; struct GmListElement { GmListElement* next; void* base; }; static GmListElement* head = 0; static unsigned int gNextAddress = 0; static unsigned int gAddressBase = 0; static unsigned int gAllocatedSize = 0; static GmListElement* makeGmListElement (void* bas) { GmListElement* this; this = (GmListElement*)(void*)LocalAlloc (0, sizeof (GmListElement)); assert (this); if (this) { this->base = bas; this->next = head; head = this; } return this; } void gcleanup () { BOOL rval; assert ( (head == NULL) || (head->base == (void*)gAddressBase)); if (gAddressBase && (gNextAddress - gAddressBase)) { rval = VirtualFree ((void*)gAddressBase, gNextAddress - gAddressBase, MEM_DECOMMIT); assert (rval); } while (head) { GmListElement* next = head->next; rval = VirtualFree (head->base, 0, MEM_RELEASE); assert (rval); LocalFree (head); head = next; } } static void* findRegion (void* start_address, unsigned long size) { MEMORY_BASIC_INFORMATION info; if (size >= TOP_MEMORY) return NULL; while ((unsigned long)start_address + size < TOP_MEMORY) { VirtualQuery (start_address, &info, sizeof (info)); if ((info.State == MEM_FREE) && (info.RegionSize >= size)) return start_address; else { // Requested region is not available so see if the // next region is available. Set 'start_address' // to the next region and call 'VirtualQuery()' // again. start_address = (char*)info.BaseAddress + info.RegionSize; // Make sure we start looking for the next region // on the *next* 64K boundary. Otherwise, even if // the new region is free according to // 'VirtualQuery()', the subsequent call to // 'VirtualAlloc()' (which follows the call to // this routine in 'wsbrk()') will round *down* // the requested address to a 64K boundary which // we already know is an address in the // unavailable region. Thus, the subsequent call // to 'VirtualAlloc()' will fail and bring us back // here, causing us to go into an infinite loop. start_address = (void *) AlignPage64K((unsigned long) start_address); } } return NULL; } void* wsbrk (long size) { void* tmp; if (size > 0) { if (gAddressBase == 0) { gAllocatedSize = max (RESERVED_SIZE, AlignPage (size)); gNextAddress = gAddressBase = (unsigned int)VirtualAlloc (NULL, gAllocatedSize, MEM_RESERVE, PAGE_NOACCESS); } else if (AlignPage (gNextAddress + size) > (gAddressBase + gAllocatedSize)) { long new_size = max (NEXT_SIZE, AlignPage (size)); void* new_address = (void*)(gAddressBase+gAllocatedSize); do { new_address = findRegion (new_address, new_size); if (new_address == 0) return (void*)-1; gAddressBase = gNextAddress = (unsigned int)VirtualAlloc (new_address, new_size, MEM_RESERVE, PAGE_NOACCESS); // repeat in case of race condition // The region that we found has been snagged // by another thread } while (gAddressBase == 0); assert (new_address == (void*)gAddressBase); gAllocatedSize = new_size; if (!makeGmListElement ((void*)gAddressBase)) return (void*)-1; } if ((size + gNextAddress) > AlignPage (gNextAddress)) { void* res; res = VirtualAlloc ((void*)AlignPage (gNextAddress), (size + gNextAddress - AlignPage (gNextAddress)), MEM_COMMIT, PAGE_READWRITE); if (res == 0) return (void*)-1; } tmp = (void*)gNextAddress; gNextAddress = (unsigned int)tmp + size; return tmp; } else if (size < 0) { unsigned int alignedGoal = AlignPage (gNextAddress + size); /* Trim by releasing the virtual memory */ if (alignedGoal >= gAddressBase) { VirtualFree ((void*)alignedGoal, gNextAddress - alignedGoal, MEM_DECOMMIT); gNextAddress = gNextAddress + size; return (void*)gNextAddress; } else { VirtualFree ((void*)gAddressBase, gNextAddress - gAddressBase, MEM_DECOMMIT); gNextAddress = gAddressBase; return (void*)-1; } } else { return (void*)gNextAddress; } } #endif /* Type declarations */ struct malloc_chunk { INTERNAL_SIZE_T prev_size; /* Size of previous chunk (if free). */ INTERNAL_SIZE_T size; /* Size in bytes, including overhead. */ struct malloc_chunk* fd; /* double links -- used only if free. */ struct malloc_chunk* bk; }; typedef struct malloc_chunk* mchunkptr; /* malloc_chunk details: (The following includes lightly edited explanations by Colin Plumb.) Chunks of memory are maintained using a `boundary tag' method as described in e.g., Knuth or Standish. (See the paper by Paul Wilson ftp://ftp.cs.utexas.edu/pub/garbage/allocsrv.ps for a survey of such techniques.) Sizes of free chunks are stored both in the front of each chunk and at the end. This makes consolidating fragmented chunks into bigger chunks very fast. The size fields also hold bits representing whether chunks are free or in use. An allocated chunk looks like this: chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Size of previous chunk, if allocated | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Size of chunk, in bytes |P| mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | User data starts here... . . . . (malloc_usable_space() bytes) . . | nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Size of chunk | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Where "chunk" is the front of the chunk for the purpose of most of the malloc code, but "mem" is the pointer that is returned to the user. "Nextchunk" is the beginning of the next contiguous chunk. Chunks always begin on even word boundries, so the mem portion (which is returned to the user) is also on an even word boundary, and thus double-word aligned. Free chunks are stored in circular doubly-linked lists, and look like this: chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Size of previous chunk | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ `head:' | Size of chunk, in bytes |P| mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Forward pointer to next chunk in list | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Back pointer to previous chunk in list | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Unused space (may be 0 bytes long) . . . . | nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ `foot:' | Size of chunk, in bytes | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ The P (PREV_INUSE) bit, stored in the unused low-order bit of the chunk size (which is always a multiple of two words), is an in-use bit for the *previous* chunk. If that bit is *clear*, then the word before the current chunk size contains the previous chunk size, and can be used to find the front of the previous chunk. (The very first chunk allocated always has this bit set, preventing access to non-existent (or non-owned) memory.) Note that the `foot' of the current chunk is actually represented as the prev_size of the NEXT chunk. (This makes it easier to deal with alignments etc). The two exceptions to all this are 1. The special chunk `top', which doesn't bother using the trailing size field since there is no next contiguous chunk that would have to index off it. (After initialization, `top' is forced to always exist. If it would become less than MINSIZE bytes long, it is replenished via malloc_extend_top.) 2. Chunks allocated via mmap, which have the second-lowest-order bit (IS_MMAPPED) set in their size fields. Because they are never merged or traversed from any other chunk, they have no foot size or inuse information. Available chunks are kept in any of several places (all declared below): * `av': An array of chunks serving as bin headers for consolidated chunks. Each bin is doubly linked. The bins are approximately proportionally (log) spaced. There are a lot of these bins (128). This may look excessive, but works very well in practice. All procedures maintain the invariant that no consolidated chunk physically borders another one. Chunks in bins are kept in size order, with ties going to the approximately least recently used chunk. The chunks in each bin are maintained in decreasing sorted order by size. This is irrelevant for the small bins, which all contain the same-sized chunks, but facilitates best-fit allocation for larger chunks. (These lists are just sequential. Keeping them in order almost never requires enough traversal to warrant using fancier ordered data structures.) Chunks of the same size are linked with the most recently freed at the front, and allocations are taken from the back. This results in LRU or FIFO allocation order, which tends to give each chunk an equal opportunity to be consolidated with adjacent freed chunks, resulting in larger free chunks and less fragmentation. * `top': The top-most available chunk (i.e., the one bordering the end of available memory) is treated specially. It is never included in any bin, is used only if no other chunk is available, and is released back to the system if it is very large (see M_TRIM_THRESHOLD). * `last_remainder': A bin holding only the remainder of the most recently split (non-top) chunk. This bin is checked before other non-fitting chunks, so as to provide better locality for runs of sequentially allocated chunks. * Implicitly, through the host system's memory mapping tables. If supported, requests greater than a threshold are usually serviced via calls to mmap, and then later released via munmap. */ /* sizes, alignments */ #define SIZE_SZ (sizeof(INTERNAL_SIZE_T)) #define MALLOC_ALIGNMENT (SIZE_SZ + SIZE_SZ) #define MALLOC_ALIGN_MASK (MALLOC_ALIGNMENT - 1) #define MINSIZE (sizeof(struct malloc_chunk)) /* conversion from malloc headers to user pointers, and back */ #define chunk2mem(p) ((Void_t*)((char*)(p) + 2*SIZE_SZ)) #define mem2chunk(mem) ((mchunkptr)((char*)(mem) - 2*SIZE_SZ)) /* pad request bytes into a usable size */ #define request2size(req) \ (((long)((req) + (SIZE_SZ + MALLOC_ALIGN_MASK)) < \ (long)(MINSIZE + MALLOC_ALIGN_MASK)) ? MINSIZE : \ (((req) + (SIZE_SZ + MALLOC_ALIGN_MASK)) & ~(MALLOC_ALIGN_MASK))) /* Check if m has acceptable alignment */ #define aligned_OK(m) (((unsigned long)((m)) & (MALLOC_ALIGN_MASK)) == 0) /* Physical chunk operations */ /* size field is or'ed with PREV_INUSE when previous adjacent chunk in use */ #define PREV_INUSE 0x1 /* size field is or'ed with IS_MMAPPED if the chunk was obtained with mmap() */ #define IS_MMAPPED 0x2 /* Bits to mask off when extracting size */ #define SIZE_BITS (PREV_INUSE|IS_MMAPPED) /* Ptr to next physical malloc_chunk. */ #define next_chunk(p) ((mchunkptr)( ((char*)(p)) + ((p)->size & ~PREV_INUSE) )) /* Ptr to previous physical malloc_chunk */ #define prev_chunk(p)\ ((mchunkptr)( ((char*)(p)) - ((p)->prev_size) )) /* Treat space at ptr + offset as a chunk */ #define chunk_at_offset(p, s) ((mchunkptr)(((char*)(p)) + (s))) /* Dealing with use bits */ /* extract p's inuse bit */ #define inuse(p)\ ((((mchunkptr)(((char*)(p))+((p)->size & ~PREV_INUSE)))->size) & PREV_INUSE) /* extract inuse bit of previous chunk */ #define prev_inuse(p) ((p)->size & PREV_INUSE) /* check for mmap()'ed chunk */ #define chunk_is_mmapped(p) ((p)->size & IS_MMAPPED) /* set/clear chunk as in use without otherwise disturbing */ #define set_inuse(p)\ ((mchunkptr)(((char*)(p)) + ((p)->size & ~PREV_INUSE)))->size |= PREV_INUSE #define clear_inuse(p)\ ((mchunkptr)(((char*)(p)) + ((p)->size & ~PREV_INUSE)))->size &= ~(PREV_INUSE) /* check/set/clear inuse bits in known places */ #define inuse_bit_at_offset(p, s)\ (((mchunkptr)(((char*)(p)) + (s)))->size & PREV_INUSE) #define set_inuse_bit_at_offset(p, s)\ (((mchunkptr)(((char*)(p)) + (s)))->size |= PREV_INUSE) #define clear_inuse_bit_at_offset(p, s)\ (((mchunkptr)(((char*)(p)) + (s)))->size &= ~(PREV_INUSE)) /* Dealing with size fields */ /* Get size, ignoring use bits */ #define chunksize(p) ((p)->size & ~(SIZE_BITS)) /* Set size at head, without disturbing its use bit */ #define set_head_size(p, s) ((p)->size = (((p)->size & PREV_INUSE) | (s))) /* Set size/use ignoring previous bits in header */ #define set_head(p, s) ((p)->size = (s)) /* Set size at footer (only when chunk is not in use) */ #define set_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_size = (s)) /* Bins The bins, `av_' are an array of pairs of pointers serving as the heads of (initially empty) doubly-linked lists of chunks, laid out in a way so that each pair can be treated as if it were in a malloc_chunk. (This way, the fd/bk offsets for linking bin heads and chunks are the same). Bins for sizes < 512 bytes contain chunks of all the same size, spaced 8 bytes apart. Larger bins are approximately logarithmically spaced. (See the table below.) The `av_' array is never mentioned directly in the code, but instead via bin access macros. Bin layout: 64 bins of size 8 32 bins of size 64 16 bins of size 512 8 bins of size 4096 4 bins of size 32768 2 bins of size 262144 1 bin of size what's left There is actually a little bit of slop in the numbers in bin_index for the sake of speed. This makes no difference elsewhere. The special chunks `top' and `last_remainder' get their own bins, (this is implemented via yet more trickery with the av_ array), although `top' is never properly linked to its bin since it is always handled specially. */ #define NAV 128 /* number of bins */ typedef struct malloc_chunk* mbinptr; /* access macros */ #define bin_at(i) ((mbinptr)((char*)&(av_[2*(i) + 2]) - 2*SIZE_SZ)) #define next_bin(b) ((mbinptr)((char*)(b) + 2 * sizeof(mbinptr))) #define prev_bin(b) ((mbinptr)((char*)(b) - 2 * sizeof(mbinptr))) /* The first 2 bins are never indexed. The corresponding av_ cells are instead used for bookkeeping. This is not to save space, but to simplify indexing, maintain locality, and avoid some initialization tests. */ #define top (bin_at(0)->fd) /* The topmost chunk */ #define last_remainder (bin_at(1)) /* remainder from last split */ /* Because top initially points to its own bin with initial zero size, thus forcing extension on the first malloc request, we avoid having any special code in malloc to check whether it even exists yet. But we still need to in malloc_extend_top. */ #define initial_top ((mchunkptr)(bin_at(0))) /* Helper macro to initialize bins */ #define IAV(i) bin_at(i), bin_at(i) static mbinptr av_[NAV * 2 + 2] = { 0, 0, IAV(0), IAV(1), IAV(2), IAV(3), IAV(4), IAV(5), IAV(6), IAV(7), IAV(8), IAV(9), IAV(10), IAV(11), IAV(12), IAV(13), IAV(14), IAV(15), IAV(16), IAV(17), IAV(18), IAV(19), IAV(20), IAV(21), IAV(22), IAV(23), IAV(24), IAV(25), IAV(26), IAV(27), IAV(28), IAV(29), IAV(30), IAV(31), IAV(32), IAV(33), IAV(34), IAV(35), IAV(36), IAV(37), IAV(38), IAV(39), IAV(40), IAV(41), IAV(42), IAV(43), IAV(44), IAV(45), IAV(46), IAV(47), IAV(48), IAV(49), IAV(50), IAV(51), IAV(52), IAV(53), IAV(54), IAV(55), IAV(56), IAV(57), IAV(58), IAV(59), IAV(60), IAV(61), IAV(62), IAV(63), IAV(64), IAV(65), IAV(66), IAV(67), IAV(68), IAV(69), IAV(70), IAV(71), IAV(72), IAV(73), IAV(74), IAV(75), IAV(76), IAV(77), IAV(78), IAV(79), IAV(80), IAV(81), IAV(82), IAV(83), IAV(84), IAV(85), IAV(86), IAV(87), IAV(88), IAV(89), IAV(90), IAV(91), IAV(92), IAV(93), IAV(94), IAV(95), IAV(96), IAV(97), IAV(98), IAV(99), IAV(100), IAV(101), IAV(102), IAV(103), IAV(104), IAV(105), IAV(106), IAV(107), IAV(108), IAV(109), IAV(110), IAV(111), IAV(112), IAV(113), IAV(114), IAV(115), IAV(116), IAV(117), IAV(118), IAV(119), IAV(120), IAV(121), IAV(122), IAV(123), IAV(124), IAV(125), IAV(126), IAV(127) }; /* field-extraction macros */ #define first(b) ((b)->fd) #define last(b) ((b)->bk) /* Indexing into bins */ #define bin_index(sz) \ (((((unsigned long)(sz)) >> 9) == 0) ? (((unsigned long)(sz)) >> 3): \ ((((unsigned long)(sz)) >> 9) <= 4) ? 56 + (((unsigned long)(sz)) >> 6): \ ((((unsigned long)(sz)) >> 9) <= 20) ? 91 + (((unsigned long)(sz)) >> 9): \ ((((unsigned long)(sz)) >> 9) <= 84) ? 110 + (((unsigned long)(sz)) >> 12): \ ((((unsigned long)(sz)) >> 9) <= 340) ? 119 + (((unsigned long)(sz)) >> 15): \ ((((unsigned long)(sz)) >> 9) <= 1364) ? 124 + (((unsigned long)(sz)) >> 18): \ 126) /* bins for chunks < 512 are all spaced 8 bytes apart, and hold identically sized chunks. This is exploited in malloc. */ #define MAX_SMALLBIN 63 #define MAX_SMALLBIN_SIZE 512 #define SMALLBIN_WIDTH 8 #define smallbin_index(sz) (((unsigned long)(sz)) >> 3) /* Requests are `small' if both the corresponding and the next bin are small */ #define is_small_request(nb) (nb < MAX_SMALLBIN_SIZE - SMALLBIN_WIDTH) /* To help compensate for the large number of bins, a one-level index structure is used for bin-by-bin searching. `binblocks' is a one-word bitvector recording whether groups of BINBLOCKWIDTH bins have any (possibly) non-empty bins, so they can be skipped over all at once during during traversals. The bits are NOT always cleared as soon as all bins in a block are empty, but instead only when all are noticed to be empty during traversal in malloc. */ #define BINBLOCKWIDTH 4 /* bins per block */ #define binblocks (bin_at(0)->size) /* bitvector of nonempty blocks */ /* bin<->block macros */ #define idx2binblock(ix) ((unsigned)1 << (ix / BINBLOCKWIDTH)) #define mark_binblock(ii) (binblocks |= idx2binblock(ii)) #define clear_binblock(ii) (binblocks &= ~(idx2binblock(ii))) /* Other static bookkeeping data */ /* variables holding tunable values */ static unsigned long trim_threshold = DEFAULT_TRIM_THRESHOLD; static unsigned long top_pad = DEFAULT_TOP_PAD; static unsigned int n_mmaps_max = DEFAULT_MMAP_MAX; static unsigned long mmap_threshold = DEFAULT_MMAP_THRESHOLD; /* The first value returned from sbrk */ static char* sbrk_base = (char*)(-1); /* The maximum memory obtained from system via sbrk */ static unsigned long max_sbrked_mem = 0; /* The maximum via either sbrk or mmap */ static unsigned long max_total_mem = 0; /* internal working copy of mallinfo */ static struct mallinfo current_mallinfo = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* The total memory obtained from system via sbrk */ #define sbrked_mem (current_mallinfo.arena) /* Tracking mmaps */ static unsigned int n_mmaps = 0; static unsigned int max_n_mmaps = 0; static unsigned long mmapped_mem = 0; static unsigned long max_mmapped_mem = 0; /* Debugging support */ #if DEBUG /* These routines make a number of assertions about the states of data structures that should be true at all times. If any are not true, it's very likely that a user program has somehow trashed memory. (It's also possible that there is a coding error in malloc. In which case, please report it!) */ #if __STD_C static void do_check_chunk(mchunkptr p) #else static void do_check_chunk(p) mchunkptr p; #endif { INTERNAL_SIZE_T sz = p->size & ~PREV_INUSE; /* No checkable chunk is mmapped */ assert(!chunk_is_mmapped(p)); /* Check for legal address ... */ assert((char*)p >= sbrk_base); if (p != top) assert((char*)p + sz <= (char*)top); else assert((char*)p + sz <= sbrk_base + sbrked_mem); } #if __STD_C static void do_check_free_chunk(mchunkptr p) #else static void do_check_free_chunk(p) mchunkptr p; #endif { INTERNAL_SIZE_T sz = p->size & ~PREV_INUSE; mchunkptr next = chunk_at_offset(p, sz); do_check_chunk(p); /* Check whether it claims to be free ... */ assert(!inuse(p)); /* Unless a special marker, must have OK fields */ if ((long)sz >= (long)MINSIZE) { assert((sz & MALLOC_ALIGN_MASK) == 0); assert(aligned_OK(chunk2mem(p))); /* ... matching footer field */ assert(next->prev_size == sz); /* ... and is fully consolidated */ assert(prev_inuse(p)); assert (next == top || inuse(next)); /* ... and has minimally sane links */ assert(p->fd->bk == p); assert(p->bk->fd == p); } else /* markers are always of size SIZE_SZ */ assert(sz == SIZE_SZ); } #if __STD_C static void do_check_inuse_chunk(mchunkptr p) #else static void do_check_inuse_chunk(p) mchunkptr p; #endif { mchunkptr next = next_chunk(p); do_check_chunk(p); /* Check whether it claims to be in use ... */ assert(inuse(p)); /* ... and is surrounded by OK chunks. Since more things can be checked with free chunks than inuse ones, if an inuse chunk borders them and debug is on, it's worth doing them. */ if (!prev_inuse(p)) { mchunkptr prv = prev_chunk(p); assert(next_chunk(prv) == p); do_check_free_chunk(prv); } if (next == top) { assert(prev_inuse(next)); assert(chunksize(next) >= MINSIZE); } else if (!inuse(next)) do_check_free_chunk(next); } #if __STD_C static void do_check_malloced_chunk(mchunkptr p, INTERNAL_SIZE_T s) #else static void do_check_malloced_chunk(p, s) mchunkptr p; INTERNAL_SIZE_T s; #endif { INTERNAL_SIZE_T sz = p->size & ~PREV_INUSE; long room = sz - s; do_check_inuse_chunk(p); /* Legal size ... */ assert((long)sz >= (long)MINSIZE); assert((sz & MALLOC_ALIGN_MASK) == 0); assert(room >= 0); assert(room < (long)MINSIZE); /* ... and alignment */ assert(aligned_OK(chunk2mem(p))); /* ... and was allocated at front of an available chunk */ assert(prev_inuse(p)); } #define check_free_chunk(P) do_check_free_chunk(P) #define check_inuse_chunk(P) do_check_inuse_chunk(P) #define check_chunk(P) do_check_chunk(P) #define check_malloced_chunk(P,N) do_check_malloced_chunk(P,N) #else #define check_free_chunk(P) #define check_inuse_chunk(P) #define check_chunk(P) #define check_malloced_chunk(P,N) #endif /* Macro-based internal utilities */ /* Linking chunks in bin lists. Call these only with variables, not arbitrary expressions, as arguments. */ /* Place chunk p of size s in its bin, in size order, putting it ahead of others of same size. */ #define frontlink(P, S, IDX, BK, FD) \ { \ if (S < MAX_SMALLBIN_SIZE) \ { \ IDX = smallbin_index(S); \ mark_binblock(IDX); \ BK = bin_at(IDX); \ FD = BK->fd; \ P->bk = BK; \ P->fd = FD; \ FD->bk = BK->fd = P; \ } \ else \ { \ IDX = bin_index(S); \ BK = bin_at(IDX); \ FD = BK->fd; \ if (FD == BK) mark_binblock(IDX); \ else \ { \ while (FD != BK && S < chunksize(FD)) FD = FD->fd; \ BK = FD->bk; \ } \ P->bk = BK; \ P->fd = FD; \ FD->bk = BK->fd = P; \ } \ } /* take a chunk off a list */ #define unlink(P, BK, FD) \ { \ BK = P->bk; \ FD = P->fd; \ FD->bk = BK; \ BK->fd = FD; \ } \ /* Place p as the last remainder */ #define link_last_remainder(P) \ { \ last_remainder->fd = last_remainder->bk = P; \ P->fd = P->bk = last_remainder; \ } /* Clear the last_remainder bin */ #define clear_last_remainder \ (last_remainder->fd = last_remainder->bk = last_remainder) /* Routines dealing with mmap(). */ #if HAVE_MMAP #if __STD_C static mchunkptr mmap_chunk(size_t size) #else static mchunkptr mmap_chunk(size) size_t size; #endif { size_t page_mask = malloc_getpagesize - 1; mchunkptr p; #ifndef MAP_ANONYMOUS static int fd = -1; #endif if(n_mmaps >= n_mmaps_max) return 0; /* too many regions */ /* For mmapped chunks, the overhead is one SIZE_SZ unit larger, because * there is no following chunk whose prev_size field could be used. */ size = (size + SIZE_SZ + page_mask) & ~page_mask; #ifdef MAP_ANONYMOUS p = (mchunkptr)mmap(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); #else /* !MAP_ANONYMOUS */ if (fd < 0) { fd = open("/dev/zero", O_RDWR); if(fd < 0) return 0; } p = (mchunkptr)mmap(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); #endif if(p == (mchunkptr)-1) return 0; n_mmaps++; if (n_mmaps > max_n_mmaps) max_n_mmaps = n_mmaps; /* We demand that eight bytes into a page must be 8-byte aligned. */ assert(aligned_OK(chunk2mem(p))); /* The offset to the start of the mmapped region is stored * in the prev_size field of the chunk; normally it is zero, * but that can be changed in memalign(). */ p->prev_size = 0; set_head(p, size|IS_MMAPPED); mmapped_mem += size; if ((unsigned long)mmapped_mem > (unsigned long)max_mmapped_mem) max_mmapped_mem = mmapped_mem; if ((unsigned long)(mmapped_mem + sbrked_mem) > (unsigned long)max_total_mem) max_total_mem = mmapped_mem + sbrked_mem; return p; } #if __STD_C static void munmap_chunk(mchunkptr p) #else static void munmap_chunk(p) mchunkptr p; #endif { INTERNAL_SIZE_T size = chunksize(p); int ret; assert (chunk_is_mmapped(p)); assert(! ((char*)p >= sbrk_base && (char*)p < sbrk_base + sbrked_mem)); assert((n_mmaps > 0)); assert(((p->prev_size + size) & (malloc_getpagesize-1)) == 0); n_mmaps--; mmapped_mem -= (size + p->prev_size); ret = munmap((char *)p - p->prev_size, size + p->prev_size); /* munmap returns non-zero on failure */ assert(ret == 0); } #if HAVE_MREMAP #if __STD_C static mchunkptr mremap_chunk(mchunkptr p, size_t new_size) #else static mchunkptr mremap_chunk(p, new_size) mchunkptr p; size_t new_size; #endif { size_t page_mask = malloc_getpagesize - 1; INTERNAL_SIZE_T offset = p->prev_size; INTERNAL_SIZE_T size = chunksize(p); char *cp; assert (chunk_is_mmapped(p)); assert(! ((char*)p >= sbrk_base && (char*)p < sbrk_base + sbrked_mem)); assert((n_mmaps > 0)); assert(((size + offset) & (malloc_getpagesize-1)) == 0); /* Note the extra SIZE_SZ overhead as in mmap_chunk(). */ new_size = (new_size + offset + SIZE_SZ + page_mask) & ~page_mask; cp = (char *)mremap((char *)p - offset, size + offset, new_size, 1); if (cp == (char *)-1) return 0; p = (mchunkptr)(cp + offset); assert(aligned_OK(chunk2mem(p))); assert((p->prev_size == offset)); set_head(p, (new_size - offset)|IS_MMAPPED); mmapped_mem -= size + offset; mmapped_mem += new_size; if ((unsigned long)mmapped_mem > (unsigned long)max_mmapped_mem) max_mmapped_mem = mmapped_mem; if ((unsigned long)(mmapped_mem + sbrked_mem) > (unsigned long)max_total_mem) max_total_mem = mmapped_mem + sbrked_mem; return p; } #endif /* HAVE_MREMAP */ #endif /* HAVE_MMAP */ /* Extend the top-most chunk by obtaining memory from system. Main interface to sbrk (but see also malloc_trim). */ #if __STD_C static void malloc_extend_top(INTERNAL_SIZE_T nb) #else static void malloc_extend_top(nb) INTERNAL_SIZE_T nb; #endif { char* brk; /* return value from sbrk */ INTERNAL_SIZE_T front_misalign; /* unusable bytes at front of sbrked space */ INTERNAL_SIZE_T correction; /* bytes for 2nd sbrk call */ char* new_brk; /* return of 2nd sbrk call */ INTERNAL_SIZE_T top_size; /* new size of top chunk */ mchunkptr old_top = top; /* Record state of old top */ INTERNAL_SIZE_T old_top_size = chunksize(old_top); char* old_end = (char*)(chunk_at_offset(old_top, old_top_size)); /* Pad request with top_pad plus minimal overhead */ INTERNAL_SIZE_T sbrk_size = nb + top_pad + MINSIZE; unsigned long pagesz = malloc_getpagesize; /* If not the first time through, round to preserve page boundary */ /* Otherwise, we need to correct to a page size below anyway. */ /* (We also correct below if an intervening foreign sbrk call.) */ if (sbrk_base != (char*)(-1)) sbrk_size = (sbrk_size + (pagesz - 1)) & ~(pagesz - 1); brk = (char*)(MORECORE (sbrk_size)); /* Fail if sbrk failed or if a foreign sbrk call killed our space */ if (brk == (char*)(MORECORE_FAILURE) || (brk < old_end && old_top != initial_top)) return; sbrked_mem += sbrk_size; if (brk == old_end) /* can just add bytes to current top */ { top_size = sbrk_size + old_top_size; set_head(top, top_size | PREV_INUSE); } else { if (sbrk_base == (char*)(-1)) /* First time through. Record base */ sbrk_base = brk; else /* Someone else called sbrk(). Count those bytes as sbrked_mem. */ sbrked_mem += brk - (char*)old_end; /* Guarantee alignment of first new chunk made from this space */ front_misalign = (unsigned long)chunk2mem(brk) & MALLOC_ALIGN_MASK; if (front_misalign > 0) { correction = (MALLOC_ALIGNMENT) - front_misalign; brk += correction; } else correction = 0; /* Guarantee the next brk will be at a page boundary */ correction += ((((unsigned long)(brk + sbrk_size))+(pagesz-1)) & ~(pagesz - 1)) - ((unsigned long)(brk + sbrk_size)); /* Allocate correction */ new_brk = (char*)(MORECORE (correction)); if (new_brk == (char*)(MORECORE_FAILURE)) return; sbrked_mem += correction; top = (mchunkptr)brk; top_size = new_brk - brk + correction; set_head(top, top_size | PREV_INUSE); if (old_top != initial_top) { /* There must have been an intervening foreign sbrk call. */ /* A double fencepost is necessary to prevent consolidation */ /* If not enough space to do this, then user did something very wrong */ if (old_top_size < MINSIZE) { set_head(top, PREV_INUSE); /* will force null return from malloc */ return; } /* Also keep size a multiple of MALLOC_ALIGNMENT */ old_top_size = (old_top_size - 3*SIZE_SZ) & ~MALLOC_ALIGN_MASK; set_head_size(old_top, old_top_size); chunk_at_offset(old_top, old_top_size )->size = SIZE_SZ|PREV_INUSE; chunk_at_offset(old_top, old_top_size + SIZE_SZ)->size = SIZE_SZ|PREV_INUSE; /* If possible, release the rest. */ if (old_top_size >= MINSIZE) fREe(chunk2mem(old_top)); } } if ((unsigned long)sbrked_mem > (unsigned long)max_sbrked_mem) max_sbrked_mem = sbrked_mem; if ((unsigned long)(mmapped_mem + sbrked_mem) > (unsigned long)max_total_mem) max_total_mem = mmapped_mem + sbrked_mem; /* We always land on a page boundary */ assert(((unsigned long)((char*)top + top_size) & (pagesz - 1)) == 0); } /* Main public routines */ /* Malloc Algorthim: The requested size is first converted into a usable form, `nb'. This currently means to add 4 bytes overhead plus possibly more to obtain 8-byte alignment and/or to obtain a size of at least MINSIZE (currently 16 bytes), the smallest allocatable size. (All fits are considered `exact' if they are within MINSIZE bytes.) From there, the first successful of the following steps is taken: 1. The bin corresponding to the request size is scanned, and if a chunk of exactly the right size is found, it is taken. 2. The most recently remaindered chunk is used if it is big enough. This is a form of (roving) first fit, used only in the absence of exact fits. Runs of consecutive requests use the remainder of the chunk used for the previous such request whenever possible. This limited use of a first-fit style allocation strategy tends to give contiguous chunks coextensive lifetimes, which improves locality and can reduce fragmentation in the long run. 3. Other bins are scanned in increasing size order, using a chunk big enough to fulfill the request, and splitting off any remainder. This search is strictly by best-fit; i.e., the smallest (with ties going to approximately the least recently used) chunk that fits is selected. 4. If large enough, the chunk bordering the end of memory (`top') is split off. (This use of `top' is in accord with the best-fit search rule. In effect, `top' is treated as larger (and thus less well fitting) than any other available chunk since it can be extended to be as large as necessary (up to system limitations). 5. If the request size meets the mmap threshold and the system supports mmap, and there are few enough currently allocated mmapped regions, and a call to mmap succeeds, the request is allocated via direct memory mapping. 6. Otherwise, the top of memory is extended by obtaining more space from the system (normally using sbrk, but definable to anything else via the MORECORE macro). Memory is gathered from the system (in system page-sized units) in a way that allows chunks obtained across different sbrk calls to be consolidated, but does not require contiguous memory. Thus, it should be safe to intersperse mallocs with other sbrk calls. All allocations are made from the the `lowest' part of any found chunk. (The implementation invariant is that prev_inuse is always true of any allocated chunk; i.e., that each allocated chunk borders either a previously allocated and still in-use chunk, or the base of its memory arena.) */ #if __STD_C Void_t* mALLOc(size_t bytes) #else Void_t* mALLOc(bytes) size_t bytes; #endif { mchunkptr victim; /* inspected/selected chunk */ INTERNAL_SIZE_T victim_size; /* its size */ int idx; /* index for bin traversal */ mbinptr bin; /* associated bin */ mchunkptr remainder; /* remainder from a split */ long remainder_size; /* its size */ int remainder_index; /* its bin index */ unsigned long block; /* block traverser bit */ int startidx; /* first bin of a traversed block */ mchunkptr fwd; /* misc temp for linking */ mchunkptr bck; /* misc temp for linking */ mbinptr q; /* misc temp */ INTERNAL_SIZE_T nb; if ((long)bytes < 0) return 0; nb = request2size(bytes); /* padded request size; */ /* Check for exact match in a bin */ if (is_small_request(nb)) /* Faster version for small requests */ { idx = smallbin_index(nb); /* No traversal or size check necessary for small bins. */ q = bin_at(idx); victim = last(q); /* Also scan the next one, since it would have a remainder < MINSIZE */ if (victim == q) { q = next_bin(q); victim = last(q); } if (victim != q) { victim_size = chunksize(victim); unlink(victim, bck, fwd); set_inuse_bit_at_offset(victim, victim_size); check_malloced_chunk(victim, nb); return chunk2mem(victim); } idx += 2; /* Set for bin scan below. We've already scanned 2 bins. */ } else { idx = bin_index(nb); bin = bin_at(idx); for (victim = last(bin); victim != bin; victim = victim->bk) { victim_size = chunksize(victim); remainder_size = victim_size - nb; if (remainder_size >= (long)MINSIZE) /* too big */ { --idx; /* adjust to rescan below after checking last remainder */ break; } else if (remainder_size >= 0) /* exact fit */ { unlink(victim, bck, fwd); set_inuse_bit_at_offset(victim, victim_size); check_malloced_chunk(victim, nb); return chunk2mem(victim); } } ++idx; } /* Try to use the last split-off remainder */ if ( (victim = last_remainder->fd) != last_remainder) { victim_size = chunksize(victim); remainder_size = victim_size - nb; if (remainder_size >= (long)MINSIZE) /* re-split */ { remainder = chunk_at_offset(victim, nb); set_head(victim, nb | PREV_INUSE); link_last_remainder(remainder); set_head(remainder, remainder_size | PREV_INUSE); set_foot(remainder, remainder_size); check_malloced_chunk(victim, nb); return chunk2mem(victim); } clear_last_remainder; if (remainder_size >= 0) /* exhaust */ { set_inuse_bit_at_offset(victim, victim_size); check_malloced_chunk(victim, nb); return chunk2mem(victim); } /* Else place in bin */ frontlink(victim, victim_size, remainder_index, bck, fwd); } /* If there are any possibly nonempty big-enough blocks, search for best fitting chunk by scanning bins in blockwidth units. */ if ( (block = idx2binblock(idx)) <= binblocks) { /* Get to the first marked block */ if ( (block & binblocks) == 0) { /* force to an even block boundary */ idx = (idx & ~(BINBLOCKWIDTH - 1)) + BINBLOCKWIDTH; block <<= 1; while ((block & binblocks) == 0) { idx += BINBLOCKWIDTH; block <<= 1; } } /* For each possibly nonempty block ... */ for (;;) { startidx = idx; /* (track incomplete blocks) */ q = bin = bin_at(idx); /* For each bin in this block ... */ do { /* Find and use first big enough chunk ... */ for (victim = last(bin); victim != bin; victim = victim->bk) { victim_size = chunksize(victim); remainder_size = victim_size - nb; if (remainder_size >= (long)MINSIZE) /* split */ { remainder = chunk_at_offset(victim, nb); set_head(victim, nb | PREV_INUSE); unlink(victim, bck, fwd); link_last_remainder(remainder); set_head(remainder, remainder_size | PREV_INUSE); set_foot(remainder, remainder_size); check_malloced_chunk(victim, nb); return chunk2mem(victim); } else if (remainder_size >= 0) /* take */ { set_inuse_bit_at_offset(victim, victim_size); unlink(victim, bck, fwd); check_malloced_chunk(victim, nb); return chunk2mem(victim); } } bin = next_bin(bin); } while ((++idx & (BINBLOCKWIDTH - 1)) != 0); /* Clear out the block bit. */ do /* Possibly backtrack to try to clear a partial block */ { if ((startidx & (BINBLOCKWIDTH - 1)) == 0) { binblocks &= ~block; break; } --startidx; q = prev_bin(q); } while (first(q) == q); /* Get to the next possibly nonempty block */ if ( (block <<= 1) <= binblocks && (block != 0) ) { while ((block & binblocks) == 0) { idx += BINBLOCKWIDTH; block <<= 1; } } else break; } } /* Try to use top chunk */ /* Require that there be a remainder, ensuring top always exists */ if ( (remainder_size = chunksize(top) - nb) < (long)MINSIZE) { #if HAVE_MMAP /* If big and would otherwise need to extend, try to use mmap instead */ if ((unsigned long)nb >= (unsigned long)mmap_threshold && (victim = mmap_chunk(nb)) != 0) return chunk2mem(victim); #endif /* Try to extend */ malloc_extend_top(nb); if ( (remainder_size = chunksize(top) - nb) < (long)MINSIZE) return 0; /* propagate failure */ } victim = top; set_head(victim, nb | PREV_INUSE); top = chunk_at_offset(victim, nb); set_head(top, remainder_size | PREV_INUSE); check_malloced_chunk(victim, nb); return chunk2mem(victim); } /* free() algorithm : cases: 1. free(0) has no effect. 2. If the chunk was allocated via mmap, it is release via munmap(). 3. If a returned chunk borders the current high end of memory, it is consolidated into the top, and if the total unused topmost memory exceeds the trim threshold, malloc_trim is called. 4. Other chunks are consolidated as they arrive, and placed in corresponding bins. (This includes the case of consolidating with the current `last_remainder'). */ #if __STD_C void fREe(Void_t* mem) #else void fREe(mem) Void_t* mem; #endif { mchunkptr p; /* chunk corresponding to mem */ INTERNAL_SIZE_T hd; /* its head field */ INTERNAL_SIZE_T sz; /* its size */ int idx; /* its bin index */ mchunkptr next; /* next contiguous chunk */ INTERNAL_SIZE_T nextsz; /* its size */ INTERNAL_SIZE_T prevsz; /* size of previous contiguous chunk */ mchunkptr bck; /* misc temp for linking */ mchunkptr fwd; /* misc temp for linking */ int islr; /* track whether merging with last_remainder */ if (mem == 0) /* free(0) has no effect */ return; p = mem2chunk(mem); hd = p->size; #if HAVE_MMAP if (hd & IS_MMAPPED) /* release mmapped memory. */ { munmap_chunk(p); return; } #endif check_inuse_chunk(p); sz = hd & ~PREV_INUSE; next = chunk_at_offset(p, sz); nextsz = chunksize(next); if (next == top) /* merge with top */ { sz += nextsz; if (!(hd & PREV_INUSE)) /* consolidate backward */ { prevsz = p->prev_size; p = chunk_at_offset(p, -((long) prevsz)); sz += prevsz; unlink(p, bck, fwd); } set_head(p, sz | PREV_INUSE); top = p; if ((unsigned long)(sz) >= (unsigned long)trim_threshold) malloc_trim(top_pad); return; } set_head(next, nextsz); /* clear inuse bit */ islr = 0; if (!(hd & PREV_INUSE)) /* consolidate backward */ { prevsz = p->prev_size; p = chunk_at_offset(p, -((long) prevsz)); sz += prevsz; if (p->fd == last_remainder) /* keep as last_remainder */ islr = 1; else unlink(p, bck, fwd); } if (!(inuse_bit_at_offset(next, nextsz))) /* consolidate forward */ { sz += nextsz; if (!islr && next->fd == last_remainder) /* re-insert last_remainder */ { islr = 1; link_last_remainder(p); } else unlink(next, bck, fwd); } set_head(p, sz | PREV_INUSE); set_foot(p, sz); if (!islr) frontlink(p, sz, idx, bck, fwd); } /* Realloc algorithm: Chunks that were obtained via mmap cannot be extended or shrunk unless HAVE_MREMAP is defined, in which case mremap is used. Otherwise, if their reallocation is for additional space, they are copied. If for less, they are just left alone. Otherwise, if the reallocation is for additional space, and the chunk can be extended, it is, else a malloc-copy-free sequence is taken. There are several different ways that a chunk could be extended. All are tried: * Extending forward into following adjacent free chunk. * Shifting backwards, joining preceding adjacent space * Both shifting backwards and extending forward. * Extending into newly sbrked space Unless the #define REALLOC_ZERO_BYTES_FREES is set, realloc with a size argument of zero (re)allocates a minimum-sized chunk. If the reallocation is for less space, and the new request is for a `small' (<512 bytes) size, then the newly unused space is lopped off and freed. The old unix realloc convention of allowing the last-free'd chunk to be used as an argument to realloc is no longer supported. I don't know of any programs still relying on this feature, and allowing it would also allow too many other incorrect usages of realloc to be sensible. */ #if __STD_C Void_t* rEALLOc(Void_t* oldmem, size_t bytes) #else Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes; #endif { INTERNAL_SIZE_T nb; /* padded request size */ mchunkptr oldp; /* chunk corresponding to oldmem */ INTERNAL_SIZE_T oldsize; /* its size */ mchunkptr newp; /* chunk to return */ INTERNAL_SIZE_T newsize; /* its size */ Void_t* newmem; /* corresponding user mem */ mchunkptr next; /* next contiguous chunk after oldp */ INTERNAL_SIZE_T nextsize; /* its size */ mchunkptr prev; /* previous contiguous chunk before oldp */ INTERNAL_SIZE_T prevsize; /* its size */ mchunkptr remainder; /* holds split off extra space from newp */ INTERNAL_SIZE_T remainder_size; /* its size */ mchunkptr bck; /* misc temp for linking */ mchunkptr fwd; /* misc temp for linking */ #ifdef REALLOC_ZERO_BYTES_FREES if (bytes == 0) { fREe(oldmem); return 0; } #endif if ((long)bytes < 0) return 0; /* realloc of null is supposed to be same as malloc */ if (oldmem == 0) return mALLOc(bytes); newp = oldp = mem2chunk(oldmem); newsize = oldsize = chunksize(oldp); nb = request2size(bytes); #if HAVE_MMAP if (chunk_is_mmapped(oldp)) { #if HAVE_MREMAP newp = mremap_chunk(oldp, nb); if(newp) return chunk2mem(newp); #endif /* Note the extra SIZE_SZ overhead. */ if(oldsize - SIZE_SZ >= nb) return oldmem; /* do nothing */ /* Must alloc, copy, free. */ newmem = mALLOc(bytes); if (newmem == 0) return 0; /* propagate failure */ MALLOC_COPY(newmem, oldmem, oldsize - 2*SIZE_SZ); munmap_chunk(oldp); return newmem; } #endif check_inuse_chunk(oldp); if ((long)(oldsize) < (long)(nb)) { /* Try expanding forward */ next = chunk_at_offset(oldp, oldsize); if (next == top || !inuse(next)) { nextsize = chunksize(next); /* Forward into top only if a remainder */ if (next == top) { if ((long)(nextsize + newsize) >= (long)(nb + MINSIZE)) { newsize += nextsize; top = chunk_at_offset(oldp, nb); set_head(top, (newsize - nb) | PREV_INUSE); set_head_size(oldp, nb); return chunk2mem(oldp); } } /* Forward into next chunk */ else if (((long)(nextsize + newsize) >= (long)(nb))) { unlink(next, bck, fwd); newsize += nextsize; goto split; } } else { next = 0; nextsize = 0; } /* Try shifting backwards. */ if (!prev_inuse(oldp)) { prev = prev_chunk(oldp); prevsize = chunksize(prev); /* try forward + backward first to save a later consolidation */ if (next != 0) { /* into top */ if (next == top) { if ((long)(nextsize + prevsize + newsize) >= (long)(nb + MINSIZE)) { unlink(prev, bck, fwd); newp = prev; newsize += prevsize + nextsize; newmem = chunk2mem(newp); MALLOC_COPY(newmem, oldmem, oldsize - SIZE_SZ); top = chunk_at_offset(newp, nb); set_head(top, (newsize - nb) | PREV_INUSE); set_head_size(newp, nb); return newmem; } } /* into next chunk */ else if (((long)(nextsize + prevsize + newsize) >= (long)(nb))) { unlink(next, bck, fwd); unlink(prev, bck, fwd); newp = prev; newsize += nextsize + prevsize; newmem = chunk2mem(newp); MALLOC_COPY(newmem, oldmem, oldsize - SIZE_SZ); goto split; } } /* backward only */ if (prev != 0 && (long)(prevsize + newsize) >= (long)nb) { unlink(prev, bck, fwd); newp = prev; newsize += prevsize; newmem = chunk2mem(newp); MALLOC_COPY(newmem, oldmem, oldsize - SIZE_SZ); goto split; } } /* Must allocate */ newmem = mALLOc (bytes); if (newmem == 0) /* propagate failure */ return 0; /* Avoid copy if newp is next chunk after oldp. */ /* (This can only happen when new chunk is sbrk'ed.) */ if ( (newp = mem2chunk(newmem)) == next_chunk(oldp)) { newsize += chunksize(newp); newp = oldp; goto split; } /* Otherwise copy, free, and exit */ MALLOC_COPY(newmem, oldmem, oldsize - SIZE_SZ); fREe(oldmem); return newmem; } split: /* split off extra room in old or expanded chunk */ if (newsize - nb >= MINSIZE) /* split off remainder */ { remainder = chunk_at_offset(newp, nb); remainder_size = newsize - nb; set_head_size(newp, nb); set_head(remainder, remainder_size | PREV_INUSE); set_inuse_bit_at_offset(remainder, remainder_size); fREe(chunk2mem(remainder)); /* let free() deal with it */ } else { set_head_size(newp, newsize); set_inuse_bit_at_offset(newp, newsize); } check_inuse_chunk(newp); return chunk2mem(newp); } /* memalign algorithm: memalign requests more than enough space from malloc, finds a spot within that chunk that meets the alignment request, and then possibly frees the leading and trailing space. The alignment argument must be a power of two. This property is not checked by memalign, so misuse may result in random runtime errors. 8-byte alignment is guaranteed by normal malloc calls, so don't bother calling memalign with an argument of 8 or less. Overreliance on memalign is a sure way to fragment space. */ #if __STD_C Void_t* mEMALIGn(size_t alignment, size_t bytes) #else Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; #endif { INTERNAL_SIZE_T nb; /* padded request size */ char* m; /* memory returned by malloc call */ mchunkptr p; /* corresponding chunk */ char* brk; /* alignment point within p */ mchunkptr newp; /* chunk to return */ INTERNAL_SIZE_T newsize; /* its size */ INTERNAL_SIZE_T leadsize; /* leading space befor alignment point */ mchunkptr remainder; /* spare room at end to split off */ long remainder_size; /* its size */ if ((long)bytes < 0) return 0; /* If need less alignment than we give anyway, just relay to malloc */ if (alignment <= MALLOC_ALIGNMENT) return mALLOc(bytes); /* Otherwise, ensure that it is at least a minimum chunk size */ if (alignment < MINSIZE) alignment = MINSIZE; /* Call malloc with worst case padding to hit alignment. */ nb = request2size(bytes); m = (char*)(mALLOc(nb + alignment + MINSIZE)); if (m == 0) return 0; /* propagate failure */ p = mem2chunk(m); if ((((unsigned long)(m)) % alignment) == 0) /* aligned */ { #if HAVE_MMAP if(chunk_is_mmapped(p)) return chunk2mem(p); /* nothing more to do */ #endif } else /* misaligned */ { /* Find an aligned spot inside chunk. Since we need to give back leading space in a chunk of at least MINSIZE, if the first calculation places us at a spot with less than MINSIZE leader, we can move to the next aligned spot -- we've allocated enough total room so that this is always possible. */ brk = (char*)mem2chunk(((unsigned long)(m + alignment - 1)) & -((signed) alignment)); if ((long)(brk - (char*)(p)) < MINSIZE) brk = brk + alignment; newp = (mchunkptr)brk; leadsize = brk - (char*)(p); newsize = chunksize(p) - leadsize; #if HAVE_MMAP if(chunk_is_mmapped(p)) { newp->prev_size = p->prev_size + leadsize; set_head(newp, newsize|IS_MMAPPED); return chunk2mem(newp); } #endif /* give back leader, use the rest */ set_head(newp, newsize | PREV_INUSE); set_inuse_bit_at_offset(newp, newsize); set_head_size(p, leadsize); fREe(chunk2mem(p)); p = newp; assert (newsize >= nb && (((unsigned long)(chunk2mem(p))) % alignment) == 0); } /* Also give back spare room at the end */ remainder_size = chunksize(p) - nb; if (remainder_size >= (long)MINSIZE) { remainder = chunk_at_offset(p, nb); set_head(remainder, remainder_size | PREV_INUSE); set_head_size(p, nb); fREe(chunk2mem(remainder)); } check_inuse_chunk(p); return chunk2mem(p); } /* valloc just invokes memalign with alignment argument equal to the page size of the system (or as near to this as can be figured out from all the includes/defines above.) */ #if __STD_C Void_t* vALLOc(size_t bytes) #else Void_t* vALLOc(bytes) size_t bytes; #endif { return mEMALIGn (malloc_getpagesize, bytes); } /* pvalloc just invokes valloc for the nearest pagesize that will accommodate request */ #if __STD_C Void_t* pvALLOc(size_t bytes) #else Void_t* pvALLOc(bytes) size_t bytes; #endif { size_t pagesize = malloc_getpagesize; return mEMALIGn (pagesize, (bytes + pagesize - 1) & ~(pagesize - 1)); } /* calloc calls malloc, then zeroes out the allocated chunk. */ #if __STD_C Void_t* cALLOc(size_t n, size_t elem_size) #else Void_t* cALLOc(n, elem_size) size_t n; size_t elem_size; #endif { mchunkptr p; INTERNAL_SIZE_T csz; INTERNAL_SIZE_T sz = n * elem_size; /* check if expand_top called, in which case don't need to clear */ #if MORECORE_CLEARS mchunkptr oldtop = top; INTERNAL_SIZE_T oldtopsize = chunksize(top); #endif Void_t* mem = mALLOc (sz); if ((long)n < 0) return 0; if (mem == 0) return 0; else { p = mem2chunk(mem); /* Two optional cases in which clearing not necessary */ #if HAVE_MMAP if (chunk_is_mmapped(p)) return mem; #endif csz = chunksize(p); #if MORECORE_CLEARS if (p == oldtop && csz > oldtopsize) { /* clear only the bytes from non-freshly-sbrked memory */ csz = oldtopsize; } #endif MALLOC_ZERO(mem, csz - SIZE_SZ); return mem; } } /* cfree just calls free. It is needed/defined on some systems that pair it with calloc, presumably for odd historical reasons. */ #if !defined(INTERNAL_LINUX_C_LIB) || !defined(__ELF__) #if __STD_C void cfree(Void_t *mem) #else void cfree(mem) Void_t *mem; #endif { fREe(mem); } #endif /* Malloc_trim gives memory back to the system (via negative arguments to sbrk) if there is unused memory at the `high' end of the malloc pool. You can call this after freeing large blocks of memory to potentially reduce the system-level memory requirements of a program. However, it cannot guarantee to reduce memory. Under some allocation patterns, some large free blocks of memory will be locked between two used chunks, so they cannot be given back to the system. The `pad' argument to malloc_trim represents the amount of free trailing space to leave untrimmed. If this argument is zero, only the minimum amount of memory to maintain internal data structures will be left (one page or less). Non-zero arguments can be supplied to maintain enough trailing space to service future expected allocations without having to re-obtain memory from the system. Malloc_trim returns 1 if it actually released any memory, else 0. */ #if __STD_C int malloc_trim(size_t pad) #else int malloc_trim(pad) size_t pad; #endif { long top_size; /* Amount of top-most memory */ long extra; /* Amount to release */ char* current_brk; /* address returned by pre-check sbrk call */ char* new_brk; /* address returned by negative sbrk call */ unsigned long pagesz = malloc_getpagesize; top_size = chunksize(top); extra = ((top_size - pad - MINSIZE + (pagesz-1)) / pagesz - 1) * pagesz; if (extra < (long)pagesz) /* Not enough memory to release */ return 0; else { /* Test to make sure no one else called sbrk */ current_brk = (char*)(MORECORE (0)); if (current_brk != (char*)(top) + top_size) return 0; /* Apparently we don't own memory; must fail */ else { new_brk = (char*)(MORECORE (-extra)); if (new_brk == (char*)(MORECORE_FAILURE)) /* sbrk failed? */ { /* Try to figure out what we have */ current_brk = (char*)(MORECORE (0)); top_size = current_brk - (char*)top; if (top_size >= (long)MINSIZE) /* if not, we are very very dead! */ { sbrked_mem = current_brk - sbrk_base; set_head(top, top_size | PREV_INUSE); } check_chunk(top); return 0; } else { /* Success. Adjust top accordingly. */ set_head(top, (top_size - extra) | PREV_INUSE); sbrked_mem -= extra; check_chunk(top); return 1; } } } } /* malloc_usable_size: This routine tells you how many bytes you can actually use in an allocated chunk, which may be more than you requested (although often not). You can use this many bytes without worrying about overwriting other allocated objects. Not a particularly great programming practice, but still sometimes useful. */ #if __STD_C size_t malloc_usable_size(Void_t* mem) #else size_t malloc_usable_size(mem) Void_t* mem; #endif { mchunkptr p; if (mem == 0) return 0; else { p = mem2chunk(mem); if(!chunk_is_mmapped(p)) { if (!inuse(p)) return 0; check_inuse_chunk(p); return chunksize(p) - SIZE_SZ; } return chunksize(p) - 2*SIZE_SZ; } } /* Utility to update current_mallinfo for malloc_stats and mallinfo() */ static void malloc_update_mallinfo() { int i; mbinptr b; mchunkptr p; #if DEBUG mchunkptr q; #endif INTERNAL_SIZE_T avail = chunksize(top); int navail = ((long)(avail) >= (long)MINSIZE)? 1 : 0; for (i = 1; i < NAV; ++i) { b = bin_at(i); for (p = last(b); p != b; p = p->bk) { #if DEBUG check_free_chunk(p); for (q = next_chunk(p); q < top && inuse(q) && (long)(chunksize(q)) >= (long)MINSIZE; q = next_chunk(q)) check_inuse_chunk(q); #endif avail += chunksize(p); navail++; } } current_mallinfo.ordblks = navail; current_mallinfo.uordblks = sbrked_mem - avail; current_mallinfo.fordblks = avail; current_mallinfo.hblks = n_mmaps; current_mallinfo.hblkhd = mmapped_mem; current_mallinfo.keepcost = chunksize(top); } /* malloc_stats: Prints on stderr the amount of space obtain from the system (both via sbrk and mmap), the maximum amount (which may be more than current if malloc_trim and/or munmap got called), the maximum number of simultaneous mmap regions used, and the current number of bytes allocated via malloc (or realloc, etc) but not yet freed. (Note that this is the number of bytes allocated, not the number requested. It will be larger than the number requested because of alignment and bookkeeping overhead.) */ void malloc_stats() { malloc_update_mallinfo(); fprintf(stderr, "max system bytes = %10u\n", (unsigned int)(max_total_mem)); fprintf(stderr, "system bytes = %10u\n", (unsigned int)(sbrked_mem + mmapped_mem)); fprintf(stderr, "in use bytes = %10u\n", (unsigned int)(current_mallinfo.uordblks + mmapped_mem)); #if HAVE_MMAP fprintf(stderr, "max mmap regions = %10u\n", (unsigned int)max_n_mmaps); #endif } /* mallinfo returns a copy of updated current mallinfo. */ struct mallinfo mALLINFo() { malloc_update_mallinfo(); return current_mallinfo; } /* mallopt: mallopt is the general SVID/XPG interface to tunable parameters. The format is to provide a (parameter-number, parameter-value) pair. mallopt then sets the corresponding parameter to the argument value if it can (i.e., so long as the value is meaningful), and returns 1 if successful else 0. See descriptions of tunable parameters above. */ #if __STD_C int mALLOPt(int param_number, int value) #else int mALLOPt(param_number, value) int param_number; int value; #endif { switch(param_number) { case M_TRIM_THRESHOLD: trim_threshold = value; return 1; case M_TOP_PAD: top_pad = value; return 1; case M_MMAP_THRESHOLD: mmap_threshold = value; return 1; case M_MMAP_MAX: #if HAVE_MMAP n_mmaps_max = value; return 1; #else if (value != 0) return 0; else n_mmaps_max = value; return 1; #endif default: return 0; } } /* History: V2.6.6 Sun Dec 5 07:42:19 1999 Doug Lea (dl at gee) * return null for negative arguments * Added Several WIN32 cleanups from Martin C. Fong * Add 'LACKS_SYS_PARAM_H' for those systems without 'sys/param.h' (e.g. WIN32 platforms) * Cleanup up header file inclusion for WIN32 platforms * Cleanup code to avoid Microsoft Visual C++ compiler complaints * Add 'USE_DL_PREFIX' to quickly allow co-existence with existing memory allocation routines * Set 'malloc_getpagesize' for WIN32 platforms (needs more work) * Use 'assert' rather than 'ASSERT' in WIN32 code to conform to usage of 'assert' in non-WIN32 code * Improve WIN32 'sbrk()' emulation's 'findRegion()' routine to avoid infinite loop * Always call 'fREe()' rather than 'free()' V2.6.5 Wed Jun 17 15:57:31 1998 Doug Lea (dl at gee) * Fixed ordering problem with boundary-stamping V2.6.3 Sun May 19 08:17:58 1996 Doug Lea (dl at gee) * Added pvalloc, as recommended by H.J. Liu * Added 64bit pointer support mainly from Wolfram Gloger * Added anonymously donated WIN32 sbrk emulation * Malloc, calloc, getpagesize: add optimizations from Raymond Nijssen * malloc_extend_top: fix mask error that caused wastage after foreign sbrks * Add linux mremap support code from HJ Liu V2.6.2 Tue Dec 5 06:52:55 1995 Doug Lea (dl at gee) * Integrated most documentation with the code. * Add support for mmap, with help from Wolfram Gloger (Gloger@lrz.uni-muenchen.de). * Use last_remainder in more cases. * Pack bins using idea from colin@nyx10.cs.du.edu * Use ordered bins instead of best-fit threshhold * Eliminate block-local decls to simplify tracing and debugging. * Support another case of realloc via move into top * Fix error occuring when initial sbrk_base not word-aligned. * Rely on page size for units instead of SBRK_UNIT to avoid surprises about sbrk alignment conventions. * Add mallinfo, mallopt. Thanks to Raymond Nijssen (raymond@es.ele.tue.nl) for the suggestion. * Add `pad' argument to malloc_trim and top_pad mallopt parameter. * More precautions for cases where other routines call sbrk, courtesy of Wolfram Gloger (Gloger@lrz.uni-muenchen.de). * Added macros etc., allowing use in linux libc from H.J. Lu (hjl@gnu.ai.mit.edu) * Inverted this history list V2.6.1 Sat Dec 2 14:10:57 1995 Doug Lea (dl at gee) * Re-tuned and fixed to behave more nicely with V2.6.0 changes. * Removed all preallocation code since under current scheme the work required to undo bad preallocations exceeds the work saved in good cases for most test programs. * No longer use return list or unconsolidated bins since no scheme using them consistently outperforms those that don't given above changes. * Use best fit for very large chunks to prevent some worst-cases. * Added some support for debugging V2.6.0 Sat Nov 4 07:05:23 1995 Doug Lea (dl at gee) * Removed footers when chunks are in use. Thanks to Paul Wilson (wilson@cs.texas.edu) for the suggestion. V2.5.4 Wed Nov 1 07:54:51 1995 Doug Lea (dl at gee) * Added malloc_trim, with help from Wolfram Gloger (wmglo@Dent.MED.Uni-Muenchen.DE). V2.5.3 Tue Apr 26 10:16:01 1994 Doug Lea (dl at g) V2.5.2 Tue Apr 5 16:20:40 1994 Doug Lea (dl at g) * realloc: try to expand in both directions * malloc: swap order of clean-bin strategy; * realloc: only conditionally expand backwards * Try not to scavenge used bins * Use bin counts as a guide to preallocation * Occasionally bin return list chunks in first scan * Add a few optimizations from colin@nyx10.cs.du.edu V2.5.1 Sat Aug 14 15:40:43 1993 Doug Lea (dl at g) * faster bin computation & slightly different binning * merged all consolidations to one part of malloc proper (eliminating old malloc_find_space & malloc_clean_bin) * Scan 2 returns chunks (not just 1) * Propagate failure in realloc if malloc returns 0 * Add stuff to allow compilation on non-ANSI compilers from kpv@research.att.com V2.5 Sat Aug 7 07:41:59 1993 Doug Lea (dl at g.oswego.edu) * removed potential for odd address access in prev_chunk * removed dependency on getpagesize.h * misc cosmetics and a bit more internal documentation * anticosmetics: mangled names in macros to evade debugger strangeness * tested on sparc, hp-700, dec-mips, rs6000 with gcc & native cc (hp, dec only) allowing Detlefs & Zorn comparison study (in SIGPLAN Notices.) Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu) * Based loosely on libg++-1.2X malloc. (It retains some of the overall structure of old version, but most details differ.) */ muddleftpd-1.3.13.1/src/mudlogd.c0100644000175000017500000001414207737077257015502 0ustar joergjoerg/* Copyright (C) 2001 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" #define FALSE 0 #define TRUE !FALSE int signumber; void sighandler(int signum) { signumber = signum; } int openfifo(char *fifoname) { struct stat inf; if (stat(fifoname, &inf) == -1) { /* try creating it */ if (mknod(fifoname, S_IFIFO | 0600, 0) == -1) return(-1); } else { /* make sure it is a fifo */ if (!S_ISFIFO(inf.st_mode)) { errno = EEXIST; return(-1); } } return(open(fifoname, O_RDONLY)); } int reopenlog(char *logfile, int *logfd) { int newlogfd; newlogfd = open(logfile, O_APPEND | O_CREAT | O_WRONLY, 0600); if (newlogfd != -1) { close(*logfd); *logfd = newlogfd; } return(newlogfd != -1); } char *reloadlogfile(char *fconfig) { CONFIGFILECACHE *cfiledata; int line, error, section; char *newlogfile; cfiledata = loadconfigcache(fconfig, &line, &error); if (cfiledata == NULL) return(NULL); section = getsectionid(cfiledata, "logger"); if (section == -1) goto error; loadstrfromconfig(cfiledata, section, "logfile", &newlogfile, NULL); if (!newlogfile) goto error; if (newlogfile[0] != '/') goto error; newlogfile = strdupwrapper(newlogfile); /* free config info */ freeconfigcache(cfiledata); return(newlogfile); error: freeconfigcache(cfiledata); return(NULL); } void usage(char *name) { printf("mudlogd, handles muddleftpd logging and rotation.\n\n"); printf("Usage: %s [-V][-h][-c configfile]\n\n", name); printf(" -V Show version information.\n"); printf(" -h Show usage information.\n"); printf(" -c configfile Specify config file mudlogd to run using.\n\n"); exit(1); } int main(int argc, char **argv) { CONFIGFILECACHE *cfiledata; struct sigaction sig1act; char *fconfig = NULL; char *fifoname = NULL; char *logoutname = NULL; int section, line, error; int ch, f; int outfile, infile; extern char *optarg; char *newlogfile = NULL; while((ch = getopt(argc, argv, "Vc:h")) != EOF) { switch(ch) { case 'V': showversion("mudlogd"); break; case 'c': fconfig = optarg; break; case 'h': default: usage(argv[0]); } } if (fconfig == NULL) fconfig = CONFIGFILE; cfiledata = loadconfigcache(fconfig, &line, &error); /* obtain scratchfile name */ if (cfiledata == NULL) ERRORMSGFATAL(safe_snprintf("Could not load line %d of config file: %s", line, config_errorstr(error))); section = getsectionid(cfiledata, "logger"); if (section == -1) ERRORMSGFATAL("Could not find logger section in config file"); loadstrfromconfig(cfiledata, section, "fifoname", &fifoname, NULL); if (!fifoname) ERRORMSGFATAL("fifoname not specified in config file"); if (fifoname[0] != '/') ERRORMSGFATAL("fifoname is not a valid absolute filename"); fifoname = strdupwrapper(fifoname); loadstrfromconfig(cfiledata, section, "logfile", &logoutname, NULL); if (!logoutname) ERRORMSGFATAL("logfile not specified in config file"); if (logoutname[0] != '/') ERRORMSGFATAL("logfile is not a valid absolute filename"); logoutname = strdupwrapper(logoutname); /* free config info */ freeconfigcache(cfiledata); /* open the log file, make sure it works before returning to the user */ outfile = open(logoutname, O_APPEND | O_CREAT | O_WRONLY, 0600); if (outfile == -1) ERRORMSGFATAL(safe_snprintf("could not open logfile (%s)", strerror(errno))); f = fork(); if (f == -1) ERRORMSGFATAL("could not fork()"); else if (f == 0) { int len, doquit, schedrotate; char data[4096]; char lastch = '\n'; setsid(); signumber = 0; sig1act.sa_handler = sighandler; sig1act.sa_flags = 0; sigaction(SIGUSR1, &sig1act, NULL); sig1act.sa_handler = sighandler; sig1act.sa_flags = 0; sigaction(SIGHUP, &sig1act, NULL); while(1) { schedrotate = FALSE; /* reopen the fifo channel, ignoring any signals for now */ do { infile = openfifo(fifoname); if ((infile == -1) && (errno == EINTR)) schedrotate = TRUE; signumber = 0; } while ((infile == -1) && (errno == EINTR)); if (infile == -1) ERRORMSGFATAL(safe_snprintf("could not open fifo file (%s)", strerror(errno))); doquit = FALSE; while(!doquit) { if (schedrotate && (lastch == '\n')) { if (newlogfile) { if (reopenlog(newlogfile, &outfile)) { freewrapper(logoutname); logoutname = newlogfile; } else freewrapper(newlogfile); newlogfile = NULL; } else reopenlog(logoutname, &outfile); schedrotate = FALSE; } errno = 0; len = read(infile, data, 4096); if (signumber != 0) { if (signumber == SIGUSR1) { if (lastch == '\n') reopenlog(logoutname, &outfile); else schedrotate = TRUE; } else if (signumber == SIGHUP) { /* load config again */ newlogfile = reloadlogfile(fconfig); if (newlogfile) { if (lastch == '\n') { if (reopenlog(newlogfile, &outfile)) { freewrapper(logoutname); logoutname = newlogfile; } else freewrapper(newlogfile); newlogfile = NULL; } else schedrotate = TRUE; } } signumber = 0; } if (len > 0) { lastch = data[len-1]; len = write(outfile, data, len); } if ((len <= 0) && (errno != EINTR)) doquit = TRUE; } close(infile); } } /* not reached but shuts the compiler up */ exit(0); } muddleftpd-1.3.13.1/src/mudpasswd.c0100644000175000017500000002357707737077257016072 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper this is a quick hack for mudpasswd, servicable 1 nighter this has had some more work on it now, it is safer to use and can't destroy your password file warning, this code is not buffer overflow safe. DONT RUN AS SETUID ROOT This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "../config.h" #define FALSE 0 #define TRUE !FALSE #define MAXSTRLEN 4096 #define ERRORMSGFATAL(x) { printf("mudpasswd: %s\n", x); exit(1); } #define NOSIGNALINTR(x) (x) #include #include #include #include #include #include #include #include #ifdef HAVE_CRYPT_H #include #endif #define ROOTMSK 1 #define HOMEMSK 2 #define PASSMSK 4 extern void showversion(char *desc); char *strsplit(char *in, char *cmd, char *data) { int pos = 0; int pos2 = 0; if (in[strlen(in) - 1] == 10) in[strlen(in) - 1] = 0; while((in[pos] <= 32) && (in[pos] != 0)) pos++; if ((in[pos] == '#') || (in[pos] == 0)) return(NULL); while((in[pos] != 32) && (in[pos] != 0)) { cmd[pos2] = in[pos]; pos2++; pos++; } if (in[pos] == 0) return(NULL); cmd[pos2] = 0; while((in[pos] <= 32) && (in[pos] != 0)) pos++; if (in[pos] == 0) return(NULL); pos2 = 0; while((in[pos] != 32) && (in[pos] != 0) && (in[pos] != '\n')) { if ((in[pos] == '\\') && (in[pos+1] != 0)) pos++; data[pos2] = in[pos]; pos2++; pos++; } data[pos2] = 0; return(data); } char getsaltchar(void) { char outchr; outchr = random() & 63; if (outchr < 26) outchr += 'A'; else if (outchr < 52) outchr += 'a' - 26; else if (outchr < 62) outchr += '0' - 52; else if (outchr == 62) outchr = '.'; else outchr = '/'; return(outchr); } char *cryptedpass(char *clearpass) { char salt[5]; srandom((unsigned int)time(NULL)); salt[0] = getsaltchar(); salt[1] = getsaltchar(); salt[2] = 0; return(crypt(clearpass, salt)); } void usage(void) { printf("\nMuddleftpd Password File Editor.\n\n"); printf("Usage: mudpasswd [options]\n\n"); printf(" -p passfile The filename of the password file to use\n"); printf(" -a username Adds a new username\n"); printf(" -e username Edits the properties of a username\n"); printf(" -d username Deletes the username from the password file\n"); printf(" -P password Sets a new password\n"); printf(" -R directory Sets a new root directory for the user.\n"); printf(" -H directory Sets a new home directory for the user.\n"); printf(" -W Changes the password using user input.\n"); printf(" -h Displays this usage message.\n"); printf(" -V Displays version information.\n\n"); printf("You must specify -p and only one of -a -e or -d when running mudpasswd\n\n"); exit(0); } int searchuser(char *passfile, char *username) { FILE *passwdfile; char instring[MAXSTRLEN], username2[MAXSTRLEN], data[MAXSTRLEN]; passwdfile = fopen(passfile, "r"); if (!passwdfile) return(FALSE); while (fgets(instring, MAXSTRLEN, passwdfile) != NULL) { if (strsplit(instring, username2, data) != NULL) if (strcmp(username2, username) == 0) { fclose(passwdfile); return(TRUE); } } fclose(passwdfile); return(FALSE); } void adduser(char *passfile, char *username, char *rootdir, char *homedir, char *password) { FILE *passwdfile; int pos; if (searchuser(passfile, username)) ERRORMSGFATAL("Username already exists - Operation Failed!"); passwdfile = fopen(passfile, "a+"); if (passwdfile == NULL) ERRORMSGFATAL("Cannot open password file!"); pos = ftell(passwdfile); if (pos > 0) { char chkchr; fseek(passwdfile, -1, SEEK_CUR); chkchr = fgetc(passwdfile); if (chkchr != '\n') { fseek(passwdfile, 1, SEEK_CUR); fprintf(passwdfile, "\n"); } } if (!passwdfile) ERRORMSGFATAL("Couldn't open password file for writing!"); fprintf(passwdfile, "%s %s:%s:%s\n", username, cryptedpass(password), homedir, rootdir); fclose(passwdfile); } void deleteuser(char *passfile, char *username) { FILE *passwdfilein, *passwdfileout; char instring[MAXSTRLEN], username2[MAXSTRLEN], data[MAXSTRLEN]; char newpassfile[MAXSTRLEN]; if (!searchuser(passfile, username)) ERRORMSGFATAL("Username doesn't exists - Operation Failed!"); strncpy(newpassfile, passfile, 4096); strncat(newpassfile, ".new", 4096 - strlen(newpassfile)); passwdfilein = fopen(passfile, "r"); if (!passwdfilein) ERRORMSGFATAL("Could not open password file!"); passwdfileout = fopen(newpassfile, "w"); if (!passwdfileout) ERRORMSGFATAL("Could not open replacement password file!"); while (fgets(instring, MAXSTRLEN, passwdfilein) != NULL) { int n = TRUE; if (strsplit(instring, username2, data) != NULL) if (strcmp(username2, username) == 0) n = FALSE; if (n) fprintf(passwdfileout, "%s\n", instring); } fclose(passwdfilein); fclose(passwdfileout); if (rename(newpassfile, passfile) == -1) { unlink(newpassfile); ERRORMSGFATAL("Could not replace password file!"); } } void edituserstr(char *userstr, int attrmask, char *password, char *rootdir, char *homedir, char *username, char *data) { char passwordold[MAXSTRLEN], homedirold[MAXSTRLEN], rootdirold[MAXSTRLEN]; char *pos; strcpy(passwordold, ""); strcpy(homedirold, ""); strcpy(rootdirold, ""); /* get old settings */ if ((pos = strchr(data, ':')) != NULL) { strncpy(passwordold, data, 4096); pos = strchr(passwordold, ':'); *pos = 0; pos++; } if (pos != NULL) if ((strchr(pos, ':')) != NULL) { strncpy(homedirold, pos, 4096); pos = strchr(homedirold, ':'); *pos = 0; pos++; } if (pos != NULL) strncpy(rootdirold, pos, 4096); if (attrmask & ROOTMSK) strncpy(rootdirold, rootdir, 4096); if (attrmask & HOMEMSK) strncpy(homedirold, homedir, 4096); if (attrmask & PASSMSK) strncpy(passwordold, cryptedpass(password), 4096); snprintf(userstr, MAXSTRLEN, "%s %s:%s:%s", username, passwordold, homedirold, rootdirold); userstr[MAXSTRLEN-1] = 0; } void edituser(char *passfile, char *username, char *rootdir, char *homedir, char *password, int attrmask) { FILE *passwdfilein, *passwdfileout; char instring[MAXSTRLEN], username2[MAXSTRLEN], data[MAXSTRLEN]; char newpassfile[MAXSTRLEN]; if (!searchuser(passfile, username)) ERRORMSGFATAL("Username doesn't exists - Operation Failed!"); strncpy(newpassfile, passfile, 4096); strncat(newpassfile, ".new", 4096 - strlen(newpassfile)); passwdfilein = fopen(passfile, "r"); if (!passwdfilein) ERRORMSGFATAL("Could not open password file!"); passwdfileout = fopen(newpassfile, "w"); if (!passwdfileout) ERRORMSGFATAL("Could not open replacement password file!"); while (fgets(instring, MAXSTRLEN, passwdfilein) != NULL) { int n = TRUE; if (strsplit(instring, username2, data) != NULL) if (strcmp(username2, username) == 0) edituserstr(instring, attrmask, password, rootdir, homedir, username, data); if (n) fprintf(passwdfileout, "%s\n", instring); } fclose(passwdfilein); fclose(passwdfileout); if (rename(newpassfile, passfile) == -1) { unlink(newpassfile); ERRORMSGFATAL("Could not replace password file!"); } } int main(int argc, char **argv) { int ch; char *passfile = NULL; char *username = NULL; char *password = NULL; char *homedir = NULL; char *rootdir = NULL; int add_user = FALSE; int delete_user = FALSE; int edit_user = FALSE; int edit_mask = FALSE; extern char *optarg; /* stolen from smbpasswd - checking for setuid root! */ /* Check the effective uid - make sure we are not setuid */ if ((geteuid() == (uid_t)0) && (getuid() != (uid_t)0)) ERRORMSGFATAL("mudpasswd must *NOT* be setuid root.\n"); while ((ch = getopt(argc, argv, "p:a:d:e:P:R:H:WhV")) != EOF) { switch(ch) { case 'V': showversion("mudpasswd"); case 'p': passfile = optarg; break; case 'a': add_user = TRUE; username = optarg; break; case 'd': delete_user = TRUE; username = optarg; break; case 'e': edit_user = TRUE; username = optarg; break; case 'P': password = optarg; edit_mask |= PASSMSK; break; case 'R': rootdir = optarg; edit_mask |= ROOTMSK; break; case 'H': homedir = optarg; edit_mask |= HOMEMSK; break; case 'W': edit_mask |= PASSMSK; break; case 'h': usage(); break; default: usage(); } } if (!passfile) usage(); if (add_user) { if (edit_user || delete_user) usage(); if (!homedir) { homedir = (char *)malloc(MAXSTRLEN); printf("Enter Home Directory For New User: "); fgets(homedir, MAXSTRLEN, stdin); homedir[strlen(homedir) - 1] = 0; } if (!rootdir) { rootdir = (char *)malloc(MAXSTRLEN); printf("Enter Root Directory For New User: "); fgets(rootdir, MAXSTRLEN, stdin); rootdir[strlen(rootdir) - 1] = 0; } if (!password) { password = getpass("Enter Password For New User: "); } adduser(passfile, username, rootdir, homedir, password); exit(0); } if (delete_user) { if (edit_user) usage(); deleteuser(passfile, username); exit(0); } if (edit_user) { if (!edit_mask) usage(); if (!password && (edit_mask & PASSMSK)) { password = getpass("Enter Password For New User: "); } edituser(passfile, username, rootdir, homedir, password, edit_mask); exit(0); } usage(); return(0); } muddleftpd-1.3.13.1/src/myglob.c0100644000175000017500000002031507737077257015337 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "ftpd.h" /* My attempt at creating a fnmatch funciton. This actually isn't bad for my first attempt, It seems to beat the library equivelent in the GNU library for everything but complicated expressions with many star tokens. */ /* this matches square bracket stuff */ int bracket_match(unsigned char letter, unsigned char *pattern) { unsigned fchar = 0; int partdone; int inverse = FALSE; /* see if the pattern is inversed */ if ((*pattern == '!') || (*pattern == '^')) { inverse = TRUE; pattern++; } while (*pattern != 0) { fchar = *pattern; partdone = FALSE; /* search for character range */ if (*(pattern + 1) != 0) if ((*(pattern + 1) == '-') && (*(pattern + 2) != 0)) { /* found an a-z thingy */ if ((letter >= fchar) && (letter <= *(pattern + 2))) return(!inverse); partdone = TRUE; pattern += 3; } if (!partdone) { /* match as a single character */ if (letter == *pattern) return(!inverse); pattern++; } } return(inverse); } int my_dofnmatch(char *pattern, char *string, char *endstr) { unsigned char *ppos, *spos; ppos = pattern; spos = string; while(*ppos != 0) { switch(*ppos) { /* this is simple too */ case '\\' : { ppos++; if ((*ppos == 0) || (*spos == 0)) return(-1); if (*spos != *ppos) return(-1); spos++; break; } /* this one is easy, one character */ case '?' : { if (*spos != 0) spos++; else return(-1); break; } /* this one is a hard one! */ case '[' : { char *start = ppos + 1; char oldchar; while((*ppos != 0) && (*ppos != ']')) ppos++; if (*ppos == 0) return(-1); if (*(ppos + 1) == ']') ppos++; oldchar = *(ppos + 1); *(ppos + 1) = 0; if (!bracket_match(*spos, start)) return(-1); *(ppos + 1) = oldchar; spos++; break; } /* this one sucks bigtime */ case '*' : { unsigned char *subpat; /* this is a fast track for common patterns like '*' */ /* since * matches any string, if everything has matched so far, and no more info pattern is after the star, then the match is successful */ if (*(ppos + 1) == 0) return(0); /* since there is data after the *, we have to greedyly (by starting at the end of the string) match the * */ subpat = endstr; while(subpat != spos) { subpat--; if (my_dofnmatch(ppos + 1, subpat, endstr) == 0) return(0); } /* if we cannot match the subpattern, then it is not going to work no matter what */ return(-1); } /* this is trivial */ default: { if (*spos != *ppos) return(-1); spos++; } } ppos++; } /* if we reach the end of the pattern, then we must also have nothing left in the string */ if (*spos == 0) return(0); return(-1); } int my_dofnmatchpath(unsigned char *pattern, unsigned char *string, unsigned char *endstr) { unsigned char *ppos, *spos; ppos = pattern; spos = string; while(*ppos != 0) { switch(*ppos) { /* this is simple too */ case '\\' : { ppos++; if ((*ppos == 0) || (*spos == 0)) return(-1); if (*spos != *ppos) return(-1); spos++; break; } /* this one is easy, one character */ case '?' : { if ((*spos != 0) && (*spos != '/')) spos++; else return(-1); break; } /* this one is a hard one! */ case '[' : { char *start = ppos + 1; char oldchar; if ((*spos == '/') || (*spos == 0)) return(-1); while((*ppos != 0) && (*ppos != ']')) ppos++; if (*ppos == 0) return(-1); if (*(ppos + 1) == ']') ppos++; oldchar = *(ppos + 1); *(ppos + 1) = 0; if (!bracket_match(*spos, start)) return(-1); *(ppos + 1) = oldchar; spos++; break; } /* this one sucks bigtime */ case '*' : { unsigned char *subpat; /* this is a fast track for common patterns like '*' disabled for path work since * means everything except / */ /* start from curret pos and attempt to find first /, since * cannot match any further than that! */ subpat = spos; while((*subpat != '/') && (subpat != endstr)) subpat++; /* since there is data after the *, we have to greedyly (by starting at the end of the string) match the * */ while(subpat != spos) { subpat--; if (my_dofnmatchpath(ppos + 1, subpat, endstr) == 0) return(0); } /* if we cannot match the subpattern, then it is not going to work no matter what */ return(-1); } /* this is trivial */ default: { if (*spos != *ppos) return(-1); spos++; } } ppos++; } /* if we reach the end of the pattern, then we must also have nothing left in the string */ if (*spos == 0) return(0); return(-1); } /* this is a wrapper for the recursive function about, giving the correct parameters. */ int my_fnmatch(char *pattern, char *string, int flags) { if (flags != FNM_PATHNAME) { if ((pattern[0] == '*') && (pattern[1] == 0)) return(0); return(my_dofnmatch(pattern, string, strchr(string, 0))); } else return(my_dofnmatchpath(pattern, string, strchr(string, 0))); } void qsortarray(char **l, int start, int end) { int left = start; int right = end; int pivot = left; char *temp; if (left == right) return; while(left != right) { if (strcmp(l[left], l[right]) > 0) { /* swap left and right */ temp = l[left]; l[left] = l[right]; l[right] = temp; if (pivot == left) { pivot = right; left++; } else { pivot = left; right--; } } else { if (pivot == left) right--; else left++; } } if (pivot > start) qsortarray(l, start, pivot - 1); if (pivot < end) qsortarray(l, pivot + 1, end); } MYGLOBDATA *myglob (char *dir, char *pattern, int allfiles, int sortforward) { MYGLOBDATA *g = NULL; int error = 0; DIR *globdir = NULL; int count; struct dirent *filedat; error = chdir(dir); if (!error) error = ((globdir = opendir(".")) == NULL); if (!error) { g = mallocwrapper(sizeof(MYGLOBDATA)); g->namecount = 0; g->name = NULL; g->stat_buf = NULL; g->blocks = 0; while((filedat = readdir(globdir)) != NULL) { if ((filedat->d_name[0] != '.') || (allfiles)) { if (my_fnmatch(pattern, filedat->d_name, 0) == 0) { (g->namecount)++; reallocwrapper(sizeof(char **) * g->namecount, (void *)&(g->name)); g->name[g->namecount - 1] = strdupwrapper(filedat->d_name); } } } reallocwrapper(sizeof(char **) * (g->namecount + 1), (void *)&(g->name)); g->name[g->namecount] = NULL; if (g->namecount > 0) { qsortarray(g->name, 0, g->namecount-1); g->stat_buf = mallocwrapper(sizeof(struct stat) * (g->namecount)); for(count = 0; count < g->namecount; count++) { if (lstat(g->name[count], g->stat_buf + count) == -1) { printf("stat error\n"); memset(g->stat_buf + count, 0, sizeof(struct stat)); } else g->blocks += g->stat_buf[count].st_blocks / 2; } } } if (globdir) closedir(globdir); return(g); } void myglobfree (MYGLOBDATA *g) { int count; if (g->name) { for (count = 0; count < g->namecount; count++) freewrapper(g->name[count]); freewrapper(g->name); freeifnotnull(g->stat_buf); } freewrapper(g); } muddleftpd-1.3.13.1/src/myglob.h0100644000175000017500000000261407737077257015346 0ustar joergjoerg/* Copyright (C) 1991, 92, 95, 96, 97, 98 Free Software Foundation, Inc. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Modified By Beau Kuiper to be a simplified version for muddleftpd */ typedef struct { int namecount; /* Count of paths matched by the pattern. */ unsigned long blocks; /* size of directory in blocks */ char **name; /* List of matched pathnames. */ struct stat *stat_buf; /* file information. */ } MYGLOBDATA; MYGLOBDATA *myglob ( char *dir, char *pattern, int flags, int sortforward ); /* Free storage allocated in PGLOB by a previous `glob' call. */ extern void myglobfree (MYGLOBDATA *g); extern int my_fnmatch(char *, char *, int); muddleftpd-1.3.13.1/src/newfile.c0100644000175000017500000000502307737077257015476 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" int readbuffer(NEWFILE *file) { char inbuf[BUFFERSIZE]; int size, oldsize = STRLENGTH(file->buffer); size = read(file->fd, inbuf, BUFFERSIZE); if (size == 0) file->eof = TRUE; else if (size == -1) { ERRORMSG(strerror(errno)); file->eof = TRUE; } if (file->eof) return(size); string_cat(&(file->buffer), inbuf, size); string_filterbadchars_unix(&(file->buffer), oldsize); return(STRLENGTH(file->buffer) - oldsize); } NEWFILE *nfopen(char *filename) { NEWFILE *new; /* if we get null, return null! */ if (!filename) return(NULL); new = mallocwrapper(sizeof(NEWFILE)); new->fd = open(filename, O_RDONLY); if (new->fd == -1) { freewrapper(new); return(NULL); } new->buffer = string_new(); new->eof = FALSE; return(new); } NEWFILE *nfdopen(int fd) { NEWFILE *new = mallocwrapper(sizeof(NEWFILE)); new->fd = fd; if (new->fd == -1) { freewrapper(new); return(NULL); } new->buffer = string_new(); new->eof = FALSE; return(new); } char *nfgetcs(NEWFILE *file, char testchar) { char *bptr, *result; int slen; int bufferlen = 0; int nextbuflen = STRLENGTH(file->buffer); if (file->eof) return(NULL); while((bptr = strchr(STRTOCHAR(file->buffer) + bufferlen, (int)testchar)) == NULL) { bufferlen += nextbuflen; nextbuflen = readbuffer(file); if (nextbuflen == 0) { bptr = STRTOCHAR(file->buffer) + STRLENGTH(file->buffer); break; } else if (nextbuflen == -1) return(NULL); } /* set up the result */ slen = bptr - STRTOCHAR(file->buffer) + 1; result = mallocwrapper(slen + 1); memcpy(result, STRTOCHAR(file->buffer), slen); result[slen] = 0; /* fix up the buffer */ string_dropfront(&(file->buffer), slen); return(result); } void nfclose(NEWFILE *file) { close(file->fd); freewrapper(file->buffer); freewrapper(file); } muddleftpd-1.3.13.1/src/pnums.h0100644000175000017500000000322507737077257015216 0ustar joergjoerg#ifndef MAXNAMELEN #define MAXNAMELEN 80 #endif #define DESCRIPLEN 120 /* error numbers for login overloading */ #define HOSTFULL 1 /* host reached maximum limit */ #define GROUPFULL 2 /* group reached maximum limit */ #define VSERVERFULL 3 /* virtual server reached maximum limit */ #define IPHOSTFULL 4 /* per ip limit for the host reached */ #define IPVSERVERFULL 5 /* per ip limit for the virtual server reached */ /* this will be used by sub-programs of muddleftpd to make sure it is running under the correct version of muddleftpd and it isn't accessing someone elses memory area */ #define CURRENTMAGIC 704198001 typedef struct { int magic; int serverusercount; int servermaxcount; int groupareastart; int numvserver; int numgroups; int numrecs; pid_t pid; } SHRMEMHEADER; typedef struct { char name[MAXSECTIONLEN]; int count; int max; } SHRMEMDATA; typedef struct { char username[MAXNAMELEN]; char groupname[MAXSECTIONLEN]; char vserver[MAXSECTIONLEN]; char currentop[DESCRIPLEN]; char remotehost[MAXNAMELEN]; int pid; unsigned int ip; } SCRFILEREC; #define SCRF_USERNAME 0 #define SCRF_GROUPNAME MAXNAMELEN #define SCRF_VSERVER SCRF_GROUPNAME + MAXSECTIONLEN #define SCRF_CURRENTOP SCRF_VSERVER + MAXSECTIONLEN #define SCRF_REMOTEHOST SCRF_CURRENTOP + DESCRIPLEN #define SCRF_PID SCRF_REMOTEHOST + MAXNAMELEN typedef struct { char username[MAXNAMELEN]; char currentop[DESCRIPLEN]; char remotehost[MAXNAMELEN]; int group; int vserver; volatile int pid; unsigned int ip; } SCRMEMREC; #define SHRMEMDATPOS(s,x) ((SHRMEMDATA *)((char *)(s) + sizeof(SHRMEMHEADER)) + (x)) #define SHMEMSIZE 1024 * 1024 #define SHMEMPROCSTART 128 * 1024 muddleftpd-1.3.13.1/src/procnum.c0100644000175000017500000004516107737077257015537 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" /* these are used when the server is run in standalone mode. In standalone mode shared memory is used to hold user info */ SHRMEMHEADER *shdata = NULL; /* The start of the shared memory, containing the vserver, group records */ SCRMEMREC *procdata = NULL; /* start of array holding thread info. This is all in memory since it is much faster. */ int nextthid = -1; /* the next free thread id in the list */ int shlockfile = -1; /* file fd used with fcntl file locking to control access to the shared memory. This is typically the config file */ int shnumber = -1; /* the number allocated to the shared memory area. */ /* these are used when the server is run in inetd mode */ int scratchfile = -1; /* The fd of the scratchfile. The scratchfile is used to co-ordinate group limits. */ /* used by both modes */ int thid = -1; /* The thread id of the current muddleftpd client */ /* these simplify writing to the process areas */ void writescratch(int pos, int size, char *buff) { lseek(scratchfile, pos, SEEK_SET); write(scratchfile, buff, size); } void writeshmem(int num, int pos, int len, void *buff) { lockarea(shlockfile, 10+num, 1, F_WRLCK, TRUE); /* messy. Basicly num is added to procdata as a SCRMEMREC pointer then pos is added as a char pointer */ memcpy((char *)(procdata + num) + pos, buff, len); lockarea(shlockfile, 10+num, 1, F_UNLCK, TRUE); } void write_procstr(int cthid, int shmem_pos, int file_pos, int length, char *strbuff) { char endchr = 0; int writelen = strlen(strbuff) + 1; /* if string is too long, null terminate it! */ if (writelen >= length) { endchr = strbuff[length-1]; strbuff[length-1] = 0; writelen = length; } if (inetd) writescratch(cthid * sizeof(SCRFILEREC) + file_pos, writelen, strbuff); else writeshmem(cthid, shmem_pos, writelen, strbuff); if (endchr != 0) strbuff[length-1] = endchr; } void shinfo_addtogrouplist(VSERVER *vs) { SHRMEMDATA *dpos; int gpos = 0; int count, flag, section, maxcount; while(vs->grouplist[gpos] != NULL) { /* check to see if the group is already in the list */ flag = FALSE; dpos = SHRMEMDATPOS(shdata, shdata->numvserver); for(count = 0; count < shdata->numgroups; count++) { if (strncmp(vs->grouplist[gpos], dpos->name, MAXSECTIONLEN) == 0) flag = TRUE; dpos++; } if (!flag) { /* get maxuser information */ section = getsectionid(config->configfile, vs->grouplist[gpos]); loadintfromconfig(config->configfile, section, "maxusers", &maxcount, config->defaults->maxusers); /* A group with 0 maxusers doesn't get added! */ if (maxcount == 0) flag = TRUE; } if (!flag) { /* add the group, dpos is already initalized from above loop */ strncpy(dpos->name, vs->grouplist[gpos], MAXNAMLEN); dpos->name[MAXSECTIONLEN-1] = 0; dpos->max = maxcount; dpos->count = 0; shdata->numgroups++; } gpos++; } } void shinfo_setuparea(void) { int count = 0; SHRMEMDATA *vpos; VSERVER *vs; shdata->magic = CURRENTMAGIC; shdata->serverusercount = 0; shdata->servermaxcount = config->defaults->maxusers; shdata->numvserver = 0; shdata->numgroups = 0; shdata->pid = getpid(); vpos = SHRMEMDATPOS(shdata, 0); vs = config->vservers; while(config->vserverlist[count] != NULL) { vpos->count = 0; vpos->max = vs->maxusers; strncpy(vpos->name, config->vserverlist[count], MAXSECTIONLEN); vpos->name[MAXSECTIONLEN-1] = 0; vpos++; vs = vs->next; shdata->numvserver++; count++; } vs = config->vservers; if (!vs) shinfo_addtogrouplist(config->defaults); else while(vs) { shinfo_addtogrouplist(vs); vs = vs->next; } if (((config->defaults->maxusers * sizeof(SCRMEMREC)) > (SHMEMSIZE - SHMEMPROCSTART)) || ((shdata->numvserver + shdata->numgroups) * sizeof(SHRMEMDATA) + sizeof(SHRMEMHEADER) > SHMEMPROCSTART)) ERRORMSGFATAL("Not enough shared memory to support configuration."); } void shinfo_init(char *scfilename) { int count, new; scratchfile = open(scfilename, O_RDWR | O_CREAT, 0600); if (scratchfile == -1) ERRORMSGFATAL("Could not open scratch file!"); shdata = (SHRMEMHEADER *)shmem_get(scfilename, SHMEMSIZE, &shnumber, &new, &shlockfile); /* attempt to lock the shared area to say I am home */ if (!lockarea(shlockfile, 3, 1, F_WRLCK, FALSE)) ERRORMSGFATAL("Muddleftpd already running!"); /* make sure no-body else gets in */ lockarea(shlockfile, 0, 3, F_WRLCK, TRUE); shinfo_setuparea(); lockarea(shlockfile, 0, 3, F_UNLCK, TRUE); procdata = (SCRMEMREC *)((char *)(shdata) + SHMEMPROCSTART); /* initalize pidmapping list. stores free list as negative values */ for (count = 0; count < config->defaults->maxusers; count++) { procdata[count].pid = -(count + 1); strcpy(procdata[count].username, "none"); procdata[count].vserver = -1; procdata[count].group = -1; procdata[count].ip = 0; } shdata->numrecs = config->defaults->maxusers; /* set the start pointer to the first thread */ nextthid = 0; } void inetd_init(char *scfile) { scratchfile = open(scfile, O_RDWR | O_CREAT, 0600); if (scratchfile == -1) ERRORMSGFATAL("Could not open scratch file!"); } /* this reinitalizes the shared memory area, when config file is updated */ void shinfo_reinit(void) { int count, count2; SHRMEMHEADER *old = mallocwrapper(SHMEMPROCSTART); SHRMEMDATA *datnew, *datold; lockarea(shlockfile, 0, 3, F_WRLCK, TRUE); lockarea(shlockfile, 10, shdata->numrecs, F_WRLCK, TRUE); memcpy(old, shdata, sizeof(SHRMEMHEADER) + sizeof(SHRMEMDATA) * (shdata->numvserver + shdata->numgroups)); /* reinitalize area */ shinfo_setuparea(); /* move over old data */ shdata->serverusercount = old->serverusercount; shdata->numrecs = old->numrecs; /* update vservers */ datnew = SHRMEMDATPOS(shdata, 0); for(count = 0; count < shdata->numvserver; count++) { datold = SHRMEMDATPOS(old, 0); for(count2 = 0; count2 < old->numvserver; count2++) { if (strncmp(datnew->name, datold->name, MAXSECTIONLEN) == 0) datnew->count = datold->count; datold++; } datnew++; } for(count = 0; count < shdata->numgroups; count++) { datold = SHRMEMDATPOS(old, old->numvserver); for(count2 = 0; count2 < old->numgroups; count2++) { if (strncmp(datnew->name, datold->name, MAXSECTIONLEN) == 0) datnew->count = datold->count; datold++; } datnew++; } /* now update all vserver and group id numbers */ for (count = 0; count < shdata->numrecs; count++) { char *vserver, *group; if ((procdata[count].vserver != -1) && (shdata->numvserver > 0)) { datold = SHRMEMDATPOS(old, procdata[count].vserver); vserver = datold->name; datnew = SHRMEMDATPOS(shdata, 0); procdata[count].vserver = -1; for (count2 = 0; count2 < shdata->numvserver; count2++) { if (strncmp(vserver, datnew->name, MAXSECTIONLEN) == 0) procdata[count].vserver = count2; datnew++; } } else procdata[count].vserver = -1; if (procdata[count].group >= 0) { datold = SHRMEMDATPOS(old, old->numvserver + procdata[count].group); group = datold->name; datnew = SHRMEMDATPOS(shdata, shdata->numvserver); /* say the user is orphaned */ procdata[count].group = -2; for (count2 = 0; count2 < shdata->numgroups; count2++) { if (strncmp(group, datnew->name, MAXSECTIONLEN) == 0) procdata[count].group = count2; datnew++; } } } if (shdata->servermaxcount > shdata->numrecs) { for (count = shdata->numrecs; count < shdata->servermaxcount; count++) { procdata[count].pid = -(count + 1); strcpy(procdata[count].username, "none"); procdata[count].vserver = -1; procdata[count].group = -1; procdata[count].ip = -1; } shdata->numrecs = shdata->servermaxcount; } lockarea(shlockfile, 0, 3, F_UNLCK, TRUE); lockarea(shlockfile, 10, old->numrecs, F_UNLCK, TRUE); freewrapper(old); } /* set the vserver for a logged in user. REQUIRED for HOST command support */ int shinfo_setvserver_standalone(int cthid, char *vservername, unsigned int ip, int viplimit, int *error) { int pos = 0; int done = 0; SHRMEMDATA *d = SHRMEMDATPOS(shdata, 0); int vipcount = 0; /* lock vserver-group counts */ *error = VSERVERFULL; lockarea(shlockfile, 0, 2, F_WRLCK, TRUE); while((pos < shdata->numvserver) && (!done)) { if (strncmp(vservername, d->name, MAXSECTIONLEN) == 0) if (d->count < d->max) /* found it all */ done = TRUE; if (!done) { pos++; d++; } } if ((done) && (viplimit > 0)) { /* safe as long as IP is not set elsewhere */ int count; for (count = 0; count < shdata->numrecs; count++) { lockarea(shlockfile, 10 + count, 1, F_WRLCK, TRUE); if ((procdata[count].ip == ip) && (procdata[count].vserver == pos)) vipcount++; lockarea(shlockfile, 10 + count, 1, F_UNLCK, TRUE); } if (vipcount >= viplimit) { *error = IPVSERVERFULL; done = FALSE; } } if (done) { lockarea(shlockfile, 10 + cthid, 1, F_WRLCK, TRUE); procdata[thid].vserver = pos; d->count++; lockarea(shlockfile, 10 + cthid, 1, F_UNLCK, TRUE); } lockarea(shlockfile, 0, 2, F_UNLCK, TRUE); return(done); } int shinfo_setvserver_inetd(int newthid, char *vservername, unsigned int ip, int vlimit, int viplimit, int *error) { int pos; int vipcount; int vcount; int done; SCRFILEREC d; pos = 0; vcount = 0; vipcount = 0; done = FALSE; /* grab general scratchfile lock */ lockarea(scratchfile, 0, 1, F_WRLCK, TRUE); lseek(scratchfile, 0, SEEK_SET); while(read(scratchfile, &d, sizeof(SCRFILEREC)) == sizeof(SCRFILEREC)) { /* don't count ourselves */ if (pos == thid) pos++; else if (lockarea(scratchfile, 10 + pos, 1, F_WRLCK, FALSE)) { /* if locking successed, no-one is home, unlock it */ lockarea(scratchfile, 10 + pos, 1, F_UNLCK, TRUE); } else { if (strncmp(d.vserver, vservername, MAXSECTIONLEN) == 0) { vcount++; if (d.ip == ip) vipcount++; } pos++; } } if ((viplimit > 0) && (vipcount >= viplimit)) *error = IPVSERVERFULL; else if (vcount >= vlimit) *error = VSERVERFULL; else { write_procstr(newthid, 0, SCRF_VSERVER, MAXSECTIONLEN, vservername); done = TRUE; } lockarea(scratchfile, 0, 1, F_UNLCK, TRUE); return(done); } int shinfo_setvserver(int cthid, char *vservername, unsigned int ip, int vlimit, int viplimit, int *error) { if (inetd) return(shinfo_setvserver_inetd(cthid, vservername, ip, vlimit, viplimit, error)); else return(shinfo_setvserver_standalone(cthid, vservername, ip, viplimit, error)); } int shinfo_newuser_standalone(unsigned int ip, int iplimit, int *error) { int tempnextthid, done = FALSE; lockarea(shlockfile, 0, 2, F_WRLCK, TRUE); /* see if we have space */ if (shdata->serverusercount >= shdata->servermaxcount) { thid = -1; *error = HOSTFULL; } else { thid = nextthid; tempnextthid = -procdata[thid].pid; done = TRUE; } if ((done) && (iplimit > 0)) { /* safe as long as IP is not set elsewhere (other than below) */ int count; int ipcount = 0; for (count = 0; count < shdata->numrecs; count++) { if (procdata[count].ip == ip) ipcount++; } if (ipcount >= iplimit) { done = FALSE; *error = IPHOSTFULL; } } if (done) { /* increment server count now login is confirmed */ shdata->serverusercount++; /* update shared memory */ lockarea(shlockfile, 10 + thid, 1, F_WRLCK, TRUE); strcpy(procdata[thid].username, ""); procdata[thid].group = -1; procdata[thid].vserver = -1; strcpy(procdata[thid].currentop, "none"); strcpy(procdata[thid].remotehost, "unknown"); procdata[thid].pid = -1; procdata[thid].ip = ip; lockarea(shlockfile, 10 + thid, 1, F_UNLCK, TRUE); /* now move the thids along */ nextthid = tempnextthid; } else thid = -1; lockarea(shlockfile, 0, 2, F_UNLCK, TRUE); return(thid); } int shinfo_adduser_inetd(unsigned int ip, int slimit, int iplimit, int *error) { SCRFILEREC d; int scount, ipcount, pos, full; /* we are running inetd. go through scratch file, find an empty record, and count space in file. */ pos = 0; scount = 0; thid = -1; full = FALSE; /* grab general scratchfile lock */ lockarea(scratchfile, 0, 1, F_WRLCK, TRUE); lseek(scratchfile, 0, SEEK_SET); while(read(scratchfile, &d, sizeof(SCRFILEREC)) == sizeof(SCRFILEREC)) { if (lockarea(scratchfile, 10 + pos, 1, F_WRLCK, FALSE)) { /* if no allocated thid yet, assign it, otherwise unlock free area */ if (thid == -1) thid = pos; else lockarea(scratchfile, 10 + pos, 1, F_UNLCK, TRUE); } else { if (d.ip == ip) ipcount++; scount++; } pos++; } if (thid == -1) { thid = pos; lockarea(scratchfile, 10 + pos, 1, F_WRLCK, TRUE); } if (scount >= slimit) { *error = HOSTFULL; full = TRUE; } if ((iplimit > 0) && (ipcount >= iplimit)) { *error = IPHOSTFULL; full = TRUE; } if (full) { lockarea(scratchfile, 10 + pos, 1, F_UNLCK, TRUE); lockarea(scratchfile, 0, 1, F_UNLCK, TRUE); return(-1); } /* need to add data to file */ memset(&d, 0, sizeof(SCRFILEREC)); strcpy(d.username, ""); strcpy(d.groupname, "none"); strncpy(d.vserver, "none", MAXSECTIONLEN); /* null terminate d.vserver */ d.vserver[MAXSECTIONLEN-1] = 0; strcpy(d.currentop, "none"); strcpy(d.remotehost, "unknown"); d.pid = (int)getpid(); d.ip = ip; writescratch(thid * sizeof(SCRFILEREC), sizeof(SCRFILEREC), (char *)&d); lockarea(scratchfile, 0, 1, F_UNLCK, TRUE); return(thid); } void shinfo_changeop(char *operation) { write_procstr(thid, MAXNAMELEN, SCRF_CURRENTOP, DESCRIPLEN, operation); } void shinfo_changeuser(char *username) { write_procstr(thid, 0, 0, MAXNAMELEN, username); } void shinfo_sethost(char *hostname) { write_procstr(thid, MAXNAMELEN + DESCRIPLEN, SCRF_REMOTEHOST, MAXNAMELEN, hostname); } int shinfo_addusergroup(char *groupname, int limit) { int count = 0; int pos = 0; int done = FALSE; SHRMEMDATA *d; SCRFILEREC da; if (inetd) { /* must find count of users in group */ lockarea(scratchfile, 0, 1, F_WRLCK, TRUE); pos = 0; lseek(scratchfile, 0, SEEK_SET); while(read(scratchfile, &da, sizeof(SCRFILEREC)) == sizeof(SCRFILEREC)) { if (pos != thid) { if (!lockarea(scratchfile, 10 + pos, 1, F_WRLCK, FALSE)) { if (strncmp(da.groupname, groupname, MAXSECTIONLEN) == 0) count++; } else lockarea(scratchfile, 10 + pos, 1, F_UNLCK, TRUE); } pos++; } done = (count < limit); if (done) { /* update scratchfile */ write_procstr(thid, 0, SCRF_GROUPNAME, MAXSECTIONLEN, groupname); count++; } lockarea(scratchfile, 0, 1, F_UNLCK, TRUE); } else { /* non-inetd stuff */ lockarea(shlockfile, 0, 1, F_WRLCK, TRUE); lockarea(shlockfile, 2, 1, F_WRLCK, TRUE); d = SHRMEMDATPOS(shdata, shdata->numvserver); /* find the group in the list */ while((pos < shdata->numgroups) && (!done)) { if (strncmp(groupname, d->name, MAXSECTIONLEN) == 0) if (d->count < d->max) { /* found it all */ d->count++; count = d->count; done = TRUE; } pos++; d++; } if (done) { lockarea(shlockfile, 10 + thid, 1, F_WRLCK, TRUE); if (procdata[thid].group != -1) ERRORMSG("ack, inconsistency found!"); procdata[thid].group = pos - 1; lockarea(shlockfile, 10 + thid, 1, F_UNLCK, TRUE); } lockarea(shlockfile, 2, 1, F_UNLCK, TRUE); lockarea(shlockfile, 0, 1, F_UNLCK, TRUE); } if (done) return(count); else return(-1); } void shinfo_setpid(int thrid, int pid) { if (!inetd) procdata[thrid].pid = pid; else writescratch(thrid * sizeof(SCRFILEREC) + SCRF_PID, sizeof(int), (char *)&pid); } void shinfo_delusergroup(char *groupname) { int pos = 0; int done = FALSE; SHRMEMDATA *d; if (!inetd) { lockarea(shlockfile, 0, 1, F_WRLCK, TRUE); lockarea(shlockfile, 2, 1, F_WRLCK, TRUE); d = SHRMEMDATPOS(shdata, shdata->numvserver); while((pos < shdata->numgroups) && (!done)) { if (strncmp(groupname, d->name, MAXSECTIONLEN) == 0) { /* found it all */ d->count--; done = TRUE; } pos++; d++; } lockarea(shlockfile, 10 + thid, 1, F_WRLCK, TRUE); procdata[thid].group = -1; lockarea(shlockfile, 10 + thid, 1, F_UNLCK, TRUE); lockarea(shlockfile, 2, 1, F_UNLCK, TRUE); lockarea(shlockfile, 0, 1, F_UNLCK, TRUE); } else /* update scratchfile */ writescratch(thid * sizeof(SCRFILEREC) + SCRF_GROUPNAME, 5, "none"); } void shinfo_freebynum(int threadnum) { SHRMEMDATA *d; /* free and update pointers */ lockarea(shlockfile, 0, 3, F_WRLCK, TRUE); lockarea(shlockfile, 10 + threadnum, 1, F_WRLCK, TRUE); if (procdata[threadnum].group >= 0) { d = SHRMEMDATPOS(shdata, shdata->numvserver + procdata[threadnum].group); d->count--; } shdata->serverusercount--; if ((shdata->numvserver > 0) && (procdata[threadnum].vserver >= 0)) { d = SHRMEMDATPOS(shdata, procdata[threadnum].vserver); d->count--; } procdata[threadnum].group = -1; procdata[threadnum].vserver = -1; procdata[threadnum].pid = -nextthid; procdata[threadnum].ip = -1; nextthid = threadnum; lockarea(shlockfile, threadnum + 10, 1, F_UNLCK, TRUE); lockarea(shlockfile, 0, 3, F_UNLCK, TRUE); } void shinfo_freethreads(int freecount, pid_t *freelist) { int count = 0; int listcount; /* sort the freelist */ for(listcount = 0; listcount < freecount; listcount++) { count = 0; while(count < shdata->numrecs) { /* pid is safe since parent process is the only modifier */ if (procdata[count].pid == freelist[listcount]) shinfo_freebynum(count); count++; } } } void pnums_signalchildren(int signalnum) { int count; for (count = 0; count < shdata->numrecs; count++) if (procdata[count].pid > 0) kill((pid_t)procdata[count].pid, signalnum); } void shinfo_shutdown(void) { if (!inetd) { /* kill the children kindly */ pnums_signalchildren(SIGTERM); shmem_finish(shnumber); close(shlockfile); } else close(scratchfile); } muddleftpd-1.3.13.1/src/proxy.c0100644000175000017500000002551707737077257015240 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" #include "ftpcmd.h" #include "reply.h" typedef struct overload_info { int pos; char *msg; int len; } OVERLOAD_INFO; extern FTPCMD mainftpcmd[]; extern pid_t *deadlist; int controlportgotdata(SELECTER *sel, int fd, void *peerdata) { FTPSTATE *peer = (FTPSTATE *)peerdata; char *instring = NULL; int connclosed = readcmd(peer); int exits = FALSE; INPUTLINE cmd; if (connclosed) return(TRUE); else { if (popcmd(peer, &instring)) { ftp_write(peer, FALSE, 500, REPLY_ONECMDONLY); return(TRUE); } if (instring) /* we have a command */ { cmd_split(peer, &cmd, instring, mainftpcmd, TRUE, (peer->loggedin ? peer->cmddisableset : NULL)); if (!peer->dport) if (cmd.command->ftpfunc != ftp_pass) shinfo_changeop(instring); exits = ftp_run(peer, &cmd, "FTP"); freeifnotnull(cmd.parameters); if (!peer->dport) shinfo_changeop("idle"); string_clear(&(peer->inbuffer)); } return(exits); } } char *remove_rootcomponent(FTPSTATE *peer, char *filename, char *descript) { int baselen = strlen(peer->basedir); pathname_simplify(filename); if (strncmp(peer->basedir, filename, baselen) == 0) memmove(filename, filename + baselen, strlen(filename) - baselen + 1); else { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("%s(%s) is outside of rootdir(%s) with chroot enabled!", descript, filename, peer->basedir)); freewrapper(filename); return(NULL); } return(filename); } void dochroot(FTPSTATE *peer) { /* this prevents bugs in resolving filenames */ if (strcmp(peer->basedir, "/") == 0) { peer->chroot = FALSE; return; } if (config->rootmode) { int res = chroot(peer->basedir); if (res == 0) { /* put ourselves into the tree */ chdir("/"); /* once chroot is done, nothing can undo it, so user cannot relogin */ peer->jailenabled = TRUE; /* now change dumped file names */ pathname_simplify(peer->basedir); if (peer->logindump) peer->logindump = remove_rootcomponent(peer, peer->logindump, "welcome"); if (peer->quitdump) peer->quitdump = remove_rootcomponent(peer, peer->quitdump, "quitdump"); if (peer->cwddump) if ((peer->cwddump)[0] == '/') peer->cwddump = remove_rootcomponent(peer, peer->cwddump, "cddump"); freewrapper(peer->basedir); peer->basedir = strdupwrapper("/"); } else log_giveentry(MYLOG_INFO, NULL, safe_snprintf("chroot('%s') gave error %s", peer->basedir, strerror(errno))); } else log_addentry(MYLOG_INFO, NULL, "Cannot use chroot() without root permission."); } void rotatelogs(FTPSTATE *peer) { char *logfile; int newlogcontext; if (peer->vserver->logfile) logfile = peer->vserver->logfile; else logfile = config->defaults->logfile; if ((!peer->chroot) || (!peer->droproot)) { /* use root to open log */ file_becomeroot(peer); newlogcontext = log_initcontext(logfile); file_becomeuser(peer); if (newlogcontext == -1) log_giveentry(MYLOG_INFO, NULL, safe_snprintf("Could not open log file '%s', reopen failed", peer->vserver->logfile)); else { log_shutdown(); config->logout = newlogcontext; log_setcontext(config->logout, peer->vserver->loglevel); } } else log_addentry(MYLOG_INFO, NULL, "Cannot reopen log file in chroot or droproot mode"); } int vserver_select(FTPSTATE *peer, VSERVER *vserver) { int error, result; int newlogcontext; peer->vserver = vserver; /* initalize the new log context */ newlogcontext = config->logout; if (vserver->logfile) if (strcmp(config->defaults->logfile, vserver->logfile) != 0) { newlogcontext = log_initcontext(vserver->logfile); if (newlogcontext == -1) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("Dropping connection, error opening virtual server logfile '%s': %s", vserver->logfile, strerror(errno))); return(1); } log_shutdown(); config->logout = newlogcontext; } log_setcontext(config->logout, vserver->loglevel); /* see if the user is allowed in this vserver */ if (!user_allowed(vserver->ipaccess, peer->remoteip, peer->hostname)) { log_addentry(MYLOG_DACCESS, peer, NULL); return(2); } /* set the procdata up */ result = shinfo_setvserver(peer->threadnum, vserver->sectionname, peer->remoteip, vserver->maxusers, vserver->maxperip, &error); if (!result) { logfullmessage(error, peer->remoteip); return(3); } return(0); } void ftpserverside_main(int remotefd, int remoteip, int threadnum, int portnum, VSERVER *vserver) { int newlogcontext, exits = FALSE; int flag = 1; struct rlimit mylimits = { MAXMEMUSAGE, MAXMEMUSAGE }; FTPSTATE *peer = mallocwrapper(sizeof(FTPSTATE)); char *greetline; ftpstate_init(peer, remotefd, remoteip, threadnum, portnum, vserver); /* initalize ftp state data struture */ shinfo_sethost(peer->hostname); if (!user_allowed(config->defaults->ipaccess, remoteip, peer->hostname)) { log_addentry(MYLOG_DACCESS, peer, NULL); close(remotefd); return; } newlogcontext = config->logout; if (vserver->logfile) if (strcmp(config->defaults->logfile, vserver->logfile) != 0) { newlogcontext = log_initcontext(vserver->logfile); if (newlogcontext == -1) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("Dropping connection, error opening virtual server logfile '%s': %s", vserver->logfile, strerror(errno))); close(remotefd); return; } log_shutdown(); config->logout = newlogcontext; } log_setcontext(config->logout, vserver->loglevel); setrlimit(RLIMIT_DATA, &mylimits); peer->vserver = vserver; /* see if user is allowed to enter */ if (!user_allowed(vserver->ipaccess, remoteip, peer->hostname)) { log_addentry(MYLOG_DACCESS, peer, NULL); close(remotefd); return; } peer->sel = select_new(); setsockopt(peer->remotefd, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(int)); /* add the remote fd for reading */ select_addfd(peer->sel, remotefd); select_addread(peer->sel, remotefd, controlportgotdata, (void *)peer); /* output our greeting */ shinfo_changeop("idle"); if (vserver->greetline) greetline = vserver->greetline; else greetline = REPLY_GREET; if (vserver->prelogindumpdata) exits = ftp_dumpstr(peer, vserver->prelogindumpdata, 220, greetline, TRUE); else exits = ftp_dumper(peer, nfopen(vserver->prelogindump), 220, greetline, TRUE, TRUE); while(!exits) { int fd, signalnum; fd = select_do(peer->sel, &signalnum, peer->timeout); /* if we get 3 back, simply loop and update timeout */ if (fd == -1) { if ((signalnum == SIGTERM) || (signalnum == SIGHUP)) { /* server is shutting down! */ ftp_write(peer, FALSE, 421, REPLY_SERVERSHUTDOWN); exits = TRUE; } else if (signalnum == SIGUSR1) { rotatelogs(peer); } else if (signalnum == 0) exits = TRUE; } else if (fd == 0) { /* timeout has occurred */ ftp_write(peer, FALSE, 421, REPLY_TIMEOUT(peer->timeout)); exits = TRUE; } else if (fd != 3) exits = TRUE; } log_addentry(MYLOG_LOGIN, peer, "User logged out."); if (peer->acldata) acllist_dest(peer->acldata); select_shutdown(peer->sel); ftpstate_dest(peer); } int inport_bind(int portid, unsigned int bindip, int dodie) { int incon; if ((portid < 1024) && (getuid() != 0)) { char *error = safe_snprintf("root access required to bind port %d (less than 1024), skipping", portid); if (dodie) ERRORMSGFATAL(error); else log_giveentry(MYLOG_INFO, NULL, error); return(-1); } incon = listenport(portid, bindip, MAXPENDCONN); if (incon == -1) { char *error = safe_snprintf("Cannot bind to port %d, ip %s, skipping!", portid, getipstr(bindip)); if (dodie) ERRORMSGFATAL(error); else log_giveentry(MYLOG_INFO, NULL, error); } return(incon); } int overload_sendmessage(SELECTER *mainsel, int fd, void *in) { OVERLOAD_INFO *i = (OVERLOAD_INFO *)in; int c; c = write(fd, i->msg + i->pos, i->len); i->len -= c; i->pos += c; if ((c <= 0) || (i->len <= 0)) { freewrapper(i); return(2); } return(FALSE); } int inport_getconn(SELECTER *mainsel, int fd, void *vs) { int newconn; unsigned int ipaddress, lip; VSERVER *vserver; int tnum, port, error, result; pid_t fresult; newconn = get_conn(fd, &ipaddress); if (newconn == -1) { log_giveentry(MYLOG_INFO, NULL, safe_snprintf("Error accepting control connection: %s", strerror(errno))); return(FALSE); } if (config->hostvservers) { getsockinfo(newconn, &lip, &port); vserver = config->defaults; } else if (vs != NULL) { vserver = ((VSERVERCONN *)vs)->vptr; port = ((VSERVERCONN *)vs)->port; } else { getsockinfo(newconn, &lip, &port); vserver = findvserver(lip, port); } /* was not able to find a vserver for the port/ip they connected to */ if (vserver == NULL) { close(newconn); return(FALSE); } result = TRUE; tnum = shinfo_newuser_standalone(ipaddress, config->defaults->maxperip, &error); if ((tnum != -1) && (config->vservers) && (!config->hostvservers)) result = shinfo_setvserver(tnum, vserver->sectionname, ipaddress, vserver->maxusers, vserver->maxperip, &error); if ((tnum != -1) && (result)) { fresult = fork(); if ((int)fresult == 0) { shinfo_setpid(tnum, (int)getpid()); select_shutdown(mainsel); freewrapper(deadlist); ftpserverside_main(newconn, ipaddress, tnum, port, vserver); ftpd_killconfig(config); kill_uidgidfiles(); log_shutdown(); exit(0); } else if ((int)fresult == -1) { shinfo_freebynum(tnum); log_addentry(MYLOG_INFO, NULL, "Could not fork, dropping connection."); ERRORMSG("Could not fork, dropping connection!"); close(newconn); } else { close(newconn); } } else { /* server is full, or too many connections */ if (tnum != -1) shinfo_freebynum(tnum); logfullmessage(error, ipaddress); if (config->toobusycount <= MAXTOOMANYUSERS) { OVERLOAD_INFO *i = mallocwrapper(sizeof(OVERLOAD_INFO)); i->msg = vserver->toobusy; if (i->msg == NULL) i->msg = REPLY_SERVERBUSY; i->pos = 0; i->len = strlen(i->msg); fcntl(newconn, F_SETFL, O_NONBLOCK); select_addfd(mainsel, newconn); select_addwrite(mainsel, newconn, overload_sendmessage, i); } else close(newconn); } return(FALSE); } muddleftpd-1.3.13.1/src/ratio.c0100644000175000017500000001622507737077257015171 0ustar joergjoerg/* ratio.c Basic ratio implementation for muddleftpd Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" #include "reply.h" extern int doesdint; int lockarea(int fd, int pos, int len, int locktype, int do_wait) { struct flock lock; register int err; int lockt; lockt = (do_wait == TRUE ? F_SETLKW : F_SETLK); lock.l_type = locktype; lock.l_whence = SEEK_SET; lock.l_start = pos; lock.l_len = len; NOSIGNALINTR(err = fcntl(fd, lockt, &lock)); if (err == -1) { if (errno != EAGAIN) ERRORMSGFATAL(safe_snprintf("Locking failed: %s", strerror(errno))); else return(FALSE); } return(TRUE); } void lock_n_read(RATIOHANDLE *rh) { if (rh->ratiofilefd != 0) { lockarea(rh->ratiofilefd, rh->filepos, sizeof(RATIOFILEDATA), F_WRLCK, TRUE); lseek(rh->ratiofilefd, rh->filepos, SEEK_SET); read(rh->ratiofilefd, rh->rdat, sizeof(RATIOFILEDATA)); } } void write_n_unlock(RATIOHANDLE *rh) { if (rh->ratiofilefd != 0) { lseek(rh->ratiofilefd, rh->filepos, SEEK_SET); write(rh->ratiofilefd, rh->rdat, sizeof(RATIOFILEDATA)); lockarea(rh->ratiofilefd, rh->filepos, sizeof(RATIOFILEDATA), F_UNLCK, TRUE); } } int openratiofile(char *filename) { int fd; if (filename == NULL) return(-1); fd = open(filename, O_CREAT | O_RDWR, 0600); if (fd == -1) { char *err = safe_snprintf("Error opening ratio file '%s': %s", filename, strerror(errno)); log_addentry(MYLOG_INFO, NULL, err); freewrapper(err); } return(fd); } int decoderatiostr(char *ratstr, int *pa, int *pb) { if (ratstr == NULL) return(FALSE); strtrimspace(ratstr); return(sscanf(ratstr, "%d:%d", pa, pb) == 2); } /* this function really is too complex and too long, fix later */ RATIOHANDLE *ratio_loaduser(char *username, int section) { RATIOHANDLE *newrh = mallocwrapper(sizeof(RATIOHANDLE)); RATIOFILEDATA *filedata = mallocwrapper(sizeof(RATIOFILEDATA)); char *data, *defint, *byteratio, *fileratio; int pos = 0; long long defaultdownload; int upbytes, downbytes, upfiles, downfiles, initfiles; int flags = 0; if (!doesdint) goto error; /* load the config */ loadstrfromconfig(config->configfile, section, "ratiofile", &data, NULL); loadstrfromconfig(config->configfile, section, "byteratios", &byteratio, NULL); loadstrfromconfig(config->configfile, section, "fileratios", &fileratio, NULL); if (fileratio) { if (!decoderatiostr(fileratio, &upfiles, &downfiles)) goto error; flags |= FILECREDITS; loadintfromconfig(config->configfile, section, "initalfiles", &initfiles, 0); initfiles *= downfiles; } if (byteratio) { if (!decoderatiostr(byteratio, &upbytes, &downbytes)) goto error; flags |= BYTECREDITS; loadstrfromconfig(config->configfile, section, "initalbytes", &defint, "0"); sscanf(defint, "%lld", &defaultdownload); defaultdownload *= downbytes; } newrh->rdat = filedata; newrh->ratiofilefd = 0; /* this is for non-persistant ratios */ if (!data) goto newrecord; newrh->ratiofilefd = openratiofile(data); if (newrh->ratiofilefd == -1) goto error; lockarea(newrh->ratiofilefd, pos, sizeof(RATIOFILEDATA), F_WRLCK, TRUE); while(read(newrh->ratiofilefd, filedata, sizeof(RATIOFILEDATA)) == sizeof(RATIOFILEDATA)) { lockarea(newrh->ratiofilefd, pos, sizeof(RATIOFILEDATA), F_UNLCK, TRUE); if (strcmp(filedata->username, username) == 0) { newrh->filepos = pos; return(newrh); } pos += sizeof(RATIOFILEDATA); lockarea(newrh->ratiofilefd, pos, sizeof(RATIOFILEDATA), F_WRLCK, TRUE); } newrecord: /* we need to create a record, the area we want is already locked */ /* if the area gets written to disk, make sure it is clear so we don't accidently write a clear password to disk that may have been in the memory! */ memset(filedata, 0, sizeof(RATIOFILEDATA)); strncpy(filedata->username, username, MAXNAMELEN); filedata->username[MAXNAMELEN] = 0; filedata->flags = flags; if (flags & FILECREDITS) { filedata->filecredits = initfiles; filedata->fileinmult = (short int)upfiles; filedata->fileoutmult = (short int)downfiles; } if (flags & BYTECREDITS) { filedata->downloadcredits = defaultdownload; filedata->byteinmult = (short int)upbytes; filedata->byteoutmult = (short int)downbytes; } newrh->filepos = pos; write_n_unlock(newrh); return(newrh); error: freewrapper(newrh); freewrapper(filedata); return(NULL); } /* This looks expensive!, but isn't really too bad because of kernel writeback cache. */ void ratio_uploadbytes(RATIOHANDLE *rh, int bytes) { lock_n_read(rh); if (rh->rdat->flags & BYTECREDITS) rh->rdat->downloadcredits += bytes * rh->rdat->byteinmult; write_n_unlock(rh); } int ratio_downloadbytes(RATIOHANDLE *rh, int bytes) { int ret = FALSE; lock_n_read(rh); if (rh->rdat->flags & BYTECREDITS) { ret = ((rh->rdat->downloadcredits - (bytes * rh->rdat->byteoutmult)) < 0LL); if (!ret) rh->rdat->downloadcredits -= bytes * rh->rdat->byteoutmult; } write_n_unlock(rh); return(ret); } void ratio_uploadfile(RATIOHANDLE *rh) { lock_n_read(rh); if (rh->rdat->flags & FILECREDITS) rh->rdat->filecredits += rh->rdat->fileinmult; write_n_unlock(rh); } int ratio_downloadfile(RATIOHANDLE *rh) { int ret = FALSE; lock_n_read(rh); if (rh->rdat->flags & FILECREDITS) { ret = (rh->rdat->fileoutmult > rh->rdat->filecredits); if (!ret) rh->rdat->filecredits -= rh->rdat->fileoutmult; } write_n_unlock(rh); return(ret); } void ratio_reread(RATIOHANDLE *rh) { lock_n_read(rh); write_n_unlock(rh); } void ratio_stat(FTPSTATE *peer, RATIOHANDLE *rh, char *replystr) { ratio_reread(rh); if (rh->rdat->flags & BYTECREDITS) { ftp_write(peer, TRUE, 0, REPLY_RATIOBYTECREDITS(replystr, rh->rdat->downloadcredits / rh->rdat->byteoutmult)); ftp_write(peer, TRUE, 0, REPLY_RATIOBYTERATIO(replystr, rh->rdat->byteoutmult, rh->rdat->byteinmult)); } if (rh->rdat->flags & FILECREDITS) { ftp_write(peer, TRUE, 0, REPLY_RATIOFILECREDITS(replystr, rh->rdat->filecredits / rh->rdat->fileoutmult)); ftp_write(peer, TRUE, 0, REPLY_RATIOFILERATIO(replystr, rh->rdat->fileoutmult, rh->rdat->fileinmult)); } } void ratio_settokens(RATIOHANDLE *rh, TOKENSET *ts) { ratio_reread(rh); if (rh->rdat->flags & BYTECREDITS) tokenset_settoken(ts, 'a', safe_snprintf("%lld", rh->rdat->downloadcredits / rh->rdat->byteoutmult)); if (rh->rdat->flags & FILECREDITS) tokenset_settoken(ts, 'A', safe_snprintf("%d", rh->rdat->filecredits / rh->rdat->fileoutmult)); } void ratio_finish(RATIOHANDLE *rh) { freewrapper(rh->rdat); if (rh->ratiofilefd != 0) close(rh->ratiofilefd); freewrapper(rh); } muddleftpd-1.3.13.1/src/ratio.h0100644000175000017500000000055007737077257015170 0ustar joergjoerg #define FILECREDITS 1 #define BYTECREDITS 2 typedef struct { char username[MAXNAMELEN+1]; long long int downloadcredits; int filecredits; short int flags; short int byteinmult; short int byteoutmult; short int fileinmult; short int fileoutmult; } RATIOFILEDATA; typedef struct { int ratiofilefd; RATIOFILEDATA *rdat; int filepos; } RATIOHANDLE; muddleftpd-1.3.13.1/src/ratiotool.c0100644000175000017500000003155207737077257016067 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper this is a quick hack for ratiotool, works ok but that is all warning, this code is not buffer overflow safe. DONT RUN AS SETUID ROOT This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" #define BYTERATIOMSK 1 #define FILERATIOMSK 2 #define BYTECREDITMSK 4 #define FILECREDITMSK 8 #define RELATIVE TRUE #define ABSOLUTE FALSE int lockarea(int fd, int pos, int len, int locktype, int do_wait) { struct flock lock; register int err; int lockt; lockt = (do_wait == TRUE ? F_SETLKW : F_SETLK); lock.l_type = locktype; lock.l_whence = SEEK_SET; lock.l_start = pos; lock.l_len = len; NOSIGNALINTR(err = fcntl(fd, lockt, &lock)); if (err == -1) { if (errno != EAGAIN) exit(0); else return(FALSE); } return(TRUE); } void lock_n_read(RATIOHANDLE *rh) { if (rh->ratiofilefd != 0) { lockarea(rh->ratiofilefd, rh->filepos, sizeof(RATIOFILEDATA), F_WRLCK, TRUE); lseek(rh->ratiofilefd, rh->filepos, SEEK_SET); read(rh->ratiofilefd, rh->rdat, sizeof(RATIOFILEDATA)); } } void write_n_unlock(RATIOHANDLE *rh) { if (rh->ratiofilefd != 0) { lseek(rh->ratiofilefd, rh->filepos, SEEK_SET); write(rh->ratiofilefd, rh->rdat, sizeof(RATIOFILEDATA)); lockarea(rh->ratiofilefd, rh->filepos, sizeof(RATIOFILEDATA), F_UNLCK, TRUE); } } int decoderatiostr(char *ratstr, int *pa, int *pb) { return(sscanf(ratstr, "%d:%d", pa, pb) == 2); } RATIOHANDLE *getuserrh(char *filename, char *username) { static RATIOHANDLE rh; static RATIOFILEDATA filedata; int pos = 0; rh.rdat = &filedata; rh.ratiofilefd = open(filename, O_RDWR); if (rh.ratiofilefd == -1) ERRORMSGFATAL("couldn't open ratio file!"); lockarea(rh.ratiofilefd, pos, sizeof(RATIOFILEDATA), F_WRLCK, TRUE); while(read(rh.ratiofilefd, &filedata, sizeof(RATIOFILEDATA)) == sizeof(RATIOFILEDATA)) { lockarea(rh.ratiofilefd, pos, sizeof(RATIOFILEDATA), F_UNLCK, TRUE); if (strcmp(filedata.username, username) == 0) { rh.filepos = pos; return(&rh); } pos += sizeof(RATIOFILEDATA); lockarea(rh.ratiofilefd, pos, sizeof(RATIOFILEDATA), F_WRLCK, TRUE); } close(rh.ratiofilefd); return(NULL); } /* this just returns a pointer to the end of the file, and checks to make user the user doesn't exist yet */ RATIOHANDLE *adduserrh(char *filename, char *username) { static RATIOHANDLE rh; static RATIOFILEDATA filedata; int pos = 0; rh.rdat = &filedata; rh.ratiofilefd = open(filename, O_RDWR | O_CREAT, 0600); if (rh.ratiofilefd == -1) ERRORMSGFATAL("couldn't open ratio file!"); lockarea(rh.ratiofilefd, pos, sizeof(RATIOFILEDATA), F_WRLCK, TRUE); while(read(rh.ratiofilefd, &filedata, sizeof(RATIOFILEDATA)) == sizeof(RATIOFILEDATA)) { lockarea(rh.ratiofilefd, pos, sizeof(RATIOFILEDATA), F_UNLCK, TRUE); if (strcmp(filedata.username, username) == 0) { close(rh.ratiofilefd); return(NULL); } pos += sizeof(RATIOFILEDATA); lockarea(rh.ratiofilefd, pos, sizeof(RATIOFILEDATA), F_WRLCK, TRUE); } rh.filepos = pos; return(&rh); } void usage(void) { printf("\nMuddleftpd Ratio File Editor.\n\n"); printf("Usage: ratiotool [options]\n\n"); printf(" -f ratiofile The filename of the ratio file to modify\n"); printf(" -a username Adds a new username\n"); printf(" -e username Edits the properties of a username\n"); printf(" -d username Scrubs the username from the ratio file\n"); printf(" -r fileratio Sets a new file ratio for the user.\n"); printf(" -R byteratio Sets a new byte ratio for the user.\n"); printf(" -c files Sets a new file credit for the user.\n"); printf(" -C bytes Sets a new byte credit for the user.\n"); printf(" -i username Gets information about user.\n"); printf(" -h Displays this usage message.\n"); printf(" -V Displays version information.\n\n"); printf("You must specify -f and only one of -a, -e, -d or -i when running ratiotool\n\n"); exit(0); } void showinfo(RATIOHANDLE *rh) { printf("Showing ratio information for user '%s'\n", rh->rdat->username); printf("\nThis user has the following download credits:\n\n"); if (rh->rdat->flags & BYTECREDITS) printf("%15lld bytes\n", rh->rdat->downloadcredits / rh->rdat->byteoutmult); if (rh->rdat->flags & FILECREDITS) printf("%15d files\n", rh->rdat->filecredits / rh->rdat->fileoutmult); if (rh->rdat->flags == 0) printf("This person does not use ratios and has no credits\n"); printf("\nThis user is subject to the following ratios:\n\n"); if (rh->rdat->flags & BYTECREDITS) printf("Byte ratio: %d:%d (ie %d bytes uploaded = %d download bytes)\n", rh->rdat->byteinmult, rh->rdat->byteoutmult, rh->rdat->byteoutmult, rh->rdat->byteinmult); if (rh->rdat->flags & FILECREDITS) printf("File ratio: %d:%d (ie %d files uploaded = %d download files)\n", rh->rdat->fileinmult, rh->rdat->fileoutmult, rh->rdat->fileoutmult, rh->rdat->fileinmult); if (rh->rdat->flags == 0) printf("This person does not use ratios.\n"); printf("\n\n"); } void adduser(char *rationame, char *username, char *byteratio, char *fileratio, char *filecount, char *bytecount) { int flags = 0; int upb, downb, upf, downf; int initalf; long long int initalb; RATIOHANDLE *rh; if (byteratio == NULL) { byteratio = (char *)malloc(4096); printf("Enter a byte ratio for the user (down:up or 'none') : "); fgets(byteratio, 4096, stdin); byteratio[strlen(byteratio) - 1] = 0; } if (fileratio == NULL) { fileratio = (char *)malloc(4096); printf("Enter a file ratio for the user (down:up or 'none') : "); fgets(fileratio, 4096, stdin); fileratio[strlen(fileratio) - 1] = 0; } if (strcasecmp(byteratio, "none") != 0) flags |= BYTECREDITS; if (strcasecmp(fileratio, "none") != 0) flags |= FILECREDITS; if (flags & BYTECREDITS) { if (bytecount == NULL) { bytecount = (char *)malloc(4096); printf("Enter an inital byte credit for the user (bytes) : "); fgets(bytecount, 4096, stdin); bytecount[strlen(bytecount) - 1] = 0; } if (sscanf(byteratio, "%d:%d", &upb, &downb) != 2) ERRORMSGFATAL("could not decode byte ratio"); if (sscanf(bytecount, "%lld", &initalb) != 1) ERRORMSGFATAL("could not decode inital byte credits"); initalb *= downb; } if (flags & FILECREDITS) { if (filecount == NULL) { filecount = (char *)malloc(4096); printf("Enter a inital file credit for the user : "); fgets(filecount, 4096, stdin); filecount[strlen(filecount) - 1] = 0; } if (sscanf(fileratio, "%d:%d", &upf, &downf) != 2) ERRORMSGFATAL("could not decode file ratio"); printf("%d\n", sscanf(filecount, "%d", &initalf)); if (sscanf(filecount, "%d", &initalf) != 1) ERRORMSGFATAL("could not decode inital file credits"); initalf *= downf; } rh = adduserrh(rationame, username); if (rh == NULL) ERRORMSGFATAL("user by that name already exists in the ratio file"); lock_n_read(rh); memset(rh->rdat, 0, sizeof(RATIOFILEDATA)); strncpy(rh->rdat->username, username, MAXNAMELEN); rh->rdat->flags = flags; if (flags & FILECREDITS) { rh->rdat->filecredits = initalf; rh->rdat->fileinmult = (short int)upf; rh->rdat->fileoutmult = (short int)downf; } if (flags & BYTECREDITS) { rh->rdat->downloadcredits = initalb; rh->rdat->byteinmult = (short int)upb; rh->rdat->byteoutmult = (short int)downb; } write_n_unlock(rh); close(rh->ratiofilefd); printf("Adding user to ratio file successful!\n"); } void edituser(char *rationame, char *username, char *byteratio, char *fileratio, char *filecount, char *bytecount, int edit_mask) { int upb, downb, upf, downf; int initalf; int modf = 0; int modb = 0; long long int initalb; RATIOHANDLE *rh; #define BYTERATIOMSK 1 #define FILERATIOMSK 2 #define BYTECREDITMSK 4 #define FILECREDITMSK 8 /* decode arguments */ if (edit_mask & BYTERATIOMSK) if (strcasecmp(byteratio, "none") != 0) if (sscanf(byteratio, "%d:%d", &upb, &downb) != 2) ERRORMSGFATAL("could not decode byte ratio"); if (edit_mask & BYTECREDITMSK) { if (bytecount[0] == 'r') { bytecount++; modb = RELATIVE; } else modb = ABSOLUTE; if (sscanf(bytecount, "%lld", &initalb) != 1) ERRORMSGFATAL("could not decode byte credits"); } if (edit_mask & FILERATIOMSK) if (strcasecmp(fileratio, "none") != 0) if (sscanf(fileratio, "%d:%d", &upf, &downf) != 2) ERRORMSGFATAL("could not decode file ratio"); if (edit_mask & FILECREDITMSK) { if (filecount[0] == 'r') { modf = RELATIVE; filecount++; } else modf = ABSOLUTE; if (sscanf(filecount, "%d", &initalf) != 1) ERRORMSGFATAL("could not decode file credits"); } rh = getuserrh(rationame, username); if (rh == NULL) ERRORMSGFATAL("Username is not in ratio file."); lock_n_read(rh); if (edit_mask & BYTERATIOMSK) { if (strcasecmp(byteratio, "none") == 0) rh->rdat->flags &= FILECREDITS; else { /* this updates the ratio and the credits */ rh->rdat->flags |= BYTECREDITS; rh->rdat->downloadcredits /= rh->rdat->byteoutmult; rh->rdat->byteinmult = (short int)upb; rh->rdat->byteoutmult = (short int)downb; rh->rdat->downloadcredits *= rh->rdat->byteoutmult; } } if (edit_mask & FILERATIOMSK) { if (strcasecmp(fileratio, "none") == 0) rh->rdat->flags &= BYTECREDITS; else { /* this updates the ratio and the credits */ rh->rdat->flags |= FILECREDITS; rh->rdat->filecredits /= rh->rdat->fileoutmult; rh->rdat->fileinmult = (short int)upf; rh->rdat->fileoutmult = (short int)downf; rh->rdat->filecredits *= rh->rdat->fileoutmult; } } if (edit_mask & BYTECREDITMSK) { if (modb == ABSOLUTE) rh->rdat->downloadcredits = initalb * rh->rdat->byteoutmult; else rh->rdat->downloadcredits += initalb * rh->rdat->byteoutmult; } if (edit_mask & FILECREDITMSK) { if (modf == ABSOLUTE) rh->rdat->filecredits = initalf * rh->rdat->fileoutmult; else rh->rdat->filecredits += initalf * rh->rdat->fileoutmult; } write_n_unlock(rh); close(rh->ratiofilefd); printf("Editing user in ratio file successful!\n"); } void deluser(char *ratiofile, char *username) { RATIOHANDLE *rh; rh = getuserrh(ratiofile, username); if (rh == NULL) ERRORMSGFATAL("Username is not in ratio file!"); lock_n_read(rh); rh->rdat->username[0] = 0; write_n_unlock(rh); close(rh->ratiofilefd); printf("Deleting user from ratio file successful!\n"); } int main(int argc, char **argv) { int ch; char *ratiofile = NULL; char *username = NULL; char *byteratio = NULL; char *fileratio = NULL; char *bytecount = NULL; char *filecount = NULL; int add_user = FALSE; int delete_user = FALSE; int edit_user = FALSE; int get_info = FALSE; int edit_mask = FALSE; extern char *optarg; /* stolen from smbpasswd - checking for setuid root! */ /* Check the effective uid - make sure we are not setuid */ if ((geteuid() == (uid_t)0) && (getuid() != (uid_t)0)) ERRORMSGFATAL("ratiotool must *NOT* be setuid root.\n"); while ((ch = getopt(argc, argv, "f:a:d:e:r:R:c:C:i:hV")) != EOF) { switch(ch) { case 'V': showversion("ratiotool"); case 'f': ratiofile = optarg; break; case 'a': add_user = TRUE; username = optarg; break; case 'd': delete_user = TRUE; username = optarg; break; case 'e': edit_user = TRUE; username = optarg; break; case 'r': fileratio = optarg; edit_mask |= FILERATIOMSK; break; case 'R': byteratio = optarg; edit_mask |= BYTERATIOMSK; break; case 'c': filecount = optarg; edit_mask |= FILECREDITMSK; break; case 'C': bytecount = optarg; edit_mask |= BYTECREDITMSK; break; case 'i': username = optarg; get_info = TRUE; break; case 'h': usage(); break; default: usage(); } } if (!ratiofile) usage(); if (add_user) { if (edit_user || delete_user || get_info) usage(); adduser(ratiofile, username, byteratio, fileratio, filecount, bytecount); exit(0); } if (delete_user) { if (edit_user || get_info) usage(); deluser(ratiofile, username); exit(0); } if (edit_user) { if (!edit_mask) usage(); edituser(ratiofile, username, byteratio, fileratio, filecount, bytecount, edit_mask); exit(0); } if (get_info) { RATIOHANDLE *rh; rh = getuserrh(ratiofile, username); if (rh == NULL) ERRORMSGFATAL("Username is not in ratio file!"); showinfo(rh); close(rh->ratiofilefd); exit(0); } usage(); return(0); } muddleftpd-1.3.13.1/src/reply.h0100644000175000017500000004075607737077257015221 0ustar joergjoerg/* macros for reply strings */ /* this is used to go tell a client to go to hell if it tries to send more than one command at a time! */ #define REPLY_ONECMDONLY "Only one command at a time." /* this is used to tell a user the server is shutting down and they are being forcibly logged out! */ #define REPLY_SERVERSHUTDOWN "Goodbye, server shutting down, logging out." /* this is used to tell a user that regular timeout has occurred. Parameter is how many seconds timeout is*/ #define REPLY_TIMEOUT(tv) "Goodbye, timeout occured (%d sec), logging out.", tv /* this is the default message used to greet a user as they connect */ #define REPLY_GREET PROGNAME" ("VERSTR") server ready. Enter Username." /* this is used when deleting a file. Parameter is the filename. */ #define REPLY_DELETE(filename) "Deleting file '%s'", filename /* this is used when chmoding a file. Parameter 1 is the filename, 2 is the new mode */ #define REPLY_CHMOD(filename, modenum) "Changing mode on file %s to %03o.", filename, modenum /* this is used when the client specifies the name of the source file to rename */ #define REPLY_RENAMESOURCE "Source ready, waiting for destination." /* this is used when the user did not specify a file to rename from using RNFR */ #define REPLY_RENAMENOSOURCE "Specify the source to rename first." /* this is used when the use successfully renames a file. First paramter is source file, second is the destination. */ #define REPLY_RENAME(file1, file2) "Renaming '%s' to '%s'", file1, file2 /* this is used when a new directory is created. Parameter is the new directory name. RFC requires that this reply is formatted with new directory name in quotes at beginning of reply! */ #define REPLY_MKDIR(newdir) "\x22%s\x22 was created", newdir /* this is used when a directory is removed. Parameter is the directory that was removed. */ #define REPLY_RMDIR(dirname) "Directory '%s' removed", dirname /* this is used when directories are changed OR when the user asks for the current directory. Parameter is the new directory. It is a RFC requirement that the current directory be at the begining of the reply, enclosed in double quotes */ #define REPLY_PWD(dirname) "\x22%s\x22 is the current directory.", dirname /* this is used when the command a client enters is not recognised. parameter is the command that isn't understood */ #define REPLY_CMDNOTKNOWN(cmd) "%s: command not recognised.", cmd /* this is used when a command a client enters requires parameters that were not given by the client. Parameter is the command that the user entered. */ #define REPLY_NOPARAM(cmd) "%s: parameters needed.", cmd /* this is used when the user enters a command that requires login status but the user isn't logged in. Typically, you should never see this message since new code hides invalid commands from use. It may be removed in the future. */ #define REPLY_NOLOGIN "Please login first." /* this is used when the user issues a command that is not valid while a data connection is established. The parameter is the command the user issued */ #define REPLY_DATACONNINVALID(cmd) "%s: command not valid during data connection.", cmd /* this is used when the user quits. */ #define REPLY_QUIT "Goodbye, logging out." /* this is used when the user tries to login as another user when jailing is enabled */ #define REPLY_JAILUSER "You cannot log on as another user." /* this is used when the user has had too many failed login attempts! */ #define REPLY_NOCREDITS "You have run out of login credits." /* this is used when the user executes the USER command. Parameter is the username they entered */ #define REPLY_USER(user) "Welcome '%s', enter password to login.", user /* this is used when the user executes the PASS command, but is already logged in. */ #define REPLY_ALREADYLOGGEDIN "Already logged in!" /* this is used when the user executes the PASS command, but has not executed a user command first */ #define REPLY_USEUSERFIRST "Supply a username first." /* this is used when PASS results in successful login. Parameter is the username */ #define REPLY_PASSOK(username) "User '%s' login successful.", username /* this is used when login fails due to too many users logged in */ #define REPLY_TOOMANYUSERS "Too many users. Cannot login." /* this is used when login fails to bad password or similar error. First parameter is the username and the second is the reason login failed, in english. */ #define REPLY_LOGINFAIL(username, reason) "Login for user '%s' failed (%s).", username, reason /* this is used for the REST command, when the resume value is invalid */ #define REPLY_INVALIDREST "Resume value is not valid." /* this is used for the REST command, when resume value is set, First parameter is new value resume is set to */ #define REPLY_RESTOK(posval) "Starting at position %s", offt_tostr(posval) /* this is used when the PORT command is used but a client told muddleftpd to connect to it on a privlidged port. */ #define REPLY_PORTBADPORT "PORT must specify port between 1024 and 65535." /* this is used when the PORT command is used but the client told muddleftpd to connect to a different server than the control port came from, but allowfxp was not set */ #define REPLY_PORTBADFXP "PORT must specify IP same as control IP." /* this is used when the PORT command succeeds. The 4 parameters are integer parts of the IP address. 5th is the remote port to connect to */ #define REPLY_PORTOK(ipa,ipb,ipc,ipd,portnum) "PORT command successful. Data port is %d.%d.%d.%d port %d.", ipa, ipb, ipc, ipd, portnum /* this is used for bad Port parameters */ #define REPLY_PORTBADPARM "Invalid parameters for PORT command." /* this is for setting the type to ASCII */ #define REPLY_TYPEASCII "TYPE is now ASCII." /* this is for setting type to BINARY */ #define REPLY_TYPEBINARY "TYPE is now BINARY." /* this is for unimplemented types */ #define REPLY_TYPEUNIMP "Unimplemented TYPE." /* this for aborting connections */ #define REPLY_ABORT "ABOR Successful." /* this is for passive connections. The RFC states that the end of the reply, the ip and then upper 16 and lower 16 bits of the port, separated by commas must be enclosed in brackets */ #define REPLY_PASV(p1,p2,p3,p4,p5,p6) "Entering Passive Mode (%d,%d,%d,%d,%d,%d)", p1, p2, p3, p4, p5, p6 /* this is for the no operation reply */ #define REPLY_NOOP "No operation was successful." /* this is used for help when the command the client wants help for is not known (or disabled). Parameter is the unknown command */ #define REPLY_HELPUNKNOWN(cmd) "Command '%s' not known.", cmd /* this is the first line of the multi-line reply for help. It must begin with 214- */ #define REPLY_HELPSTART "214-Recognized commands:" /* this is the last line of the multi-lined reply to help. parameter is the email specified in the config file */ #define REPLY_HELPEND(emailaddr) "End of help. Send comments to %s", emailaddr /* this is the reply when the client does an ALLO (allocate space) */ #define REPLY_ALLO "Space allocation unnessecary." /* this is the reply when the client does an ACCT (account) */ #define REPLY_ACCT "Account unnessecary." /* this is the reply when the client asks for file structure with the command STRU */ #define REPLY_STRUFILE "STRU File OK." /* this is the reply when the client asks for any other structure to file */ #define REPLY_STRUUNKNOWN "Unknown STRU type." /* this is the reply for when a transfer is done. The number of bytes is the parameter */ #define REPLY_TRANSDONE(count) "Transfer done. %s bytes transferred.", offt_tostr(count) /* this is the reply for when a transfer is aborted. The number of bytes transferred is the parameter */ #define REPLY_TRANSABORT(count) "Transfer aborted. %s bytes transferred.", offt_tostr(count) /* this is the reply for when byte credits are exhausted. It is the a multi-line reply line */ #define REPLY_BYTELIMIT "426-Byte download credits exhausted." /* this is the reply for when file credits are exhausted. */ #define REPLY_FILELIMIT "File download credits exhausted." /* this is the reply when a client tries to resume an ascii upload (cannot be done) */ #define REPLY_RESUMEASCIIUP "Cannot resume ASCII upload. Use APPE." /* this is the reply when stou cannot determine a unique filename to use */ #define REPLY_STOUNOUNIQUE "Could not determine an unique filename." /* this is the reply when a passive connection is stolen by a computer without the same IP as the client. */ #define REPLY_PASSIVEBADHOST "Passive connection not from your host, disconnecting." /* this is the reply when a transfer for a directory listing is being announced */ #define REPLY_TRANSLISTSTART "Starting ASCII transfer for file listing." /* this is the string used when a transfer is being started. First parametsr is the mode the file is being transferred in, second is the size of the file, which must go at the end of the string */ #define REPLY_TRANSSTART(type,size) "Starting %s transfer.%s", type, size /* this is the string used when a transfer is being resumed. First parameter is the file transfer mode, second is the starting offset, third is the size of the file, which must go at the end of the string */ #define REPLY_TRANSRESUME(type,offsetpos,size) "Starting %s transfer at offset %s.%s", type, offt_tostr(offsetpos), size /* this is used when a file transfer is aborted after a transfer command starts but before the data connection is established. */ #define REPLY_TRANSSTILLBORN "Data connection in progress cancelled." /* This is used when the new umask given to the server is not parsable */ #define REPLY_UMASKBAD "UMASK must be octal value." /* this is used when a new umask is set. First parameter is the new umask, second is the old */ #define REPLY_UMASKNEW(nu,ou) "New UMASK is %03o (old was %03o)", nu, ou /* this is used when the current umask is returned. First parameter is the umask */ #define REPLY_UMASKCUR(cmask) "Current UMASK is %03o", cmask /* this is used when the timeout is returned. Paramter is the current timeout value */ #define REPLY_TIMEOUTCURRENT(val) "Timeout is set to %d seconds.", val /* this is used when the timeout in the config file is less than 30 seconds, and cannot be adjusted by the client. Parameter is the current timeout value */ #define REPLY_TIMEOUTFIXED(val) "Timout too small to be adjusted. (%d sec)", val /* this is used when the client doesn't send a integer timeout to the timeout command */ #define REPLY_TIMEOUTNOTINT "Timeout must be an integer value." /* this is used when the timeout command is successful in setting a new timeout. First parameter is the new timeout value */ #define REPLY_TIMEOUTOK(tout) "Timeout set to %d seconds.", tout /* this is used when the timeout value specified is out of range. First parameter is the minimun, second is the maximun timeouts */ #define REPLY_TIMEOUTRANGE(t1, t2) "Timeout must be between %d and %d seconds.", t1, t2 /* this is used when chmod is called with no parameters. */ #define REPLY_CHMODNOPARMS "SITE CHMOD expects mode and filename parameters." /* this is used when chmod is called with a non octal value mode */ #define REPLY_CHMODBADMODE "SITE CHMOD requires octal mode number." /* this is used when access to site chmod is denied by administrator. */ #define REPLY_CHMODDENIED "SITE CHMOD access denied." /* this is used when the access list is requested by the user. It is the first line of a multi-line reply. The parameter is the username the access list is being displayed for */ #define REPLY_ACCESSFIRST(uname) "211-Access lists for user %s:", uname /* this is the second line of the access list reply. It requires %s at the beginning of the line and the first parameter to map to it */ #define REPLY_ACCESSSECOND(format) "%s***Path/Filename*** ***Access***", format /* this is the final line of the access list reply. */ #define REPLY_ACCESSEND "End of access list." /* this is the STAT reply. The parameters should be self explanitary. Well maybe not, but it makes it flexible. */ #define REPLY_STAT1(pus) "211-Running "PROGNAME" ("VERSTR") on host '%s'", pus->vserver->vhostname #define REPLY_STAT2(pus) "%sUser currently logged in as '%s'", replystr, pus->username #define REPLY_STAT3(pus) "%sCurrent Directory: %s", replystr, pus #define REPLY_STAT4(pus) "%sFile transfer mode: %s", replystr, (pus->binary)?"IMAGE":"ASCII" #define REPLY_STAT5(pus) "%sRestart position: %s", replystr, offt_tostr(pus->restartpos) #define REPLY_STAT6(pus) "%sUmask of new files and dirs: %04o", replystr, pus->umask #define REPLY_STAT7(pus) "%sTimeout: %d seconds", replystr, pus->timeout #define REPLY_STAT8(pus) "%sYour host: %s", replystr, pus->hostname /* this is the STAT replies if a file is being downloaded. */ #define REPLY_STAT9 "%sData Connection in progress: ", replystr /* this is displayed if a data connection is waiting on completion */ #define REPLY_STAT10 "%s Connection is not yet completed.", replystr /* this is displayed if the data port is transmitting data, but the total amount to be transfered is unknown */ #define REPLY_STAT11(pus) "%s Data Transferred: %s", replystr, offt_tostr(pus->dport->transbytes) /* this is displayed if the data port is transmitting data, and the total amount is known */ #define REPLY_STAT12(pus) "%s Data Transferred: %s of %s", replystr, offt_tostr(pus->dport->transbytes), offt_tostr(pus->dport->tsize) /* this is displayed at the beginning of a file listing style stat. The parameter is the directory asked for. It is part of a multi-line reply */ #define REPLY_STATLIST(cmd) "211-Status of %s:", cmd /* this is displayed when STAT finishes for both regular and file listing STAT's */ #define REPLY_STATEND "End of status." /* this is displayed for ratios in the STAT command. First parameter must stay at the front for each of these, and must be first in the parameter list. */ #define REPLY_RATIOBYTECREDITS(format, creds) "%sDownload credits: %lld bytes", format, creds #define REPLY_RATIOBYTERATIO(format, upp, downn) "%sUpload %d bytes to receive %d bytes of download credits", format, upp, downn #define REPLY_RATIOFILECREDITS(format, creds) "%sFile credits: %d files", format, creds #define REPLY_RATIOFILERATIO(format, upp, downn) "%sUpload %d files to receive %d files of download credits", format, upp, downn /* This is displayed with "EPSV ALL" is received, and a different port command is sent. This stops NAT breaking */ #define REPLY_EPSVSET "Only EPSV connections can be established." /* This is displayed when the user does EPSV ALL */ #define REPLY_EPSVON "Set for EPSV connections only." /* This is displayed if the user asks for an unsupported protocol */ #define REPLY_BADPROTO "Unsupported protocol, Must use IPV4. (1)" /* This is displayed if the user sends a bad epsv command */ #define REPLY_EPSVERR "EPSV parameter incorrect." /* This returns the EPSV result */ #define REPLY_EPSV(p1) "Extended passive mode on (|||%d|)", p1 /* this is used for bad Port parameters */ #define REPLY_EPRTBADPARM "Invalid parameters for EPRT command." /* this is used when the EPRT command is used but a client told muddleftpd to connect to it on a privlidged port. */ #define REPLY_EPRTBADPORT "EPRT must specify port more than 1024." #define REPLY_EPRTBADFXP "EPRT must specify IP same as control IP." /* this is used when the EPRT command succeeds. The 4 parameters are integer parts of the IP address. 5th is the remote port to connect to */ #define REPLY_EPRTOK(ipa,ipb,ipc,ipd,portnum) "EPRT command successful. Data port is %d.%d.%d.%d port %d.", ipa, ipb, ipc, ipd, portnum /* this is used when the server cannot add any more users */ #define REPLY_SERVERBUSY "421 Server too busy, logging out.\r\n" /* this is used when virutal servers on a single IP are not being used */ #define REPLY_NOHOSTS "HOST not implemented." /* this is used if a user trys to select a new host */ #define REPLY_HOSTSELECTED "Virtual host already selected." /* this is used if a virtual host is not found */ #define REPLY_HOSTNOTFOUND(name) "Virtual host '%s' not found.", name /* this is used if a virtual host is misconfigured, does not exist */ #define REPLY_HOSTMISCONF(name) "Virtual host '%s' misconfigured.", name /* this is used if a virtual host is too busy */ #define REPLY_HOSTTOOBUSY(name) "Virtual host '%s' too busy.", name /* this is used when the virtual server is selected */ #define REPLY_HOSTSEL(name) "\x22%s\x22 is the selected server.", name muddleftpd-1.3.13.1/src/select.c0100644000175000017500000001342107737077257015325 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" /* Note that i may one day replace all this with the poll funcutions */ #define MAXFDNUM 16 /* Set startup maximum file descriptor number */ /* Creates a new select structure */ extern int signumber; SELECTER *select_new(void) { SELECTER *new = mallocwrapper(sizeof(SELECTER)); debuglog("select_new - starting new select structure"); new->fdtable = mallocwrapper(sizeof(struct selectorobj *) * (MAXFDNUM + 1)); memset(new->fdtable, 0, sizeof(struct selectorobj *) * (MAXFDNUM + 1)); new->maxfds = MAXFDNUM; new->firstfd = -1; new->smax = 0; return(new); } /* The following adds a FD to the fdtable. If the table is too small, then increase it. Favours long running times */ void select_addfd(SELECTER *sel, int newport) { debuglog("select_addfd - adding fd %d", newport); if (newport > sel->maxfds) { int temp = newport + 32; /* give some breathing space */ reallocwrapper(sizeof(struct selectorobj *) * (temp + 1), (void *)&(sel->fdtable)); memset(&(sel->fdtable[sel->maxfds + 1]), 0, sizeof(struct selectorobj *) * (temp - sel->maxfds)); sel->maxfds = temp; } if (sel->fdtable[newport] != NULL) errormsg("select.c: select_addfd - trying to add a file descriptor already in table.", __FILE__, __LINE__); else { struct selectorobj *temp = mallocwrapper(sizeof(struct selectorobj)); temp->readsockopt = NULL; temp->writesockopt = NULL; temp->readdata = NULL; temp->writedata = NULL; temp->last = -1; temp->next = sel->firstfd; if (sel->firstfd != -1) sel->fdtable[sel->firstfd]->last = newport; sel->firstfd = newport; sel->fdtable[newport] = temp; } } void select_delfd(SELECTER *sel, int deadport) { int result; struct selectorobj *temp = sel->fdtable[deadport]; debuglog("select_delfd - removing fd %d", deadport); result = close(deadport); /* make sure the port is closed :) */ /* if (result == -1) errormsg(strerror(errno), __FILE__, __LINE__); */ select_takeread(sel, deadport); select_takewrite(sel, deadport); if (sel->firstfd == deadport) { sel->firstfd = temp->next; if (sel->firstfd != -1) sel->fdtable[sel->firstfd]->last = -1; } else { sel->fdtable[temp->last]->next = temp->next; if (temp->next != -1) sel->fdtable[temp->next]->last = temp->last; } freewrapper(temp); sel->fdtable[deadport] = NULL; } void select_addread(SELECTER *sel, int port, int (* proc)(SELECTER *, int, void *), void *dat) { debuglog("select_addread - fd %d", port); sel->fdtable[port]->readsockopt = proc; sel->fdtable[port]->readdata = dat; sel->smax = MAXIMUM(sel->smax, port); } void select_addwrite(SELECTER *sel, int port, int (* proc)(SELECTER *, int, void *), void *dat) { debuglog("select_addwrite - fd %d", port); sel->fdtable[port]->writesockopt = proc; sel->fdtable[port]->writedata = dat; sel->smax = MAXIMUM(sel->smax, port); } void select_takeread(SELECTER *sel, int port) { debuglog("select_takeread - fd %d", port); sel->fdtable[port]->readsockopt = NULL; sel->fdtable[port]->readdata = NULL; /* FD_CLR(port, &(sel->readset)); */ } void select_takewrite(SELECTER *sel, int port) { debuglog("select_takewrite - fd %d", port); sel->fdtable[port]->writesockopt = NULL; sel->fdtable[port]->writedata = NULL; /* FD_CLR(port, &(sel->writeset)); */ } int select_do(SELECTER *sel, int *signum, int timeout) { fd_set readset, writeset; struct timeval tv, *tv2; int result = 0; FD_ZERO(&readset); FD_ZERO(&writeset); debuglog("do_select - waiting on fd's"); *signum = 0; signumber = 0; while (result == 0) { int pos = sel->firstfd; while(pos != -1) { struct selectorobj *temp = sel->fdtable[pos]; if (temp->readsockopt) FD_SET(pos, &readset); if (temp->writesockopt) FD_SET(pos, &writeset); pos = temp->next; } if (timeout != -1) { tv.tv_sec = timeout; tv.tv_usec = 0; tv2 = &tv; } else tv2 = NULL; if (signumber != 0) { *signum = signumber; return(-1); } result = select(sel->smax + 1, &readset, &writeset, NULL, tv2); if (result == 0) return(0); else if (result == -1) { if (errno == EINTR) { *signum = signumber; return(-1); } else { errormsg(strerror(errno), __FILE__, __LINE__); return(-1); } } else { pos = sel->firstfd; result = 0; while((pos != -1) && (result == 0)) { struct selectorobj *temp = sel->fdtable[pos]; if (temp->readsockopt) if (FD_ISSET(pos, &readset)) result = temp->readsockopt(sel, pos, temp->readdata); if ((temp->writesockopt) && (result == 0)) if (FD_ISSET(pos, &writeset)) result = temp->writesockopt(sel, pos, temp->writedata); FD_CLR(pos, &writeset); FD_CLR(pos, &readset); if (result == 2) { int pos2 = temp->next; select_delfd(sel, pos); result = 0; pos = pos2; } else pos = temp->next; } } } return(result); } void select_shutdown(SELECTER *sel) { int count; for (count = 0; count < sel->maxfds; count++) if (sel->fdtable[count]) select_delfd(sel, count); freewrapper(sel->fdtable); freewrapper(sel); } muddleftpd-1.3.13.1/src/shmem.c0100644000175000017500000000307007737077257015156 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" void shmem_finish(int shmemnum) { struct shmid_ds buffer; if (shmemnum != -1) { if (shmctl(shmemnum, IPC_RMID, &buffer) == -1); /* close(shmem_lockfd); */ } } void *shmem_get(char *ipcfile, int size, int *shmemnum, int *isnew, int *lockfd) { key_t ipckey = ftok(ipcfile, '/'); void *shmemarea; *isnew = TRUE; *shmemnum = shmget(ipckey, size, IPC_CREAT | IPC_EXCL | 0600); if (*shmemnum == -1) { *isnew = FALSE; *shmemnum = shmget(ipckey, size, IPC_CREAT |/* IPC_EXCL |*/ 0600); } if (*shmemnum == -1) ERRORMSGFATAL(strerror(errno)); shmemarea = shmat(*shmemnum, NULL, 0); /* get semaphores. Using the config file so others can join in (we use file locks for portability, simplicity and usability. */ *lockfd = open(ipcfile, O_RDWR); if (*lockfd == -1) ERRORMSGFATAL(strerror(errno)); return(shmemarea); } muddleftpd-1.3.13.1/src/socket.c0100644000175000017500000001627507737077257015350 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* This library contains various TCP/IP connection utilities to make connecting and listening to sockets easier to impliment. */ #include "ftpd.h" sigjmp_buf sigbuf; /* server is in machine format (not network format) */ char *getipstr(unsigned int server) { static char ipstr[20]; snprintf(ipstr, 20, "%d.%d.%d.%d", server >> 24, (server >> 16) & 0xFF, (server >> 8) & 0xFF, server & 0xFF); return(ipstr); } void takentoolong(int sig) { siglongjmp(sigbuf, 1); } /* server is in machine format */ char *getnetworkstr(unsigned int server) { struct hostent *hostentry; unsigned int myserve = htonl(server); int a; a = sigsetjmp(sigbuf, 1); signal(SIGALRM, takentoolong); if ((a == 0) && (config->dnstimeout != -1)) { alarm(config->dnstimeout); hostentry = gethostbyaddr((char *)&myserve, sizeof(unsigned int), AF_INET); } else hostentry = NULL; signal(SIGALRM, SIG_IGN); alarm(0); if (hostentry) return(strdupwrapper(hostentry->h_name)); else return(strdupwrapper((char *)getipstr(server))); } /* This procedure gets the internet ip address for a hostname or IP string. It returns either the network address or -1 signalling DNS failure for a host name */ int getnetworkint(char *server, unsigned int *out) { int pos, trigger; struct hostent *hostentry; char **ipaddrstr; char *buffertmp; unsigned int a1, a2, a3, a4; unsigned int l; pos = 0; trigger = 0; while ((server[pos] != 0) && (trigger != 1)) { if (((server[pos] < '0') || (server[pos] > '9')) && (server[pos] != 46)) trigger = 1; pos = pos + 1; } if (trigger == 1) { hostentry = gethostbyname(server); if (hostentry == NULL) return(-1); /* DNS failure */ ipaddrstr = hostentry->h_addr_list; memcpy(&l, *ipaddrstr, 4); l = ntohl(l); } else { buffertmp = mallocwrapper(sizeof(char) * (strlen(server) + 1)); pos = 0; while (server[pos] != 0) { if (server[pos] == 46) buffertmp[pos] = 65; else buffertmp[pos] = server[pos]; pos = pos + 1; } buffertmp[pos] = 0; sscanf(buffertmp, "%uA%uA%uA%u", &a1, &a2, &a3,&a4); l = ((a1 * 256 * 256 * 256) + (a2 * 256 * 256) + (a3 * 256) + a4); freewrapper(buffertmp); } *out = l; return(0); } int conn_server(unsigned int ip, int port) { int socknum, pos; struct sockaddr_in dest; dest.sin_addr.s_addr = htonl(ip); dest.sin_port = htons(port); dest.sin_family = AF_INET; socknum = socket( AF_INET, SOCK_STREAM, 6); if (socknum == -1) return(-1); pos = connect(socknum, (struct sockaddr *)&dest, sizeof(dest)); if (pos == -1) return(-1); /* Connection failure */ return (socknum); } int conn_server_nonblocking(unsigned int ip, int port, int localport, int fd) { int socknum, pos; struct sockaddr_in dest; int on = 1; int tmp; socknum = socket(AF_INET, SOCK_STREAM, 6); if (socknum == -1) return(-1); /* See if we can get the local port we want to bind to */ /* If we can't, just let the computer choose a port for us */ dest.sin_family = AF_INET; tmp = sizeof(dest); getsockname(fd, (struct sockaddr *)&dest, &tmp); dest.sin_port = htons(localport); setsockopt(socknum, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); /* attempt to bind the socket, if it doesn't work, it isn't a problem */ bind(socknum, (struct sockaddr *)&dest, sizeof(dest)); dest.sin_port = htons(port); dest.sin_addr.s_addr = htonl(ip); fcntl(socknum, F_SETFL, O_NONBLOCK); pos = connect(socknum, (struct sockaddr *)&dest, sizeof(dest)); if ((pos == -1) && (errno != EINPROGRESS)) return(-1); /* Connection failure */ return (socknum); } /* This procedure will setup a socket to accept connections from remote servers. The parameter needed is the port to listen on and the maximum number of connections that can be pending. It will return one of the following values >0 - The socket ready to accept connections -1 - Binding the socket failed, probably because the port is already used -2 - Socket creation failed for some, probably serious reason */ int listenport(int port, unsigned int ip, int maxconnect) { int newport; struct sockaddr_in dest; int on = 1; newport = socket(AF_INET, SOCK_STREAM, 6); if (newport == -1) return(-1); dest.sin_family = AF_INET; dest.sin_port = htons(port); dest.sin_addr.s_addr = htonl(ip); /* clear the address so it works */ setsockopt(newport, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); if (bind(newport, (struct sockaddr *)&dest, sizeof(dest)) == -1) return(-1); listen(newport, maxconnect); return(newport); } /* This procedure accepts a connection on a socket defined with the above procedure. It requires the socket number. It returns a 4 byte integer representing the other hosts ip number in iaddress and returns the following: >0 - the file descriptor of the open connection -1 - failure (something went wrong) */ int get_conn(int socketin, unsigned int *addr) { struct sockaddr_in dest; int inport, n; n = sizeof(dest); inport = accept(socketin, (struct sockaddr *)&dest, &n); if (inport == -1) { return(-1); } *addr = ntohl(dest.sin_addr.s_addr); return(inport); } /* this sets up a connection parralel to a current connection. It is used for the data connection in the FTP server */ int listenparrelelport(int fd, int *port, unsigned int *ip, int maxconnect) { int newport; struct sockaddr_in dest; int tmp; newport = socket(AF_INET, SOCK_STREAM, 6); if (newport == -1) return(-1); tmp = sizeof(dest); getsockname(fd, (struct sockaddr *)&dest, &tmp); tmp = 1; setsockopt(newport, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(tmp)); dest.sin_port = htons(*port); if (bind(newport, (struct sockaddr *)&dest, sizeof(dest)) == -1) return(-1); tmp = sizeof(dest); getsockname(newport, (struct sockaddr *)&dest, &tmp); *port = ntohs(dest.sin_port); *ip = ntohl(dest.sin_addr.s_addr); listen(newport, maxconnect); return(newport); } void getsockinfo(int fd, unsigned int *ip, int *port) { struct sockaddr_in dest; int tmp; tmp = sizeof(dest); getsockname(fd, (struct sockaddr *)&dest, &tmp); *ip = ntohl(dest.sin_addr.s_addr); *port = ntohs(dest.sin_port); } unsigned int getremoteip(int fd) { struct sockaddr_in name; int len = sizeof(name); if (!getpeername(fd, (struct sockaddr *)&name, &len)) return(ntohl(name.sin_addr.s_addr)); else return(1); } void socket_flush_wait(int fd, int timeout) { char c; signal(SIGALRM, SIG_IGN); alarm(timeout); shutdown(fd, 1); read(fd, &c, 1); alarm(0); } muddleftpd-1.3.13.1/src/string.c0100644000175000017500000000627207751225321015341 0ustar joergjoerg#include "ftpd.h" STRING *string_new(void) { STRING *ns = mallocwrapper(sizeof(STRING) + MINLEN + 1); STRLENGTH(ns) = 0; STRTOCHARN(ns, 0) = 0; return(ns); } void string_cat(STRING **s, char *catstr, int len) { if (len == -1) len = strlen(catstr); if (len + STRLENGTH(*s) >= MINLEN) reallocwrapper(len + STRCURSIZE(*s), (void *)s); memcpy(STRTOCHAR(*s) + STRLENGTH(*s), catstr, len); STRLENGTH(*s) += len; STRTOCHARN(*s, (*s)->strlen) = 0; } void string_clear(STRING **s) { if (STRLENGTH(*s) > MINLEN) reallocwrapper(sizeof(STRING) + MINLEN + 1, (void *)s); STRLENGTH(*s) = 0; STRTOCHARN(*s, 0) = 0; } void string_dropfront(STRING **s, int nchars) { int oldlen = STRLENGTH(*s); if ((*s)->strlen < nchars) nchars = (*s)->strlen; memmove(STRTOCHAR(*s), STRTOCHAR(*s) + nchars, STRLENGTH(*s) - nchars); STRLENGTH(*s) -= nchars; STRTOCHARN(*s, STRLENGTH(*s)) = 0; if (oldlen >= MINLEN) { if (STRLENGTH(*s) >= MINLEN) reallocwrapper(sizeof(STRING) + STRLENGTH(*s) + 1, (void *)s); else reallocwrapper(sizeof(STRING) + MINLEN + 1, (void *)s); } } void string_catvprintf(STRING **s, int len, char *format, va_list ap) { if (STRLENGTH(*s) + len >= MINLEN) reallocwrapper(len + STRCURSIZE(*s), (void *)s); vsnprintf(STRTOCHAR(*s) + STRLENGTH(*s), len+1, format, ap); STRLENGTH(*s) += len; } void string_catprintf(STRING **s, char *format, ...) { va_list printfargs; int len; va_start(printfargs, format); len = vsnprintf(NULL, 0, format, printfargs); va_end(printfargs); va_start(printfargs, format); string_catvprintf(s, len, format, printfargs); va_end(printfargs); } /* this is for input to ftp. Make very strict. (No tabs or nofing, only /r/n) */ void string_filterbadchars_telnet(STRING **s, int start) { int count, slen; unsigned char *pos1, *pos2; if (start > STRLENGTH(*s)) return; pos1 = pos2 = STRTOCHAR(*s) + start; slen = STRLENGTH(*s); count = start; while(count < slen) { /* be very aggressive. Only printable charaters! */ if ((*pos1 >= 32) && (*pos1 <= 126)) { *pos2 = *pos1; pos2++; } else { switch(*pos1) { case '\r': /* allow specific case of \r\n only. */ if (count != (slen - 1)) { if (*(pos1 + 1) == '\n') { // forward 2 chars *pos2 = *pos1; *(pos2 + 1) = *(pos1 + 1); pos1++; pos2 += 2; count++; } else STRLENGTH(*s) -= 1; } else STRLENGTH(*s) -= 1; break; default: STRLENGTH(*s) -= 1; break; } } pos1++; count++; } *pos2 = 0; } /* this is for input files. Be quite relaxed, but still remove annoying chars */ void string_filterbadchars_unix(STRING **s, int start) { int count, slen; unsigned char *pos1, *pos2; if (start > STRLENGTH(*s)) return; pos1 = pos2 = STRTOCHAR(*s) + start; slen = STRLENGTH(*s); count = start; while(count < slen) { /* be very aggressive. Only printable charaters! */ if (*pos1 >= 32) { *pos2 = *pos1; pos2++; } else { switch(*pos1) { case '\n': case '\t': *pos2 = *pos1; pos2++; break; default: STRLENGTH(*s) -= 1; break; } } pos1++; count++; } *pos2 = 0; } muddleftpd-1.3.13.1/src/string.h0100644000175000017500000000123607751225321015341 0ustar joergjoergtypedef struct { int strlen; } STRING; #define MINLEN 4096 #define STRTOCHAR(a) ((char *)(a) + sizeof(STRING)) #define STRTOCHARN(a, n) (*((char *)(a) + sizeof(STRING) + (n))) #define STRCURSIZE(a) (sizeof(STRING) + (a)->strlen + 1) #define STRLENGTH(a) ((a)->strlen) STRING *string_new(void); void string_cat(STRING **s, char *catstr, int len); void string_clear(STRING **s); void string_dropfront(STRING **s, int nchars); void string_catvprintf(STRING **s, int len, char *format, va_list ap); void string_catprintf(STRING **s, char *format, ...); void string_filterbadchars_telnet(STRING **s, int start); void string_filterbadchars_unix(STRING **s, int start); muddleftpd-1.3.13.1/src/tokset.h0100644000175000017500000000151407737077257015364 0ustar joergjoerg /* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef TOKSET_H #define TOKSET_H typedef struct { char *(*gettoken)(char letter); char *params[128]; } TOKENSET; #endif muddleftpd-1.3.13.1/src/utils.c0100644000175000017500000004651207751225321015174 0ustar joergjoerg/* utils.c General utility functions Copyright Beau Kuiper 1999. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ftpd.h" //#define SHOWMALLOC /* Wapper for malloc that syslogs and then dies if malloc fails before damage is done. */ int nummalloc = 0; int doesdint = -1; /* memory routines * ***********************************************************************/ void *mallocwrapper(int size) { void *outmem; outmem = (void *)malloc(size); #ifdef SHOWMALLOC nummalloc++; printf("malloc: %d\n", nummalloc); #endif if (outmem == NULL) ERRORMSGFATAL("malloc error, out of memory"); return(outmem); } /* Wapper for remalloc that syslogs and then dies if malloc fails before damage is done */ void reallocwrapper(int size, void **inarea) { void *outmem; assert(size > 0); if (*inarea == NULL) outmem = mallocwrapper(size); else outmem = (void *)realloc(*inarea, size); if (outmem == NULL) { ERRORMSG("realloc error, out of memory"); exit(1); } #if DEBUG if (*inarea == outmem) { outmem = mallocwrapper(size); /* make sure memory is moved */ memmove(outmem, *inarea, size); freewrapper(*inarea); /* free the original area */ } #endif *inarea = outmem; } char *strdupwrapper(char *s) { char *outstr; assert(s != NULL); outstr = malloc(strlen(s) + 2); if (outstr == NULL) ERRORMSGFATAL("strdup error, out of memory"); #ifdef SHOWMALLOC nummalloc++; printf("malloc: %d\n", nummalloc); #endif strcpy(outstr, s); return(outstr); } void freewrapper(void *tofree) { if (tofree == NULL) { ERRORMSG("Trying to free null pointer!"); } free(tofree); #ifdef SHOWMALLOC printf("free: %d\n", nummalloc); nummalloc--; #endif } void freeifnotnull(void *tofree) { if (tofree != NULL) { free(tofree); #ifdef SHOWMALLOC printf("free: %d\n", nummalloc); nummalloc--; #endif } } #ifndef HAVE_MEMMOVE void *memmove(void *dest, void *src, int n) { int p; assert(dest != NULL); assert(src != NULL); assert(n >= 0); if (src == dest) return(dest); if (src < dest) for(p = 0; p < n; p++) *(char *)(src + n) = *(char *)(dest + n); else for(p = n; p > 0; p--) *(char *)(src + n) = *(char *)(dest + n); return(dest); } #endif /* string routines * ***********************************************************************/ void strtrimspace(char *string) { int pos, pos2; pos2 = 0; pos = 0; while(string[pos] != 0) { if (string[pos] > 32) { string[pos2] = string[pos]; pos2++; } pos++; } string[pos2] = 0; } int strchrcount(char *string, char tok) { char *lastoccur = string; int ret = 0; while((lastoccur = strchr(lastoccur, tok)) != NULL) { lastoccur++; ret++; } return(ret); } char *safe_vsnprintf(int size, char *format, va_list ap) { char *buffer = mallocwrapper(size+1); int result; result = vsnprintf(buffer, size+1, format, ap); return(buffer); } char *safe_snprintf(char *format, ...) { va_list printfargs; int size = BUFFSMALL; char *buf = mallocwrapper(size); int result; va_start(printfargs, format); result = vsnprintf(buf, size, format, printfargs); va_end(printfargs); if (result >= size) { reallocwrapper(result+1, (void *)&buf); va_start(printfargs, format); result = vsnprintf(buf, result+1, format, printfargs); va_end(printfargs); } return(buf); } char *getcwd2(void) { int size = BUFFSMALL; char *buffer = mallocwrapper(size); char *result; do { result = getcwd(buffer, size-1); if (result == NULL) { if (errno == ERANGE) { if (size > (64 * 1024)) size += (64 * 1024); else size += size; reallocwrapper(size, (void *)&buffer); } else { freewrapper(buffer); return(NULL); } } } while (result == NULL); return(buffer); } void pathname_simplify(char *pathname) { int pos, pos2; pos = 0, pos2 = 0; while(pathname[pos] != 0) { switch(pathname[pos]) { case '/': if (pathname[pos+1] == '/'); else if ((strncmp(pathname + pos, "/./", 3) == 0) || (strcmp(pathname + pos, "/.") == 0)) pos++; else if ((strncmp(pathname + pos, "/../", 4) == 0) || (strcmp(pathname + pos, "/..") == 0)) { if (pos2 > 1) pos2--; while((pos2 > 1) && (pathname[pos2] != '/')) pos2--; pos += 2; } else { pathname[pos2] = '/'; pos2++; } break; default: pathname[pos2] = pathname[pos]; pos2++; } pos++; } if (pos2 == 0) { pathname[pos2] = '/'; pos2++; } pathname[pos2] = 0; } /* This is meant to be quick */ char *offt_tostr(off_t size) { /* the divide should be optimized away automagicly */ static char sizestr[sizeof(off_t) * 4]; char *l = sizestr + (sizeof(off_t) * 4 - 1); off_t esize = size; *l = 0; l--; do { *l = '0' + (esize % 10); l--; esize /= 10; } while(esize > 0); if (size < 0) { *l = '-'; l--; } return(l + 1); } int strto_offt(char *str, off_t *ret) { off_t r; char *l = str; int neg = (*l == '-'); r = 0; if (*l == '-') l++; while((*l >= '0') && (*l <= '9')) { r = r * 10 + (*l - '0'); l++; } // error if not end of string if (*l != 0) return(-1); *ret = (neg ? -r : r); return(0); } void test_libc(int verbose) { char instr[15]; int result; long long a; if (verbose) printf("Testing libraries!!\n"); /* test snprintf schematics */ if (verbose) printf("Now, does snprintf work . . . . . . . . "); memset(instr, 0, 15); /* this will overflow the string */ result = snprintf(instr, 10, "test %s", "testing"); if (instr[10] != 0) { if (verbose) printf("No\n"); ERRORMSGFATAL("snprintf is broken! Cannot continue!"); } if (verbose) printf("Yes\n"); /* testing double int support */ if (verbose) printf("Now, can I use double ints . . . . . . . "); a = 1000000000000LL; sprintf(instr, "%lld", a); sscanf(instr, "%lld", &a); if ((strcmp(instr, "1000000000000") == 0) && (a == 1000000000000LL)) { if (verbose) printf("Yes\n"); doesdint = TRUE; } else { if (verbose) printf("No, ratio support disabled\n"); doesdint = FALSE; } if ((!doesdint) && (sizeof(long long) == sizeof(off_t))) ERRORMSGFATAL("snprintf doesn't support double int but needed to do file lengths"); } #ifndef HAVE_USLEEP int usleep(int usecs) { struct timeval tv; tv.tv_sec = usecs / 1000000; tv.tv_usec = usecs % 1000000; return(select(0, NULL, NULL, NULL, &tv)); } #endif /* hash functions * ***********************************************************************/ /* string cache routines * ***********************************************************************/ STRCACHE *strcache_new(void) { STRCACHE *cache = mallocwrapper(sizeof(STRCACHE)); memset(cache, 0, sizeof(STRCACHE)); return(cache); } char *strcache_check(STRCACHE *cache, int num) { int counter = 0; while (counter < cache->size) { if (cache->data[counter].num == num) return(cache->data[counter].str); counter++; } return(NULL); } void strcache_add(STRCACHE *cache, int num, char *str) { if (cache->size < STRCACHESIZE) { cache->data[cache->size].num = num; cache->data[cache->size].str = strdupwrapper(str); (cache->size)++; } } void strcache_free(STRCACHE *cache) { int counter = 0; while (counter < cache->size) { freewrapper(cache->data[counter].str); counter++; } freewrapper(cache); } /* token set routines * ***********************************************************************/ TOKENSET *tokenset_new(void) { TOKENSET *newset = mallocwrapper(sizeof (TOKENSET)); memset(newset, 0, sizeof(TOKENSET)); return(newset); } void tokenset_settoken(TOKENSET *tset, unsigned char tok, char *data) { int token = (int)tok; assert(token < 128); assert(tset != NULL); /* printf("adding a token %d %s\n", token, data); */ if(tset->params[token] != NULL) freewrapper(tset->params[token]); tset->params[token] = data; } void tokenset_deltoken(TOKENSET *tset, unsigned char tok) { int token = (int)tok; assert(token < 128); assert(tset != NULL); if (tset->params[token] != NULL) freewrapper(tset->params[token]); tset->params[token] = NULL; } char *tokenset_apply(TOKENSET *tok, char *inputstr, int escapecookies) { int instrlen; char *outstring; int inpos = 0; int outpos = 0; int outstrlen; if (inputstr == NULL) return(NULL); instrlen = strlen(inputstr); outstring = mallocwrapper(instrlen+1); outstrlen = instrlen + 1; while(inpos < instrlen) { /* WARNING: This code contains strange things. Look carefully before frobing */ if (inputstr[inpos] != '%') outstring[outpos++] = inputstr[inpos++]; else if (inputstr[inpos + 1] == '%') { outstring[outpos++] = '%'; inpos += 2; } else if (inputstr[inpos + 1] == '(') { int a, b, strl, pc, allcookie = FALSE; /* try X to n format */ if (sscanf(inputstr + inpos, "%%(%d,*)", &a) == 1) allcookie = TRUE; else if (sscanf(inputstr + inpos, "%%(%d,%d)", &a, &b) < 2) goto fail; while(inputstr[inpos++] != ')') if (inputstr[inpos] == 0) goto fail; pc = (int)inputstr[inpos]; if (pc >= 128) goto fail; if (tok->params[pc] == NULL) goto fail; if (allcookie) b = strlen(tok->params[pc]); if (a < 0) a = 0; if (a > b) goto fail; strl = b - a + 1; if (strl > strlen(tok->params[pc]) - a) strl = strlen(tok->params[pc]) - a; inpos++; if (escapecookies) outstrlen += strl; outstrlen += strl; reallocwrapper(outstrlen+1, (void *)&outstring); if (escapecookies) { b = a + strl; while(a < b) { outstring[outpos] = '\\'; outstring[outpos+1] = tok->params[pc][a]; a++; outpos += 2; } } else { strncpy(outstring + outpos, tok->params[pc] + a, strl); outpos += strl; } } else { int strl, pc, a; pc = (int)inputstr[++inpos]; if (pc >= 128) goto fail; if (tok->params[pc] == NULL) goto fail; strl = strlen(tok->params[pc]); outstrlen += strl; if (escapecookies) outstrlen += strl; reallocwrapper(outstrlen+1, (void *)&outstring); if (escapecookies) { for (a = 0; a < strl; a++) { outstring[outpos] = '\\'; outstring[outpos+1] = tok->params[pc][a]; outpos += 2; } } else { strncpy(outstring + outpos, tok->params[pc], strl); outpos += strl; } inpos++; } } freewrapper(inputstr); outstring[outpos] = 0; return(outstring); fail: freewrapper(outstring); /* log the error so it can get fixed, because it may cause security problems when cookies don't parse correctly! */ /* These logs annoy too much, I will just forget about it */ /* outstring = safe_snprintf("Failed to parse cookie in line: '%s'", inputstr); log_addentry(MYLOG_INFO, NULL, outstring); freewrapper(outstring); */ return(inputstr); } void tokenset_finish(TOKENSET *tset) { int count; for (count = 0; count < 128; count++) freeifnotnull(tset->params[count]); freewrapper(tset); } /* uid and gid routines * ***********************************************************************/ /* this loads a username given a uid or a gid given a groupname */ /* this holds fd's to groupname, username files */ /* FIXME: This stuff sucks at NIS wise */ FILE *uidfile = NULL; FILE *gidfile = NULL; char *uid_retstr = NULL; char *gid_retstr = NULL; #define GROUPFILE "/etc/group" #define USERFILE "/etc/passwd" void init_pwgrfiles(void) { if (uidfile) fclose(uidfile); if (gidfile) fclose(gidfile); uidfile = fopen(USERFILE, "r"); gidfile = fopen(GROUPFILE, "r"); } char *get_passwdname(uid_t inuid, int usefile) { struct passwd *pw; freeifnotnull(uid_retstr); uid_retstr = NULL; if (!usefile) { pw = getpwuid(inuid); if (pw) uid_retstr = strdupwrapper(pw->pw_name); return(uid_retstr); } if (!uidfile) return(NULL); rewind(uidfile); while((pw = fgetpwent(uidfile)) != NULL) if (pw->pw_uid == inuid) { uid_retstr = strdupwrapper(pw->pw_name); return(uid_retstr); } return(NULL); } char *get_groupname(gid_t ingid, int usefile) { struct group *gr; freeifnotnull(gid_retstr); gid_retstr = NULL; if (!usefile) { gr = getgrgid(ingid); if (gr) gid_retstr = strdupwrapper(gr->gr_name); return(gid_retstr); } if (!gidfile) return(NULL); rewind(gidfile); while((gr = fgetgrent(gidfile)) != NULL) if (gr->gr_gid == ingid) { gid_retstr = strdupwrapper(gr->gr_name); return(gid_retstr); } return(NULL); } /* this must not be called in chroot jail. I shall use plain old getgrent so nis works */ gid_t *getusergrouplist(char *username) { gid_t *retlist = mallocwrapper(sizeof(gid_t)); struct group *gr; int count = 0; /* make sure info isn't stale */ endgrent(); setgrent(); retlist[0] = 0; if (!gidfile) return(retlist); rewind(gidfile); while((gr = getgrent()) != NULL) { int count2 = 0; while(gr->gr_mem[count2] != NULL) { if (strcmp(gr->gr_mem[count2], username) == 0) if ((retlist[count] != gr->gr_gid) || (count == 0)) { count++; reallocwrapper(sizeof(gid_t) * (count + 1), (void *)&retlist); retlist[count] = gr->gr_gid; retlist[0]++; } count2++; } } return(retlist); } gid_t *newgidlist(void) { gid_t *retlist = mallocwrapper(sizeof(gid_t)); retlist[0] = 0; return(retlist); } gid_t *addgidlist(gid_t *list, gid_t new) { list[0]++; reallocwrapper(sizeof(gid_t) * (list[0] + 1), (void *)&list); list[list[0]] = new; return(list); } void delgidlist(gid_t *list, gid_t old) { int pos, pos2; int count; pos = 1; pos2 = 1; count = list[0]; while(pos <= count) { if (list[pos] != old) { list[pos2] = list[pos]; pos2++; } else list[0]--; pos++; } } gid_t *parsegidlist(char *str) { gid_t *list = newgidlist(); char *pos = str; int newval; gid_t new; int result; int do_remove; strtrimspace(str); if (strcmp(str, "*") == 0) return(list); do { if (strcmp(pos, "") == 0) break; if (*pos == '!') { do_remove = TRUE; pos++; } else do_remove = FALSE; if (sscanf(pos, "%d", &newval) == 1) { new = (gid_t)newval; if (do_remove) delgidlist(list, new); else list = addgidlist(list, new); } else { list[0] = 0; return(list); } pos = strchr(pos, ','); result = (pos == NULL); pos++; } while(!result); return(list); } char *makegidliststr(gid_t *list) { int count; char *ret = mallocwrapper(12 * list[0] + 1); char *pos = ret; strcpy(ret, ""); for (count = 1; count <= list[0]; count++) { sprintf(pos, "%u,", list[count]); while(*pos != 0) pos++; } if (*(pos-1) == ',') *(pos-1) = 0; return(ret); } void kill_uidgidfiles(void) { if (uidfile) fclose(uidfile); if (gidfile) fclose(gidfile); freeifnotnull(gid_retstr); freeifnotnull(uid_retstr); } int isfilesafe(int fd) { struct stat buf; fstat(fd, &buf); if ((buf.st_uid == geteuid()) && (buf.st_gid == getegid()) && (!(buf.st_mode & 0022))) return TRUE; return(FALSE); } /* limiter functions * * This is for the bandwidth limiter * ************************************************************************/ LIMITER *limiter_new(int maxspeed) { LIMITER *new; struct timezone tz; new = mallocwrapper(sizeof(LIMITER)); new->maxspeed = maxspeed; new->bytes_transfered = 0; gettimeofday(&(new->current_time), &tz); return(new); } void limiter_add(LIMITER *l, int byte_count, int force) { int dif; struct timeval tv; struct timezone tz; l->bytes_transfered += byte_count; /* if at least 1 second of data is downloaded, assess the situation and determine how much time to wait */ if ((l->bytes_transfered >= l->maxspeed) || force) { gettimeofday(&tv, &tz); dif = (tv.tv_sec - l->current_time.tv_sec) * 1000 + (tv.tv_usec - l->current_time.tv_usec) / 1000; dif = (((1000 * l->bytes_transfered) / l->maxspeed) - dif) * 1000; /* if usleep takes too long, this will compensate by putting the expected time after usleep into l->current_time instead of reading the real time after an inaccurate usleep, allowing the transfer to catch up */ memcpy(&(l->current_time), &tv, sizeof(struct timeval)); l->current_time.tv_usec += (dif % 1000000); l->current_time.tv_sec += (dif / 1000000); if (dif > 0) usleep(dif); l->bytes_transfered = 0; } } /* giving up root code. this will use whatever capibilites * * possible to give up root access but still be able to bind to * * a low port (if possible) * ************************************************************************/ int giveuproot(uid_t uid, gid_t gid) { int error = FALSE; #ifdef HAVE_CAP_INIT cap_t currentset; #ifdef IRIX cap_value_t flags[] = { CAP_PRIV_PORT }; #else cap_value_t flags[] = { CAP_NET_BIND_SERVICE }; #endif #endif setregid(gid, gid); setreuid(uid, 0); #ifdef HAVE_CAP_INIT /* permit us to set the CAP_NET_BIND_SERVICE capibility after setuid */ currentset = cap_init(); cap_clear(currentset); cap_set_flag(currentset, CAP_PERMITTED, 1, flags, CAP_SET); if (cap_set_proc(currentset) == -1) error = TRUE; #endif /* now finish the switch */ setuid(uid); #ifdef HAVE_CAP_INIT /* set the CAP_NET_BIND_SERVICE (bind port < 1024) to the effective set */ cap_set_flag(currentset, CAP_EFFECTIVE, 1, flags, CAP_SET); if (cap_set_proc(currentset) == -1) error = TRUE; #endif return(error); } /* blocking signals * ************************************************************************/ void blockallsignals() { sigset_t sig_data; sigfillset(&sig_data); sigprocmask(SIG_BLOCK, &sig_data, NULL); } void unblockallsignals() { sigset_t sig_data; sigfillset(&sig_data); sigprocmask(SIG_UNBLOCK, &sig_data, NULL); } /* error routines * ************************************************************************/ /* Sends a message to the screen and then returns to the program */ void errormsg( char *errmessage, char *file, int line ) { if (inetd) syslog(LOG_ERR, PROGNAME" error in file %s line %d: %s", file, line, errmessage); else fprintf(stderr, PROGNAME" error in file %s line %d: %s\n", file, line, errmessage); } /* Sends a message to the screen and exits gracefully */ void errormsgfatal( char *errmessage, char *file, int line ) { errormsg( errmessage, file, line ); if (inetd) syslog(LOG_ERR, "muddleftpd is exiting\n"); else fprintf( stderr, "CANNOT RESUME. Goodbye\n"); /* Shutdown */ exit(1); } /* close file descriptors * ************************************************************************/ // try to close all non-terminal file descriptors. void fd_closeall_nonterminal(void) { int count, maxfilefd = 1024; #ifdef RLIMIT_NPROC struct rlimit lim; getrlimit(RLIMIT_NOFILE, &lim); maxfilefd = lim.rlim_max; #endif for (count = 3; count < maxfilefd; count++) close(count); } muddleftpd-1.3.13.1/src/version.c0100644000175000017500000000251407737077257015534 0ustar joergjoerg/* Copyright (C) 1999 Beau Kuiper This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "../defaults.h" #include void showversion(char *desc) { printf("%s: version ("VERSTR")\n", desc); printf("Build date: "DATESTR"\n\n"); printf(" Part of the Muddleftpd ftp server distribution\n"); printf(" Copyright (c) 2000 Beau Kuiper\n"); printf(" All rights reserved.\n\n"); printf(" Licensed under the terms of the GNU General Public License\n"); printf(" version 2 or later. See http://www.fsf.org/copyleft/gpl.html\n"); printf(" for a copy of this license\n\n"); printf(" For updates to muddleftpd, visit its homesite at:\n"); printf(" http://savannah.nongnu.org/projects/muddleftpd\n\n"); exit(1); } muddleftpd-1.3.13.1/tools/0040755000175000017500000000000007751444665014252 5ustar joergjoergmuddleftpd-1.3.13.1/tools/muddlestats.0.3.0/0040755000175000017500000000000007751444665017240 5ustar joergjoergmuddleftpd-1.3.13.1/tools/muddlestats.0.3.0/ChangeLog0100644000175000017500000000102407544536577021010 0ustar joergjoerg v0.1 Mon Apr 9 21:33:00 2001 - initial scratch release v0.2 Thu Apr 12 20:11:32 2001 - existed for one day - never released v0.3 Fri Apr 13 22:31:02 2001 - separated statfiles for dialup users 8) - new database format - domain and host stats added - now running muddlestats-gather twice on the same data file does not invalidate stats - just new lines are gathered - muddlestats-gather now interprets broken uploads and remembers login information between invocations - cleaned things up in muddlestats-gather muddleftpd-1.3.13.1/tools/muddlestats.0.3.0/INSTALL0100644000175000017500000000463507544536577020302 0ustar joergjoerg------------------------------------------------------------------------------ Extra Information on Installation (Beau Kuiper) =============================================== There are 2 executables in the muddlestats package that require configuration. - muddlestats-gather.py This application scans a muddleftpd log file, and updates a database file using any new data from the log. Run this first on the logfile when you update your statistics. You can run this on the same log file day after day. The header for this program contains the following variables. database - set this to the path and filename where the muddleftpd statistics database will be stored. muddle_log - set this to the path of the log file to scan. - muddlestats.pl This is a front end to the statistics package. It generates a series of detailed html pages using the information from the statistics database. The files are placed in a given directory to be served via webserver. The following variables need to be set in the program header. database - set this to the same statistics file you used in muddlestats-gather.py wwwroot - set this to a directory where the webserver can serve the files. It should be an empty directory so it can output files like index.html into it. mainfile - set this to whatever the webserver uses as the default file in a directory. fileprefix - all files (except mainfile specfieid above) created by muddlestats.pl will have this prefix. uploads_first - I have no idea what this does, I recommend just leaving it as is for now. bgcolor - sets the background colour for all pages generated. textcolor - sets the text colour for all pages generated. linkcolor - sets the link colour for all generated pages. tablecolor1 tablecolor2 tableheader - not sure what colours these set, play with them. chartbgcolor - the background colour for all generated charts. One way that muddleftpd statistics can be gathered are via logrotate.d. Included is an example logrotate.d file that shows how to do it. It can also be done via crontab if you don't rotate your logs usin logrotate. ------------------------------------------------------------------------------ Basic Installation ================== Not much for now. See the scripts' headers and the enclosed directory structures. Oh. And one more thing... this program won't run without the 'python' interpreter v1.5+ muddleftpd-1.3.13.1/tools/muddlestats.0.3.0/README0100644000175000017500000000017507544536577020124 0ustar joergjoerg Re all! This is an experimental scratch version of muddlestats - muddleftpd server logfile analyzer and report generator. muddleftpd-1.3.13.1/tools/muddlestats.0.3.0/TODO0100644000175000017500000000043407544536577017732 0ustar joergjoerghelp me out: mcree@freemail.hu Fri Apr 13 22:34:11 2001 muddlestats is just ugly inside 8) seriously; i'll have to rewrite and clean the source while i can remember the structures (the html generator overgrown my expectations and became very overspecialized...) muddleftpd-1.3.13.1/tools/muddlestats.0.3.0/muddleftpd.logrotate0100644000175000017500000000035507544536577023316 0ustar joergjoerg/var/log/muddleftpd.log { rotate 7 daily create 640 root adm compress prerotate /usr/bin/muddlestats-gather.py /usr/bin/muddlestats.py endscript postrotate /etc/init.d/muddleftpd reload >/dev/null endscript } muddleftpd-1.3.13.1/tools/muddlestats.0.3.0/muddlestats-gather.py0100755000175000017500000001301407544536577023416 0ustar joergjoerg#!/usr/bin/python #needs at least python 1.5 #*************************************************************************** # copyright : (C) 2001 by McRee * # email : mcree@freemail.hu * #*************************************************************************** #*************************************************************************** #* * #* This program is free software; you can redistribute it and/or modify * #* it under the terms of the GNU General Public License as published by * #* the Free Software Foundation; either version 2 of the License, or * #* (at your option) any later version. * #* * #*************************************************************************** database = "/var/local/muddlestats.db"; muddle_log = "/var/log/muddleftpd.log"; import re; import pprint; import cPickle; from zlib import compress, decompress; from time import *; #print "This is MuddleStats"; # lots of threads are simultaniously logging to the same logfile. we have to separate them by: re_thread_id = re.compile(r': [a-zA-Z0-9]+@[a-zA-Z0-9._-]+\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\)/[0-9]+ :'); # when the user logs out of a thread all loglist data is cleared for that thread re_logout = re.compile(r'User logged out'); # when the server exits, all loglist data for all threads is killed re_server_exit = re.compile(r'Info - Received SIG.*'); # unix timestamp - must find this in every row - or else: log syntax error re_timestamp = re.compile(r'[A-Z][a-z]{2} [A-Z][a-z]{2} [ 0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} [0-9]{4}'); # hostname(ipnumber) of a user re_host = re.compile(r'@[a-zA-Z0-9._-]+\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\)'); # username re_user = re.compile(r': [a-zA-Z0-9]+@'); # xxx bytes re_bytes = re.compile(r'[0-9]* bytes'); # transfers can be finished or aborted re_finish = re.compile(r'.* 226 Transfer done. [0-9]+ bytes transferred|.* 426 Transfer aborted. [0-9]+ bytes transferred'); # retrieve command re_retr = re.compile(r'^\+\+.*retrieve'); # store commands re_stor = re.compile(r'^\+\+.*store|^\+\+.*append'); loglist = {}; # must init dictionaries userlist = {};# ... oldstamp = ''; # must init timestamp def updatedb(s, mode = "RETR"): "updates userlist database form the given 's' logline using 'retr' or 'stor' modes" global userlist; # we need this global data # extract some data from the logline user = (re_user.search(s)).group()[2:-1]; bytes = (re_bytes.search(s)).group()[:-5]; ttime = strptime(re_timestamp.search(s).group()); host = (re_host.search(s)).group()[1:]; times = "%02d" % ttime[0] + "-%02d" % ttime[1] + "-%02d" % ttime[2]; # maintain database tree if not userlist.has_key(user): # if user does not exist userlist[user]={host: {}}; if not userlist[user].has_key(host): # if this the never connected from this host userlist[user][host]={times: {"RETR": 0, "STOR": 0}}; if not userlist[user][host].has_key(times): # if the user did not do anything 'today' userlist[user][host][times]={"RETR": 0, "STOR": 0}; # this is in fact the 'real' update: we increment the byte counter userlist[user][host][times][mode]=long(userlist[user][host][times][mode]) + long(bytes); # load database try: dbfile = open (database,"r"); s = dbfile.readline(); l = cPickle.loads(decompress(dbfile.read())); userlist = l[0]; loglist = l[1]; oldstamp = l[2]; dbfile.close(); except IOError: pass; # no panic if file not found log=open(muddle_log,"r"); # open logfile rows=1; s = log.readline(); while s != '': # read and analize all lines from logfile m = re_timestamp.search(s); if not m: # huh! print "Error in logfile at line "+str(rows)+":"; print s; print "Invalid FTPD logfile format! - Aborting MuddleStats\n"; raise IOError; timestamp=strptime(m.group()); m = re_server_exit.search(s); if m: # muddleftpd stopped. all users kicked loglist.clear(); m = re_thread_id.search(s); if m and timestamp>oldstamp: # if we read 'younger' data than the old stamp currt = m.group(); # get current thread if not loglist.has_key(currt): loglist[currt]={"RETRFLAG": 0,"STORFLAG": 0}; m = re_retr.search(s); if m: # we got 'retrieve' ss = m.group(); loglist[currt]["RETRFLAG"]=1; m = re_stor.search(s); if m: # we got 'store' ss = m.group(); loglist[currt]["STORFLAG"]=1; m = re_finish.search(s); if m and loglist[currt]["RETRFLAG"]==1: # we got 'transfer done' after 'retrieve' loglist[currt]["RETRFLAG"]=0; updatedb(s,"RETR"); elif m and loglist[currt]["STORFLAG"]==1: # we got 'transfer done' after 'store' loglist[currt]["STORFLAG"]=0; updatedb(s,"STOR"); m = re_logout.search(s); if m: # user logged out - drop thread del loglist[currt]; elif loglist[currt]["RETRFLAG"]==0 and loglist[currt]["STORFLAG"]==0: del loglist[currt]; # drop inactive tread s = log.readline(); rows = rows+1; #pprint.pprint(loglist); #pprint.pprint(userlist); log.close(); # save database dbfile = open (database,"w"); dbfile.writelines(["MuddleStats datafile v2 - DO NOT MODIFY\n"]); dbfile.write(compress(cPickle.dumps([userlist,loglist,timestamp]))); dbfile.close(); muddleftpd-1.3.13.1/tools/muddlestats.0.3.0/muddlestats.lsm0100644000175000017500000000063407544536577022312 0ustar joergjoergBegin3 Title: MuddleStats Version: 0.3 Entered-date: Description: Statistics gatherer and html stat generator for MuddleFTPD Keywords: stat ftpd html Author: McRee Maintained-by: McRee Primary-site: Home-page: http:// Original-site: Platforms: Linux and other Unices Copying-policy: GNU Public License End muddleftpd-1.3.13.1/tools/muddlestats.0.3.0/muddlestats.py0100755000175000017500000007305307544536577022157 0ustar joergjoerg#!/usr/bin/python #needs at least python 1.5 #*************************************************************************** # copyright : (C) 2001 by McRee * # email : mcree@freemail.hu * #*************************************************************************** #*************************************************************************** #* * #* This program is free software; you can redistribute it and/or modify * #* it under the terms of the GNU General Public License as published by * #* the Free Software Foundation; either version 2 of the License, or * #* (at your option) any later version. * #* * #*************************************************************************** #################################################################################################### # # GLOBALS - PLEASE EDIT THESE TO FIT YOUR SYSTEM # #################################################################################################### # database file database = "/var/local/muddlestats.db"; # directories change these wwwroot = "/var/www"; # must _NOT_ end with '/' targetdir = "/muddlestats/"; # must start _and_ end with '/' # stat files - these will be generated at 'wwwroot'+'targetdir' mainfile = "index.html"; fileprefix = "stats_"; # if uploads have higher priority during sorting uploads_first = 1; bgcolor = '#449999'; textcolor = '#000000'; linkcolor = '#333333'; tablecolor1 = '#dddd77'; tablecolor2 = '#dd9922'; tableheader = '#bb6600'; chartbgcolor = '#44bb99'; #################################################################################################### # # GLOBALS - FROM NOW ON DO NOT EDIT THE FILE UNLESS YOU KNOW WHAT YOU ARE DOING # #################################################################################################### import re; import pprint; import cPickle; from os import stat; from zlib import compress, decompress; from time import *; userlist = {}; # load database dbfile = open (database,"r"); oldstamp = dbfile.readline()[:-len('\n')]; l = cPickle.loads(decompress(dbfile.read())); userlist = l[0]; dbfile.close(); out = []; def head(): global out; global bgcolor, textcolor, linkcolor; out.append(""" MuddleFTPD Stats v0.3 """); out.append(''); def tail(): global out; out.append("""

Python Powered Page generated by MuddleStats written by Erno Rigo, 2001 Valid HTML 4.01!
"""); def psiz(bytes): # bytewise size prettyformatter if bytes == 0: return "nothing"; elif bytes < 1024: return "%d bytes" % bytes; elif bytes < 1024L**2: return "%.1f Kbytes" % (float(bytes)/1024); elif bytes < 1024L**3: return "%.1f Mbytes" % (float(bytes)/1024L**2); elif bytes < 1024L**4: return "%.1f Gbytes" % (float(bytes)/1024L**3); else: return "%.1f Tbytes" % (float(bytes)/1024L**4); # sometimes i'll use this one too for sure... at least i don't want to erase it 8) # ------------8<----------------------------------------------------------------------------------------------------------------------------------------------------------- #def pchart(caption, values, scale = range(1,1000)): # html table-chart builder - browser must support rowspan and bgcolor fields in the td tag! # print '
'; # print ''; # for x in values: # print ''; # print ''; # print ''; # for y in range(1,20): # print ''; # for x in values: # if 20-x==y: # print ''; # print ''; # l=0; # for x in values: # print ''; # print ''; # l=l+1; # print ''; # print '
'+caption+'
   
  
 
'+("%02d" % int(scale[l]))+'
 
' # ------------8<----------------------------------------------------------------------------------------------------------------------------------------------------------- def pdchart(values, caption='', scale = range(1,1000)): "html table-doublechart builder - browser must support rowspan and bgcolor fields in the td tag!" res=[]; res.append('
'); res.append(''); res.append(''); lo=0; for x in values: res.append(''); lo=lo+1; if lo%2==0: res.append(''); res.append(''); res.append(''); for y in range(1,20): res.append(''); lo=0; for x in values: lo=lo+1; if 20-x==y: if lo%2==1: res.append(''); else: res.append(''); res.append(''); l=0; lo=0; res.append(''); for x in values: lo=lo+1; if lo%2==1: res.append(''); res.append(''); l=l+1; res.append(''); res.append(''); res.append('
'+caption+'
 _ 
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
 
_  
  '+("%02d" % int(scale[l/2]))+'  
'); return res; #################################################################################################### # # MAIN PAGE # #################################################################################################### head(); out.append('
MuddleFTPD Server Statistics

'); out.append("
Database last updated: " + ctime(stat(database)[8]) + "

"); # calculate totals retr_total = 0; stor_total = 0; for user in userlist.keys(): for host in userlist[user].keys(): for times in userlist[user][host].keys(): retr_total = retr_total + long(userlist[user][host][times]["RETR"]); stor_total = stor_total + long(userlist[user][host][times]["STOR"]); out.append("
Total data downloaded: " + psiz(retr_total) + " , total data uploaded: " + psiz(stor_total) + "

"); # calculate record scope first_rec = '9999-99-99'; last_rec = '0000-00-00'; for user in userlist.keys(): for host in userlist[user].keys(): for times in userlist[user][host].keys(): if timeslast_rec: last_rec=times; out.append("
First record in database: " + first_rec + " , last record in database: " + last_rec + "
"); out.append("


"); out.append('
Detailed user statistics

'); out.append('
Detailed host summaries

'); out.append('
Detailed domain statistics

'); out.append("


"); #print last 30 days' statistics statlist=[]; for x in range(1,31): ttime = localtime(time()-(60*60*24*long(x))); times = "%02d" % ttime[0] + "-%02d" % ttime[1] + "-%02d" % ttime[2]; # print 'current date is ' + times + "
"; retr_total = 0; stor_total = 0; for user in userlist.keys(): for host in userlist[user].keys(): for timess in userlist[user][host].keys(): if timess==times: retr_total = retr_total + long(userlist[user][host][timess]["RETR"]); stor_total = stor_total + long(userlist[user][host][timess]["STOR"]); # print "retrieved: " + psiz(retr_total) + " stored: " + psiz(stor_total) + "
"; statlist.append(retr_total); statlist.append(stor_total); u=max(statlist); for x in range(0,len(statlist)/2-1): if statlist[x]!=0: statlist[x]=int((float(statlist[x])/u)*19); else: statlist[x]=0; out.extend(pdchart(statlist, 'Statistics for the last 30 days (Downloads/Uploads) [Full scale: 0 to ' + psiz(u) + ']' )); out.append("
"); #print last 12 months' statistics statlist=[]; for x in range(0,12): ttime = localtime(time()-(60*60*24*30*long(x))); times = "%02d" % ttime[0] + "-%02d" % ttime[1] + "-%02d" % ttime[2]; ttime = localtime(time()-(60*60*24*30*long(x+1))); times1 = "%02d" % ttime[0] + "-%02d" % ttime[1] + "-%02d" % ttime[2]; # print 'current date is ' + times + "
"; retr_total = 0; stor_total = 0; for user in userlist.keys(): for host in userlist[user].keys(): for timess in userlist[user][host].keys(): if timess>times1 and timess<=times: retr_total = retr_total + long(userlist[user][host][timess]["RETR"]); stor_total = stor_total + long(userlist[user][host][timess]["STOR"]); # print "retrieved: " + psiz(retr_total) + " stored: " + psiz(stor_total) + "
"; statlist.append(retr_total); statlist.append(stor_total); u=max(statlist); for x in range(0,len(statlist)/2-1): if statlist[x]!=0: statlist[x]=int((float(statlist[x])/u)*19); else: statlist[x]=0; out.extend(pdchart(statlist, 'Statistics for the last 12 months (Downloads/Uploads) [Full scale: 0 to ' + psiz(u) + ']', range(0,20) )); tail(); htmlfile = open (wwwroot+targetdir+mainfile,"w+"); htmlfile.writelines(out); htmlfile.close(); #################################################################################################### # # GLOBAL USER STATISTICS # #################################################################################################### out = []; head(); #calculate per user totals u_total = {}; userno = 0; for user in userlist.keys(): if not u_total.has_key(user): u_total[user]=[0,0,user]; userno=userno+1; for host in userlist[user].keys(): for times in userlist[user][host].keys(): if uploads_first: u_total[user] = [long(u_total[user][0]) + long(userlist[user][host][times]["STOR"]), long(u_total[user][1]) + long(userlist[user][host][times]["RETR"]), user]; else: u_total[user] = [long(u_total[user][0]) + long(userlist[user][host][times]["RETR"]), long(u_total[user][1]) + long(userlist[user][host][times]["STOR"]), user]; out.append('
MuddleFTPD Server Statistics - Per user total usage statistics

'); out.append('
Total users in database: '+str(userno)+'

'); out.append('

'); if uploads_first: out.append(''); else: out.append(''); t=u_total.values(); t.sort(); t.reverse(); l=0; for us in t: l=l+1; if l%2==1: out.append('"); else: out.append('"); out.append("
User
Uploaded
Downloaded
User
Downloaded
Uploaded
'+ us[2] +"
"+ psiz(us[0]) +"
"+ psiz(us[1]) +"
'+ us[2] +"
"+ psiz(us[0]) +"
"+ psiz(us[1]) +"

"); out.append('
Back to main page

'); tail(); htmlfile = open (wwwroot+targetdir+"userlist_"+mainfile,"w+"); htmlfile.writelines(out); htmlfile.close(); #################################################################################################### # # GLOBAL HOST STATISTICS # #################################################################################################### out = []; head(); #calculate per user totals u_total = {}; userno=0; for user in userlist.keys(): for host in userlist[user].keys(): if not u_total.has_key(host): u_total[host]=[0,0,host]; userno=userno+1; for times in userlist[user][host].keys(): if uploads_first: u_total[host] = [long(u_total[host][0]) + long(userlist[user][host][times]["STOR"]), long(u_total[host][1]) + long(userlist[user][host][times]["RETR"]), host]; else: u_total[host] = [long(u_total[host][0]) + long(userlist[user][host][times]["RETR"]), long(u_total[host][1]) + long(userlist[user][host][times]["STOR"]), host]; out.append('
MuddleFTPD Server Statistics - Per host total usage statistics

'); out.append('
Total hosts in database: '+str(userno)+'

'); out.append('

'); if uploads_first: out.append(''); else: out.append(''); t=u_total.values(); t.sort(); t.reverse(); l=0; for us in t: l=l+1; if l%2==1: out.append('"); else: out.append('"); out.append("
Host
Uploaded
Downloaded
Host
Downloaded
Uploaded
'+ us[2] +"
"+ psiz(us[0]) +"
"+ psiz(us[1]) +"
'+ us[2] +"
"+ psiz(us[0]) +"
"+ psiz(us[1]) +"

"); out.append('
Back to main page

'); tail(); htmlfile = open (wwwroot+targetdir+"hostlist_"+mainfile,"w+"); htmlfile.writelines(out); htmlfile.close(); #################################################################################################### # # LEVEL 1-3 DOMAIN STATISTICS # #################################################################################################### # # LEVEL 1 DOMAIN STATISTICS # out = []; head(); re_domain = re.compile(r'[.][a-zA-Z0-9_-]+\('); re_baddomain = re.compile(r'[.][0-9]+\('); #calculate per domain totals u_total = {}; userno=0; for user in userlist.keys(): for host in userlist[user].keys(): m = re_domain.search(host); if m: mm = re_baddomain.search(m.group()); if mm: domain='other'; # print host; else: domain=m.group()[0:-1]; else: domain='other'; # print host; if not u_total.has_key(domain): u_total[domain]=[0,0,domain]; userno=userno+1; for times in userlist[user][host].keys(): if uploads_first: u_total[domain] = [long(u_total[domain][0]) + long(userlist[user][host][times]["STOR"]), long(u_total[domain][1]) + long(userlist[user][host][times]["RETR"]), domain]; else: u_total[domain] = [long(u_total[domain][0]) + long(userlist[user][host][times]["RETR"]), long(u_total[domain][1]) + long(userlist[user][host][times]["STOR"]), domain]; out.append('
MuddleFTPD Server Statistics - Per level 1 domain total usage statistics

'); out.append('
Total domains in this section: '+str(userno)+'

'); out.append('

'); if uploads_first: out.append(''); else: out.append(''); t=u_total.values(); t.sort(); t.reverse(); l=0; for us in t: l=l+1; if l%2==1: out.append('"); else: out.append('"); out.append("
Domain
Uploaded
Downloaded
Domain
Downloaded
Uploaded
'+ us[2] +"
"+ psiz(us[0]) +"
"+ psiz(us[1]) +"
'+ us[2] +"
"+ psiz(us[0]) +"
"+ psiz(us[1]) +"

"); out.append('
Back to main page

'); tail(); htmlfile = open (wwwroot+targetdir+"domainlist_"+mainfile,"w+"); htmlfile.writelines(out); htmlfile.close(); # # LEVEL 2 DOMAIN STATISTICS # domainlist = t; t=[]; #pprint.pprint(domainlist); re_upperdomain = re.compile(r'[.][a-zA-Z0-9_-]+\('); re_upperbaddomain = re.compile(r'[.][0-9]+\('); re_domain = re.compile(r'[.][a-zA-Z0-9_-]+[.][a-zA-Z0-9_-]+\('); #calculate per domain totals for c_domain in domainlist: curr_domain=c_domain[2]; re_curr_upperdomain = re.compile(r''+curr_domain+'\('); u_total = {}; userno=0; for user in userlist.keys(): for host in userlist[user].keys(): m = re_curr_upperdomain.search(host); if m: upperdomain=curr_domain; mm = re_domain.search(host); if mm: domain=mm.group()[0:-1]; else: m = re_upperdomain.search(host); if m: mm = re_upperbaddomain.search(host); if mm: upperdomain='other'; domain=host; else: upperdomain=m.group()[0:-1]; else: upperdomain='other'; domain=host; if upperdomain==curr_domain: if not u_total.has_key(domain): u_total[domain]=[0,0,domain]; userno=userno+1; for times in userlist[user][host].keys(): if uploads_first: u_total[domain] = [long(u_total[domain][0]) + long(userlist[user][host][times]["STOR"]), long(u_total[domain][1]) + long(userlist[user][host][times]["RETR"]), domain]; else: u_total[domain] = [long(u_total[domain][0]) + long(userlist[user][host][times]["RETR"]), long(u_total[domain][1]) + long(userlist[user][host][times]["STOR"]), domain]; out = []; head(); out.append('
MuddleFTPD Server Statistics - total usage statistics for the '+curr_domain+' domains

'); out.append('
Total domains in this section: '+str(userno)+'

'); #print last 30 days' statistics statlist=[]; for x in range(1,31): ttime = localtime(time()-(60*60*24*long(x))); times = "%02d" % ttime[0] + "-%02d" % ttime[1] + "-%02d" % ttime[2]; retr_total = 0; stor_total = 0; for user in userlist.keys(): for host in userlist[user].keys(): m = re_curr_upperdomain.search(host); if m: upperdomain=curr_domain; mm = re_domain.search(host); if mm: domain=mm.group()[0:-1]; else: m = re_upperdomain.search(host); if m: mm = re_upperbaddomain.search(host); if mm: upperdomain='other'; domain=host; else: upperdomain=m.group()[0:-1]; else: upperdomain='other'; domain=host; if upperdomain==curr_domain: for timess in userlist[user][host].keys(): if timess==times: retr_total = retr_total + long(userlist[user][host][times]["RETR"]); stor_total = stor_total + long(userlist[user][host][times]["STOR"]); statlist.append(retr_total); statlist.append(stor_total); u=max(statlist); for x in range(0,len(statlist)/2-1): if statlist[x]!=0: statlist[x]=int((float(statlist[x])/u)*19); else: statlist[x]=0; out.extend(pdchart(statlist, 'Statistics for the previous 30 days (Downloads/Uploads) [Full scale: 0 to ' + psiz(u) + ']' )); out.append("
"); #print last 12 months' statistics statlist=[]; for x in range(0,12): ttime = localtime(time()-(60*60*24*30*long(x))); times = "%02d" % ttime[0] + "-%02d" % ttime[1] + "-%02d" % ttime[2]; ttime = localtime(time()-(60*60*24*30*long(x+1))); times1 = "%02d" % ttime[0] + "-%02d" % ttime[1] + "-%02d" % ttime[2]; retr_total = 0; stor_total = 0; for user in userlist.keys(): for host in userlist[user].keys(): m = re_curr_upperdomain.search(host); if m: upperdomain=curr_domain; mm = re_domain.search(host); if mm: domain=mm.group()[0:-1]; else: m = re_upperdomain.search(host); if m: mm = re_upperbaddomain.search(host); if mm: upperdomain='other'; domain=host; else: upperdomain=m.group()[0:-1]; else: upperdomain='other'; domain=host; if upperdomain==curr_domain: for timess in userlist[user][host].keys(): if timess>times1 and timess<=times: retr_total = retr_total + long(userlist[user][host][timess]["RETR"]); stor_total = stor_total + long(userlist[user][host][timess]["STOR"]); statlist.append(retr_total); statlist.append(stor_total); u=max(statlist); for x in range(0,len(statlist)/2-1): if statlist[x]!=0: statlist[x]=int((float(statlist[x])/u)*19); else: statlist[x]=0; out.extend(pdchart(statlist, 'Statistics for the last 12 months (Downloads/Uploads) [Full scale: 0 to ' + psiz(u) + ']' ,range(0,20))); out.append("
"); out.append('

'); if uploads_first: out.append(''); else: out.append(''); t=u_total.values(); t.sort(); t.reverse(); l=0; for us in t: l=l+1; if l%2==1: out.append('"); else: out.append('"); out.append("
Domain
Uploaded
Downloaded
Domain
Downloaded
Uploaded
'+ us[2] +"
"+ psiz(us[0]) +"
"+ psiz(us[1]) +"
'+ us[2] +"
"+ psiz(us[0]) +"
"+ psiz(us[1]) +"

"); out.append('
Back to main page

'); tail(); htmlfile = open (wwwroot+targetdir+fileprefix+"domainlist_"+curr_domain+'.html',"w+"); htmlfile.writelines(out); htmlfile.close(); #################################################################################################### # # PER USER DETAILED STATISTICS # #################################################################################################### #per user detailed statistics l=0; for user in userlist.keys(): out = []; head(); out.append('
'); out.append(''); #last activity and totals lastlogin="0000-00-00"; uretr_total = 0; ustor_total = 0; for host in userlist[user].keys(): for times in userlist[user][host].keys(): if times>lastlogin: lastlogin=times; uretr_total = uretr_total + long(userlist[user][host][times]["RETR"]); ustor_total = ustor_total + long(userlist[user][host][times]["STOR"]); out.append(''); out.append(''); #favourite hosts out.append(''); out.append(''); # 30 days' usage out.append(''); out.append(''); out.append("
Statistics for user '+user+'back
Total downloaded: '+psiz(uretr_total)+' Total uploaded: '+psiz(ustor_total)+'
Last logged activity time: '+lastlogin+'
Favourite host(s):
'); for host in userlist[user].keys(): out.append(''); out.append('
'+host+' [last use: '+max(userlist[user][host].keys())+']
Activity during the previous 30 days:
'); out.append(''); out.append(""); statlist=[]; for x in range(1,31): ttime = localtime(time()-(60*60*24*long(x))); times = "%02d" % ttime[0] + "-%02d" % ttime[1] + "-%02d" % ttime[2]; for host in userlist[user].keys(): retr_total = 0; stor_total = 0; for timess in userlist[user][host].keys(): if timess==times: retr_total = retr_total + long(userlist[user][host][times]["RETR"]); stor_total = stor_total + long(userlist[user][host][times]["STOR"]); if retr_total>0 or stor_total>0: out.append(""); out.append('
Timefrom hostDownloadsUploads
"+times+"["+host+"]" + psiz(retr_total) + "" + psiz(stor_total) + "

"); #print last 30 days' statistics statlist=[]; for x in range(1,31): ttime = localtime(time()-(60*60*24*long(x))); times = "%02d" % ttime[0] + "-%02d" % ttime[1] + "-%02d" % ttime[2]; retr_total = 0; stor_total = 0; for host in userlist[user].keys(): for timess in userlist[user][host].keys(): if timess==times: retr_total = retr_total + long(userlist[user][host][times]["RETR"]); stor_total = stor_total + long(userlist[user][host][times]["STOR"]); statlist.append(retr_total); statlist.append(stor_total); u=max(statlist); for x in range(0,len(statlist)/2-1): if statlist[x]!=0: statlist[x]=int((float(statlist[x])/u)*19); else: statlist[x]=0; out.extend(pdchart(statlist, 'Statistics for the previous 30 days (Downloads/Uploads) [Full scale: 0 to ' + psiz(u) + ']' )); out.append("
"); #print last 12 months' statistics statlist=[]; for x in range(0,12): ttime = localtime(time()-(60*60*24*30*long(x))); times = "%02d" % ttime[0] + "-%02d" % ttime[1] + "-%02d" % ttime[2]; ttime = localtime(time()-(60*60*24*30*long(x+1))); times1 = "%02d" % ttime[0] + "-%02d" % ttime[1] + "-%02d" % ttime[2]; retr_total = 0; stor_total = 0; # for user in userlist.keys(): for host in userlist[user].keys(): for timess in userlist[user][host].keys(): if timess>times1 and timess<=times: retr_total = retr_total + long(userlist[user][host][timess]["RETR"]); stor_total = stor_total + long(userlist[user][host][timess]["STOR"]); statlist.append(retr_total); statlist.append(stor_total); u=max(statlist); for x in range(0,len(statlist)/2-1): if statlist[x]!=0: statlist[x]=int((float(statlist[x])/u)*19); else: statlist[x]=0; out.extend(pdchart(statlist, 'Statistics for the last 12 months (Downloads/Uploads) [Full scale: 0 to ' + psiz(u) + ']', range(0,20) )); tail(); htmlfile = open (wwwroot+targetdir+fileprefix+'user_'+user+'.html',"w+"); htmlfile.writelines(out); htmlfile.close(); muddleftpd-1.3.13.1/AUTHORS0100644000175000017500000000225607554546351014160 0ustar joergjoergList of people and their tasks working (now and in the past) on Muddleftpd. Beau Kuiper (kuiperba@cs.curtin.edu.au) Original Author. Coordinator for MAIN branch in CVS. Project Admin Module Author for: auth/example auth/msql auth/mysql auth/mud auth/smb Joerg Jaspert (joerg@debian.org) Debian maintainer. Project Admin. Coordinates Releases, maintains Mailinglists and Freshmeat entries. Jones Oberg (jonas@coyote.org) Wrote Texinfo Documenatation and man pages Doug Lea (dl@cs.oswego.edu) Wrote Malloc Library used in Muddleftpd. McRee (mcree@freemail.hu) Wrote the MuddleStats package, now in tools/muddlestats.0.3.0 Tomas Ogren (stric@ing.umu.se) Mike Javorski (mikej@carmelfly.com) Bugfixes and small changes. Jose Roberto Fernandes (jrfndes@genius.bc-ip.com.br) help on 64-bit systems Decklin Foster (decklin@read-bean.com) Former Maintainer of Debian Package. Bugfixes and small changes. Sergiusz Pawlowicz (ser@metalab.unc.edu) Former Mailinglist maintainer. Kevin Golding (kevin@caomhin.demon.co.uk) Maintains Muddleftpd Webpage. I appoligise if I have left anyone out. muddleftpd-1.3.13.1/COPYING0100644000175000017500000004310707544536576014152 0ustar joergjoerg GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. muddleftpd-1.3.13.1/ChangeLog0100644000175000017500000002325507751444024014655 0ustar joergjoerg2003-11-03 Joerg Jaspert * modules/auth: authlibexample/Makefile.in, authlibmud/Makefile.in, authlibsmb/Makefile.in, authlibmysql/Makefile.in, authlibmsql/Makefile.in: Added -fPIC so it actually compiles on different platforms. 2003-11-02 Joerg Jaspert * configure.ac, modules/auth/authlibmysql/configure.ac: Changed way we look for mysql. Thats easier for users now. * modules/auth/: authlibmsql/auth.h, authlibmysql/auth.h, authlibsmb/auth.h, authlibmud/auth.h, authlibexample/auth.h: Changed include from varargs.h to stdarg.h as gcc no longer includes varargs.h * modules/auth/: authlibmsql/README, authlibmysql/README, authlibsmb/README, authlibmud/README, authlibexample/README: Changed documentation to be in sync with new configure/makefile things. * modules/auth: authlibmsql/Makefile.in, authlibmysql/Makefile.in, authlibexample/Makefile.in, authlibsmb/Makefile.in, authlibmud/Makefile.in: Change Install Target from TODO to something useful. Install the autlibfile in libdir/muddleftpd set by configure run. Also install the READMEs as README.auth$MODULE in the documentation dir (see below). * doc/Makefile.in: Added things to install txt documentation in prefix/share/doc/muddleftpd/* 2003-11-02 Beau Kuiper * src/ftpd.h: removed headers for string.h since they are in string.h. Updated prototype for safe_vsnprintf(). * src/string.c: fixed double use of varargs in string_catvprintf(). This fixed muddleftpd problems on PPC and possibly other archs. * src/string.h: updated prototype for string_catvprintf() * src/ftpout.c: modified ftp_write to use fixed string_catvprintf() * src/logger.c: modified debuglog() to use fixed safe_vsnprint() * src/utils.c: fixed possible double use of varargs in safe_vsnprintf() Fixed safe_snprintf() so it does not use safe_vsnprintf() to prevent performance degredation due to new design. * Configure.ac: Added a check for stdarg.h, since the replacement snprintf code needs it. 2003-04-15 Beau Kuiper * src/main.c: mainprog(): added code to close all file descriptors. After the server is started, it will also close the terminal file desciptors, so ssh sessions are not stalled at logout. * src/utils.c: fd_closeall_nonterminal(): determines the max file descriptors number and attempts to close all open fds. The terminal file descriptors are left untouched. 2002-11-20 Beau Kuiper * src/acl.c: transfer_config(): Added code that allows the server to retrieve the gid a user will operate as from the password file. Just put "!" in front of the gid parameter. (eg gid !anuser) will give the user the gid of the user anuser. 2002-10-29 Beau Kuiper * src/string.c: string_filterbadchars(): Added code to only allow /r and /n characters if and only if they are together as a TELNET newline (/r/n). This fixes the bug of muddleftpd accepting input with those characters in it and then mucking the log files up with it. * src/logger.c: Removed code that replaces /r and /n with spaces. It doesn't need it anymore, since I have cured the original bug. 2002-10-21 Joerg Jaspert * modules/auth/authlibexample/COPYING: Added back. This license is different (a public domain one) and not GPL as I blindly assumed from the name. Sorry Beau. 2002-10-20 Joerg Jaspert * NEWS: Added. Contains summaries of changes between releases. * CHANGES: Removed, that is now in NEWS. * modules/auth/: authlibmsql/README, authlibmysql/README, authlibsmb/README: No need to mention that it depends on muddleftpd. Of course it does, it is distributed with it. :) * tools/muddlestats.0.3.0/: AUTHORS, COPYING: Removed. AUTHORS integrated into the main AUTHORS, license is the same as Muddleftpd, GPL. * AUTHORS: Rewrote so it reflects current state of the Art. * modules/auth/: authlibmysql/AUTHORS, authlibmysql/COPYING, authlibsmb/AUTHORS, authlibsmb/COPYING, authlibexample/AUTHORS, authlibexample/COPYING, authlibmsql/AUTHORS, authlibmsql/COPYING, authlibmud/AUTHORS, authlibmud/COPYING: Removed. Authors is now integrated into the main AUTHORS file and license is same as Muddleftpd. 2002-10-20 Joerg Jaspert * Developer.txt: Added Section about Changelogs/Commit Messages. Changed (C) for new Files to be for the Muddleftpd team. 2002-10-20 Beau Kuiper * modules/auth/: authlibexample/AUTHORS, authlibexample/CHANGES, authlibexample/COPYING, authlibexample/Makefile.in, authlibexample/README, authlibexample/auth.h, authlibexample/authunix.c, authlibexample/configure.ac, authlibmsql/AUTHORS, authlibmsql/CHANGES, authlibmsql/COPYING, authlibmsql/Makefile.in, authlibmsql/README, authlibmsql/auth.h, authlibmsql/authmsql.c, authlibmsql/configure.ac, authlibmud/AUTHORS, authlibmud/CHANGES, authlibmud/COPYING, authlibmud/Makefile.in, authlibmud/README, authlibmud/auth.h, authlibmud/authmud.c, authlibmud/configure.ac, authlibmysql/AUTHORS, authlibmysql/CHANGES, authlibmysql/COPYING, authlibmysql/Makefile.in, authlibmysql/README, authlibmysql/auth.h, authlibmysql/authmysql.c, authlibmysql/configure.ac, authlibsmb/AUTHORS, authlibsmb/CHANGES, authlibsmb/COPYING, authlibsmb/Makefile.in, authlibsmb/README, authlibsmb/auth.h, authlibsmb/authsmb.c, authlibsmb/configure.ac, authlibsmb/valid.h, authlibsmb/smbval/Makefile.in, authlibsmb/smbval/byteorder.h, authlibsmb/smbval/md4.c, authlibsmb/smbval/rfcnb-common.h, authlibsmb/smbval/rfcnb-error.h, authlibsmb/smbval/rfcnb-io.c, authlibsmb/smbval/rfcnb-io.h, authlibsmb/smbval/rfcnb-priv.h, authlibsmb/smbval/rfcnb-util.c, authlibsmb/smbval/rfcnb-util.h, authlibsmb/smbval/rfcnb.h, authlibsmb/smbval/session.c, authlibsmb/smbval/smbdes.c, authlibsmb/smbval/smbencrypt.c, authlibsmb/smbval/smblib-common.h, authlibsmb/smbval/smblib-priv.h, authlibsmb/smbval/smblib-util.c, authlibsmb/smbval/smblib.c, authlibsmb/smbval/smblib.h, authlibsmb/smbval/std-defines.h, authlibsmb/smbval/std-includes.h, authlibsmb/smbval/valid.c, authlibsmb/smbval/valid.h: Finally added module code into CVS 2002-10-20 Beau Kuiper * Makefile.in, autogen.sh, configure.ac, defaults.h, defaults.h.in, install-sh: Imported authentication modules into build system. Install does not work properly for modules, and there are still some more tweaks to do 2002-10-20 Joerg Jaspert * Developer.txt: Added suggestions from Beau 2002-10-19 Joerg Jaspert * Developer.txt: First version of Guidelines for People working on Muddleftpd 2002-10-17 Beau Kuiper * Makefile.in, config.h.in, src/version.c: updated to autoconf 2.54 2002-10-17 Beau Kuiper * Makefile.in, configure, configure.ac, configure.in: updated to autoconf 2.54 2002-10-16 Beau Kuiper * src/logger.c: Logger patch was broken Character constants are in ', not in " And character 20 is not a space, while 0x20 is 2002-09-28 Joerg Jaspert * src/util/seteguid.c~: Well, it exists in the original tarball, but its a backup file -> delete it :) 2002-09-28 Joerg Jaspert * src/util/: pwgrent.c, seteguid.c, seteguid.c~, snprintf.c, strerror.c, strerror.h: Uhh, looks like i missed to add them into CVS 2002-09-26 Joerg Jaspert * defaults.h: Ok, devel version is odd, stable is even. 2002-09-26 Joerg Jaspert * defaults.h: This is now 1.3.12 and no longer 1.3.11-devel 2002-09-26 Joerg Jaspert * src/logger.c: Remove \r and \n before output to logfile 2002-09-26 Joerg Jaspert * AUTHORS: Changed debian maintainer 2002-09-26 Joerg Jaspert * AUTHORS, CHANGES, COPYING, INSTALL, Makefile.defs, Makefile.in, README, TESTING, TODO, config.h.in, configure, configure.in, defaults.h, doc/Makefile.in, doc/cookie.txt, doc/ftpcmds.txt, doc/muddleftpd.txt, doc/mudlogd.txt, doc/mudpasswd.txt, doc/reference.txt, doc/info/muddleftpd.info, doc/info/muddleftpd.texi, doc/man/ftpwho.1, doc/man/muddleftpd.1, doc/man/mudpasswd.1, examples/README, examples/anon-only.conf, examples/anon-reigon.conf, examples/mudlogd.conf, examples/ratios.conf, examples/standard.conf, examples/vserver-host.conf, examples/vserver.conf, examples/vserverbig.conf, src/Makefile.in, src/acl.c, src/acl.h, src/auth.c, src/auth.h, src/authanon.c, src/authdisable.c, src/authint.c, src/authpam.c, src/authunix.c, src/bufread.c, src/cfloader.c, src/checkip.c, src/cmd.c, src/config.c, src/configfile.h, src/datasock.c, src/dir.c, src/file.c, src/ftp.c, src/ftpcmd.h, src/ftpd.h, src/ftplist.c, src/ftpout.c, src/ftpsite.c, src/ftpstat.c, src/ftpstate.c, src/ftptrans.c, src/ftpwho.c, src/init.c, src/logger.c, src/main.c, src/malloc.c, src/mudlogd.c, src/mudpasswd.c, src/myglob.c, src/myglob.h, src/newfile.c, src/pnums.h, src/procnum.c, src/proxy.c, src/ratio.c, src/ratio.h, src/ratiotool.c, src/reply.h, src/select.c, src/shmem.c, src/socket.c, src/string.c, src/string.h, src/tokset.h, src/utils.c, src/version.c, tools/muddlestats.0.3.0/AUTHORS, tools/muddlestats.0.3.0/COPYING, tools/muddlestats.0.3.0/INSTALL, tools/muddlestats.0.3.0/README, tools/muddlestats.0.3.0/TODO, tools/muddlestats.0.3.0/muddleftpd.logrotate, tools/muddlestats.0.3.0/muddlestats-gather.py, tools/muddlestats.0.3.0/muddlestats.lsm, tools/muddlestats.0.3.0/muddlestats.py: Imported muddleftpd Copyright (C) 2002 Muddleftpd Team, http://www.nongnu.org/muddleftpd/ Copying and distribution of this file, with or without modification, are permitted provided the copyright notice and this notice are preserved. muddleftpd-1.3.13.1/Developer.txt0100644000175000017500000002632707554542650015601 0ustar joergjoergMuddleftpd Developer Guidelines This is: $Revision: 1.3 $. [Note before: That text is assembled from different other guidelines I read and some talks I had with other people.] Contents 1.0 Copyright issues 1.1 Preface 1.2 CVS Branches 1.3 Muddleftpd Releases 1.4 Security Updates, Important Bugfixes 1.5 ChangeLog Entries and CVS commit messages (log messages) 1.6 Code Submission if you are not a developer of Muddleftpd 1.7 How to become a developer 1.0 Copyright issues Muddleftpd is developed under the GNU GPL license. Every code you write/add to Muddleftpd has to be under the same license. Every source file has to include the following lines at the top of the file (you may change the comment style if needed): /* FILENAME SHORT DESCRIPTION OF THE FILE Copyright (C) 2002 Muddleftpd Team, http://www.nongnu.org/muddleftpd/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 1.1 Preface So that we can all work together in the most productive way, all developers working on the code in CVS should follow the following guidelines. - You break it, you fix it. If you break something that was working before you checked in your code, it's your responsebility to get it working again. If you ask the other developers real nicely, maybe they'll help you, but it is your responsability. - Try to keep all your changes limited to the specific area you are working on. - Peoples interests change. Workloads change. So if you have code for a task you are working on that is an improvement on what is in CVS already, feel good about checking it in. If it doesnt break anything, and adds/fixes something, it's a good thing to add to the repository. If you're working on something complex, and you want something committed as an intermediate step, then it might be okay to commit what you have. But try not to commit anything that is completely broken. At minimum, check in something that is partially working, with clear comments about "this isnt working yet, but this is what I'm in the process of doing to get there". - Write good cvs commit messages. Not just "modified" or blank lines. It will be used for the ChangeLog, so it should really show what you have done. A URL with good hints for ChangeLog entries is http://www.red-bean.com/cvs2cl/changelogs.html If you follow that as close as possible for your commit message everything is fine. 1.2 CVS Branches The Muddleftpd CVS repository has one primary tree, called MAIN. They can be 0 to many branches used for quality control and developing new features. Note: All branch identifiers and tag names starting with release_ are reserved and only used to indicate different release versions. MAIN This tree is under full control of Beau Kuiper. If you want to change things here you have to get his OK first. That is to ensure the quality and security of muddleftpd because all code added here has to be fully reviewed. This tree will be branched to create new releases and everyone that commits here (after the OK) has to make sure HE DOESNT BREAK IT. release_* These branches are under control of Joerg Jaspert. He is the only one who makes new releases. * is replaced with some information, see 1.3 below. Such a branch is the place to fix bugs in a released version. See below for more about that. dev_NICK_feature Every developer is allowed to create a branch within the repository. Just replace NICK with the nick you have on Savannah and feature with the feature you want to develop in that branch. That way everyone knows whats going on with a particular branch. He is then fully responsible for that branch, so if you want to work on anothers developers branch talk to him first. Developers can use that to work on new features/enhancements without breaking the MAIN tree of muddleftpd and without the rules that are for that tree. Example: If you want to work on IPV6 support you create a branch called something like 'ipv6' and do your work in it. Every then and now you look at MAIN if there are interesting changes and merge them into your branch if you like them. After a while you are finished and at the point where you can say "Yes, its stable and good enough for MAIN". Then you "freeze" this tree, eg. stop working on it and telling all other that its frozen and coordinate with Beau to get it merged into MAIN. Then you only commit things into that branch that are needed to get it accepted into MAIN, and after all things are sorted out you and Beau merge it into MAIN. Voila, a new feature is there without breaking of our MAIN line. :) If you ever create a branch and find out later that you dont need it, you can remove that branch from the repository. The project admins are allowed to do that for dead branches that arent used for longer then 2 months to keep the repository clean. But please never remove a branch that has development work in it, even if it is not used at the moment or looks like it never will again. It may contain important source changes/ ways to solve a problem we can use at a later time. 1.3 Muddleftpd Releases A new version of Muddleftpd is released after it is finished. There is no general timeframe like "every 2 month". Release states: Development Development of Muddleftpd is ongoing. The work is done in MAIN (see above) and in developer-created branches. You can add as many new features as you want (see notes for MAIN above). Frozen From time to time Joerg will create a new Branch in the CVS repository called release_X_Y_Z. X_Y_Z is replaced with the version number of the upcoming release with the following schema: X - "Big" Major. If changed then new features in Muddleftpd may break existing setups. Y - Major. Changed for new features. Doesnt break old setups. Z - Minor. Indicates bugfix releases and enhancments to existing features. No addition of new things. Sometimes there maybe a fourth part of the version number. That is done for security or important releases of an existing release. See 1.4 NO new features or enhancements are added to such a branch! Released. After creation of the release_X_Y_Z branch the code in there is heavily tested and reviewed by the developers, commiting their changes to that branch, so we get it as bugfree as possible. Again: NO new features/enhancments are added, only bugs fixed. If we get to the conclusion that we have done every possible thing to ensure this, a new Release gets out and the work on this branch is stopped. Get back to MAIN and your own branches now and add new cool things guys :) 1.4 Security Updates, Important Bugfixes It may happen that a released version of Muddleftpd has a important or a security bug. Thats bad, but we are all humans, it can happen. For our last official release we will follow the following procedure: We will fix that error in the release_* branch of the last release. We will NOT add any features or anything else to that tree, just fix that bug and get a new stable release out. That will be numbered the same as our last release with an added .X to the version number that indicates that its changed. eg. a Bugfix to 1.2.9 will be 1.2.9.1, a (maybe) second bugfix then 1.2.9.2 and so on. That way we dont have to push out a new release if we dont think it is finished yet (hey, we aim to produce a secure ftp daemon, that needs time) but still can react quickly on such bugs. 1.5 ChangeLog Entries and CVS commit messages (log messages) First please take a look at the following URL. The text there is really good, you should follow it as close as possible: http://www.red-bean.com/cvs2cl/changelogs.html We require that you follow these guidelines while creating your ChangeLog entry. Reasons are listed there too, mainly to have a clear log of changes that are done to the source. Talking about messages for cvs commit: You can just re-use the logmessage from the ChangeLog for the commit message (Emacs CVS Mode does it for you if you use that), thats fine. But if you write them by Hand it is enough if you write a clear sentence (or many of them) describing your changes to the file(s) you commit. For details everyone could look into the ChangeLog. But NEVER commit with an empty Message or just a "changed". That way everyone can follow the changes you made with the cvs log output and can look into the ChangeLog file for a detailed description of the changes. 1.6 Code Submission if you are not a developer of Muddleftpd When you fix a bug or add a feature, you must submit a unified patch (see below for instructions for creating the patch) to the Patch Manager on Savannah, and also announce it on the mailing list (do not send the patch to the list, just send a short announcement). You must NOT submit the entire changed file, nor just the changed lines of code. If you submit something other than a patch created using the instructions below, you will be asked politely to resubmit your changes as a patch. Your code will not be merged until you do. Note: If your patch is around twice the size of the file you're patching, something went wrong. DO NOT submit that patch. If you edited the file on a non-unix system, and transferred it to a unix system to run diff on it, you need to make sure the end-of-line characters are the unix kind. Ask on the mailing list if you have this problem. Example: To create a unified patch suitable for submission, have both your modified source tree and the original source tree avaliable. Prepare both trees for comparison by running the following (on both trees): bash$ ./configure bash$ make maintainer-clean Now compare the two trees using the following command: bash$ diff -r -u3 [path to original tree] [path to modified tree] > patchfile Patchfile will now contain your patch and you can submit it. Be sure that you don't mix the original and modified tree paths up, otherwise your patch will end up backwards. Note: if you need to use your tree again after creating the patch, simply run ./autogen.sh in the source tree. This will automaticly regenerate all the configure scripts. 1.7 How to become a developer Well, thats not that hard. Of course we require a little knowledge, so you have to prove you can do the work you say you want to do. If you want to work on muddleftpd's source you need to do that before you get access. Just write some enhancement/new feature to muddleftpd (look at the task list for ideas what can be done). You do that with the latest copy of the CVS Source. Then use diff -u or cvs diff -u to create a patch and submit that at the Savannah project. If you want to work on the documentation or website part it is mainly the same: Show us that you are able to do this and you can get your access. muddleftpd-1.3.13.1/INSTALL0100644000175000017500000000012107544536576014135 0ustar joergjoergINSTALLING MUDDLEFTPD: See doc/muddleftpd.txt CONFIGURING: See doc/config.txt muddleftpd-1.3.13.1/Makefile.defs0100644000175000017500000000177407544536576015503 0ustar joergjoerg# Copyright (C) 1999 Beau Kuiper # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ # **** THINGS YOU CAN CHANGE! # Use the new malloc implementation. Disable to use the system malloc NEWMALLOC = 1 # Build a debug version. Don't use for production #DEBUG = 1 # Destination filenames MUDOUTPROG = muddleftpd WHOPROG = ftpwho MUDPASSWDPROG = mudpasswd RATIOTOOLPROG = ratiotool MUDLOGD = mudlogd muddleftpd-1.3.13.1/Makefile.in0100644000175000017500000000357607751232316015153 0ustar joergjoerg# Copyright (C) 1999 Beau Kuiper # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ include Makefile.defs prefix=@prefix@ # where the binary is stored BINDIR=@bindir@ # where the man pages are stored MANDIR=@mandir@ # where info files should be stored INFODIR=@infodir@ # directories to make DIRS=src doc @subdirs@ # filenames to clean in distclean DISTCLEAN_NAMES=\*.a \*.o \*~ \*.so config.status config.log config.cache config.h Makefile configure.scan defaults.h # filenames to clean in maintainer-clean MAINTAINERCLEAN_NAMES=$(DISTCLEAN_NAMES) configure config.h.in all: $(MAKE) recursive TARGET=all recursive: @for current_dir in $(DIRS); do \ (cd $$current_dir && $(MAKE) $(TARGET)) || exit 1; \ done install: $(MAKE) recursive TARGET=install clean: $(MAKE) recursive TARGET=clean rm -f *~ DEADJOE distclean: $(MAKE) recursive TARGET=distclean @echo @echo -n searching and removing files @for file in $(DISTCLEAN_NAMES); do \ find -name "$$file" -print0 | xargs -0 rm -f; \ echo -n .; \ done @echo done maintainer-clean: $(MAKE) recursive TARGET=maintainer-clean @echo @echo -n searching and removing files @for file in $(MAINTAINERCLEAN_NAMES); do \ find -name "$$file" -print0 | xargs -0 rm -f; \ echo -n .; \ done @echo done muddleftpd-1.3.13.1/NEWS0100644000175000017500000012603507751233750013604 0ustar joergjoerg Version 1.3.13: 1) Change: Revamped build system to use new build tools. 2) Change: Included authentication modules into build system. They are installed (if selected at configure time) into the libdir from configure. Normally prefix/lib (/usr/local/lib if not specified). 3) Bug Fix: Properly fixed bug in 1.3.12.1, so muddleftpd does not accept /r or /n from user input unless it is the form of a TELNET newline. 4) Bug Fix: Scrambled output on PPC systems fixed. (possibly other systems too) 5) Change: Install .txt documentation in prefix/share/doc/muddleftpd/*. Version 1.3.12.1: 1) Bug Fix: Fixed logging of /r and /n so they are converted to spaces. Version 1.3.12: 1) Bug Fix: Linux does not like custom PASV replies with ip-masq. Using reply recommended (but not mandatory) in RFC959. (Beau Kuiper) 2) Change: Included support for large files (> 2 gig) on 32bit systems. 3) Change: Removed QUIET compile option, replaced by verbose parameter. 4) Change: Added support for HP-UX 11.00 5) Bug Fix: fixed warnings with GCC 3.X compiler Version 1.3.11: 1) Change: Updated mudlogd. now sighup will reload config file. (Beau Kuiper) 2) Bug Fix: Overflowing port value allowed sending data to ports below 1024 dispite restrictions. (Beau Kuiper) 3) Bug Fix: Fixed storing files so they are truncated to the start position, like other ftpds. (Beau Kuiper) 4) Bug Fix: Removed races in the STOR and STOU commands. (Beau Kuiper) 5) Bug Fix: Removed race in STOU unique filename generator. (Beau Kuiper) 6) Change: Minor optimizations, less malloc frobbing in some common code paths. Version 1.3.10: 1) Bug Fix: Fixed warnings from gcc. (Beau Kuiper) 2) Change: Added %(x,*)d format for cookies. (Beau Kuiper) 3) Bug Fix: Fixed gid/uid handling, corrected casting, mainly useful for older machines with 16bit uid and gid (Beau Kuiper) 4) Bug Fix: Fixed manual page installation to put .1 at the end. (Decklen Foster) 5) Bug Fix: Fixed makefile problems. (Beau Kuiper) 6) Bug Fix: Fixed freeing of null pointers when specified configuration file is a directory. (Beau Kuiper) 7) Bug Fix: Fixed gid/uid handling so NIS works. (Beau Kuiper) 8) Change: Now using new malloc library. It is much better than most other mallocs, including GNU's (Beau Kuiper) 9) Change: Added the package Muddlestats. It seems very good and has a promising future. (McRee) 10) Bug Fix: Fixed uploads on IBM AIX systems. This bug has existed a long time. (Beau Kuiper, helped by Sergey Novoselov) 11) Bug Fix: Fixed recursive directory listings again (Beau Kuiper, helped by Nik Soggia) 12) Documentation: Minor changes to example configs. (Beau Kuiper) 13) Documentation: Added mudlogd documentation. (Beau Kuiper) 14) Change: Added the mudlogd program, which works separatly from muddleftpd to allow simple log rotation. (Beau Kuiper) Version 1.3.9: 1) Bug Fix: Connection rejections if DNS broken fixed. (Beau Kuiper) 2) Documentation: added mudpasswd manual page. (Decklen Foster) 3) Bug Fix: Better error reporting in ftpwho (Decklen Foster) 4) Documentation: Minor change to info page. (Decklen Foster) 5) Bug Fix: made forking into background a command line parameter instead of a #define (Beau Kuiper) 6) Change: added separate upload/download speed limiters for people with differing upload and download speeds, eg cable modem and ASDL. (Beau Kuiper) 7) Change: changed source tree directory structure, separating source files into thier own directory. (Beau Kuiper) 8) Bug Fix: Fixed directory listing again, so even simpler and better. (Beau Kuiper) 9) Bug Fix: Small memory leak in listing code fixed. (Beau Kuiper) 10) Bug Fix: Finally fixed date parsing in list code so year is displayed if last modified was a different year. (Beau Kuiper) 11) Bug Fix: String length checking fixes for config files. (Tomas Ogren) 12) Bug Fix: Memory alignment issues fixed in configuration include sections (Tomas Ogren) 13) Bug Fix: Some libc's don't like being told to vsnprintf without a buffer. Fixed autoconf script to check for this and use replacement if true. (reported by Tomas Ogren, fixed by Beau Kuiper) 14) Bug Fix: Moved HOST reply strings to reply.h (Beau Kuiper) 15) Change: added EPSV and EPRT commands, to support IPV6 at a later date. (Beau Kuiper) 16) Change: added busydumpdata directive option for main and virtual server sections. Now the server won't blindly disconnect if too many users connect at the same time. (Idea by Tomas Ogren, done by Beau Kuiper) 17) Bug Fix: Fixed makefiles to use configure specified manpage and info directories. (Decklin Foster) 18) Bug Fix: Fixed ABOR to forget any data port information. (Beau Kuoper) 19) Bug Fix: Fixed default data port handling, with server using the wrong IP address. (Beau Kuiper) 20) Bug Fix: Fixed SITE error message with no parameters. (Beau Kuiper) Version 1.3.8: 1) Bug Fix: Fixed bug in ratio record creation 2) Change: Added HOST support as outlined in the draft I have written. 3) Bug Fix: Minor fix for errorous exit. Now exits with 1 if an error occurs. Suggested by Decklin Foster 4) Bug Fix: More descriptive error messages for when the server has too many users. 5) Bug Fix: Recursive listing crashed muddleftpd if the last dir scanned but the recurse algorithm is empty. 6) Bug Fix: substantial fix to be more compatible with /bin/ls for recursive lists. Should fix mirror.pl 7) Bug Fix: upload resume using STOR command fixed. A very simple mistake that existed in the whole (1.3.X) series. 8) Bug Fix: Fixed free NULL pointer error when no ipacls specified. Version 1.3.7: 1) Bug Fix: Listing ACL's did not work correctly. 2) Bug Fix: Major bug in freeing children caused major problems after server maxusers had logged in and out. 3) Bug Fix: Bind errors were being displayed when using runasuser directive. They are now ignored (they are harmless) 4) Bug Fix: SIGHUP is now not acted upon if runasuser is active. Version 1.3.6: 1) Bug Fix: Fixed serious DOS bug when the new maxipconnect directive is used. Version 1.3.5: 1) Change: Pam module now accepts option pam_user, to force the username it will read from the password file and return the credentials for. 2) Bug Fix: better logging of some failed calls. 3) Change: Now quitdump, cddump and welcome do not need to be specified specially for chroot mode. 4) Bug Fix: string.c changed for easier porting. Was GCC dependant. 5) Bug Fix: memcpy bug while resolving hostnames. 6) Bug Fix: Improper handling of uid, gid in authentication. 7) Bug Fix: Warnings repaired, prototypes rebuilt using scribe. 8) Change: Ftp list code now supports recursive listing. The listing code is very fast/memory efficient. 9) Bug Fix: Fixed memory leak while authenticating user. 10) Change: Added funtions to retrieve hostname/ip from authentication modules. 11) Change: I am using my own glob routines now, sorts correctly for machines without glob. 12) Change: The fnmatch code I wrote is now being used regardless of whether the library has its own one. 13) Bug Fix: fnaccess and pfnaccess have been repaired, and can be used. 14) Change: Listing now shows total directory sizes like the real ls. 15) Bug Fix: Dumping relative files when changing directories caused the file for the last directory to be dumped 16) Bug Fix: ratiotool failed to set correct file permissions on a newly created ratio file. 17) Bug Fix: compile fixes for IRIX. 18) Bug Fix: Macros broken in ftpd.h 19) Bug Fix: Ips were shown backwards in ftpwho if reverse hostname was not found. 20) Change: Added option maxconnectperip. This limits the number of connections from a single IP address. 21) Bug Fix: Fix when user operation is more than 120 characters. This lead to ftpwho printing the hostname after the operation. 22) Bug Fix: cookies in access directives were not being applied correctly. 23) Bug Fix: Signals must be blocked while reloading config, or deleting users, or bad things happen Version 1.3.4: 1) Bug Fix: The internal password module was feeding the config error function the wrong variable. 2) Bug Fix: Fixed a bug in include handling that would prevent use in 64bit environments. 3) Bug Fix: Include looping is now checked before config file is loaded. 4) Change: Removed authparams option. Auth modules get to fend for themselves (this provides more functionality, and better directive names) 5) Bug Fix: Help was not being shown correctly. 6) Documentation: Updated some documentation. 7) Bug Fix: Possible to free NULL pointers in config.c 8) Change: Changed a few error messages to be more understandable. 9) Change: A temporary change that will lock up muddleftpd if it tries to free a NULL pointer. It locks muddleftpd up so a debugger can get a clean backtrace of the program. 10) Bug Fix: Fix for attempting to rotate logs while in droproot mode. 11) Bug Fix: Usernames are more rigourously checked because regular expression characters in accepted usernames may provide more access than intended. 12) Change: The anonymous authentication module now returns the uid and gid of nobody instead of the ftp user. This is more consistent with other ftp servers. 13) Change: Listing of devices is more accurate, showing the major and minor device numbers like real ls. 14) Change: Muddleftpd now uses the real hostname as the default hostname of the host and virtual servers. 15) Change: Ipacl for hostnames must be in brackets. Without brackets, it is always checked against the IP 16) Bug Fix: got rid of any use of inet_ntoa, since I wasn't using it right. 17) Change: Set default logstrength to log everything. 18) Documentation: Documented all server directives. Version 1.3.3: 1) Change: Can now use %v in group config to get current virtual server section name and %V to get current virtual server host name. Ratio %v and %V are now %a and %A 2) Change: Can now use tokens in greeting line. 3) Bug Fix: Fix for bug where directories with % in them did weird things (see version 1.2.10) 4) Change: New config option droproot. This option will drop all root prividges when a user logs. It also will use capibilities so it can still use low numbered ports on linux 2.2 or better if libcap is installed. 5) Change: reply.h now contains macros to the replys the server generates, It allows replies for foriegn languages or other ftp servers to be used, basicly changing the persona of the ftp server. 6) Bug Fix: muddleftpd was not correctly enforcing the one command at a time requirement of FTP. 7) Bug Fix: muddleftpd was not updateing upload/download byte counter. Version 1.3.2: 1) Bug Fix: Muddleftpd is much more careful now about the configuration file it listens to. The config file now must be owned by the user/group who runs it, and must not be world or group writable. This fixes a security vulnerability in ftpwho if it is setuid. Same for internal password files. 2) Change: Added the -n option to display IP's instead of hostnames in ftpwho. 3) Bug Fix: Fix for truncated replys where length of reply was more than 1024 characters. 4) Change: Implemented new directive include, which allows you to include another section in the current section. Good for creating templates. 5) Change: Changed how config errors were handled, improving error reporting and detection 6) Change: By default, muddleftpd is built to be quiet on startup. 7) Change: ratios now get data from groups section rather than a separate section. Use include to have ratio directives in other sections. 8) Change: Sending SIGUSR1 to the server process will make it reopen the log file and instruct the children servers to do the same. Note that chrooted server children will not be able to reopen the log file. 9) Change: added fnmatch pattern based access controls, including controls to explicitly match slashes. 10) Bug Fix: Maximum process limit setting was broken, fixed. 11) Bug Fix: Symbolic links were always assumed readable in the listing code. Does not work because the /proc filesystem actually has non-world readable symbolic links. Version 1.3.1: 1) Change: Minor changes to how the scratchfile is used. 2) Change: Muddleftpd now uses proper unix style arguments. It has a usage screen and a version option. 3) Change: PORT command more verbose, repling where it will connect to. 4) Change: root privliges are given for connecting to low number ports. This is for RFC951 complience. 5) Bug Fix: Fixed code so muddleftpd runs of FreeBSD. Borrowed :-) some code from proftpd (for functions fgetpwent and fgetgrent) 6) Bug Fix: snprintf replacement code has a bug causing very bad problems. 7) Bug Fix: removed TCP_CORK code since it only slows data transfers down. 8) Bug Fix: Fixed a few compile bugs. 9) Change: Changed log format and how log was written 10) Change: Added support of dlopen modules for authentication modules 11) Change: Minor updates to authentication module interfaces. 12) Change: Passwords used by anonymous users are now logged. 13) Bug Fix: Fixed %N cookie for user count. 14) Change: Got rid of pidfile support, now ftpwho -p will return the pid of the running standalone muddleftpd. 15) Change: Now scratchfile is used for locking in both inetd and standalone modes. This means the server doesn't need to lock against the config file and it could be changed without problems. 16) Change: ftpwho program rewritten and much more useful now :-) 17) Bug Fix: A couple of missing returns fixed. Should have caused problems already :-) 18) Bug Fix: A bug in acl.c fixed where segfault would occur if no ACLs were specified for a user 19) Change: Authentication modules can now cancel authentication of a user if a serious error occurs. 20) Change: Authentication is now cancelled if an authentication module cannot be found. 21) Change: If muddleftpd cannot bind to a port when it starts up, then it will exit. If it cannot bind to a port when you issue a SIGHUP, then it will log it and continue. 22) Change: Commands can now be disabled per group within the config file. 23) Bug Fix: Data corruption bug after SIGHUP removes a virtual server fixed. 24) Change: When a user connects, muddleftpd will fail to recognize all but a few commands needed to login. 25) Change: ftpwho reports vservers using their section names. 26) Change: Now download speed limits can be specified per group These are highly accurate and reasonably smooth. 27) Bug Fix: Porting fixes for weirder unixes including simple-glob fixes. 28) Bug Fix: Small bug parsing gid lists caused crashes with long suplemental gid lists. 29) Change: Speed limits now also apply to file lists and uploads. 30) Bug Fix: New listing code would possibly break when a partial write occured. 31) Change: Finished logindumpdata support. Version 1.3.0: 1) Bug Fix: for large maxusers, the default settings would cause muddleftpd to croak. Fixed. 2) Bug Fix: for long usernames and non-default constant values, a possible problem with setting username has been fixed 3) Change: PAM module now does more logging to aid debugging. 4) Change: shared memory is more compact now, only storing thread users. 5) Change: EXPERIMENTAL INETD SUPPORT!!!! 6) Bug Fix: on systems that need -ldl for pam support, it would cause pam support not to compile. Fixed. 7) Bug Fix: if muddleftpd is running inetd mode, now errormessages go to the system log. 8) Change: Log message now emmitted if non-existant auth method used. 9) Change: Better debug logging system now in place. Can work even with inetd 10) Bug Fix: Fix to MDTM. This broke netscape quite convincingly 11) Bug Fix: Fix for netscape race and maybe other clients. 12) Change: All configuration is in single file now! This improves performace muchly esp under load. 13) Documentation: Examples updated for new code! 14) Bug Fix: Fix to logging where SITE commands were logged twice. 15) Bug Fix: Listing bug fixed where files were being used as regular expressions. 16) Chnage: Replaced ACL code. New code also recognises mkdir and rmdir, chmod and chdir. Add only applies to files now. 17) Change: Now ip's can be denied as well as allowed with the new ipacl directive. Note that the order ipacl's are specified in is very important. 18) Change: Now log messages are generated when a user logs out of the server. 19) Bug Fix: User cannot specify PORT command with data port < 1024 20) Bug Fix: Total file size is now given when doing binary downloads, regardless of starting position. Other ftp servers act this way, and some client expect it. 21) Bug Fix: Maximum timeout was not correctly set. 22) Change: Writing to control port now has timeout, so it cannot lock up. 23) Change: Continuation messages have new format that look nicer. 24) Change: New group system is working, It now traverses a list of groups in the user file to determine what group a user is. It needs more work ATM. 25) Change: added IP and name access lists to make group system very, very, very configurable. 26) Bug Fix: For systems which uses non-DES encryption, muddleftpd used crypt correctly. 27) Change: added hostname based matching and hostnames in logs. 28) Change: reverse dns timout setting added 29) Change: Alternate long reply format option added, allows for bad proxys and stuff. 30) Change: VIRTUAL SERVER SUPPORT ADDED. Not yet completed or optimised for file descriptor usage. 31) Bug Fix: Fixed several small bugs found in 1.2.2. 32) Bug Fix: A minor bug working with parameters fixed. 33) Bug Fix: A bug when parsing config files caused tabs to be misinterpreted. 34) Change: Smart binding. This allow muddleftpd to minimize the number of file descriptors used when binding files. 35) Change: Zero binding. When used with smart binding above, allows virtual servers to be used on all servers. This basicly makes sure all binds are performed on address 0.0.0.0 36) Change: Using rlimits instead of manually checking memory size for determining overuse of memory. 37) Change: Made single configuration file loading to be less memory intensive. 38) Change: Server will now reload config file with a HUP signal. 39) Change: Server now lets you specify if you want to real chroot to the rootdir instead of doing a pretend chroot. It is ignored if root access isn't avaliable. This provides extreme security for paranoid system administrators (like me!) 40) Change: When a user logs in, the uid/gid is switched to that user instead of being left as root. This reduces code size and improves security. I also seem to learn things the hard way (I should have had this ages ago) 41) Change: Ratio support. An external binary file is used for this, and users are added to it as they log in. Ratio's are implimented so multiple sessions are no problem. Ratios apply to both files and bytes, and can be persistant or non-persistant. 42) Change: Config changes. Now parameters are easier to specify, and including spaces is easy. 43) Change: By default, muddleftpd now doesn't allow access to non regular files (eg device files). To re-enable use devaccess in group sections. 44) Change: Full group support, include supplementry group lists. 45) Change: Added a ratio changing program, ratiotool. It can add, edit and psudo-delete ratio file entries. It is safe to use while the server is running. 46) Bug fix: Fixed a small bug that always put an extra / at the beginning of a filename in the log if rootdir is / 47) Change: If rootdir contains symlinks, they are now dereferenced as the user logs in. 48) Change: Added a realdir option. This will automaticly report the real directory name, with all symlinks dereferenced, instead of the internal construction. 49) Change: Added code to detect broken snprintf, and to work out which syntax it uses and use that syntax. 50) Change: Detects if double ints work correctly and disables ratios if they don't 51) Change: Added fxpallow option, so server-server transfers may work on a per-group basis. 52) Change: Implemented output buffer to make sure long replies are sent effeciently. 53) Change: Input from dumped files and user is now put through a filter that removes non-printable characters. 54) Change: Implemented options to specify long replies directly in the config file 55) Change: Data port handling rewritten, should be a little faster now. 56) Change: Sendfile() support implemented. This should improve performace slightly, but linux needs a better sendfile :( 57) Change: Groups and vserver limits are handled in a much better way now. Faster for standalone operation, correct for inetd operation. 58) Change: Log now contains thread id so it is easier to trace what a specific user is doing Version 1.2.10: 1) Bug Fix: Bug where % in pathname would cause weird errors when current directory was displayed. It was caused by using the output of one printf (with user supplied data) as the format string in the next. Fixed by removing all (except where it is obviously safe) non-constant format strings in the source. Entire source was checked for the problem. Version 1.2.9: 1) Bug Fix: Mudpasswd backported from 1.3.X. Fixes problems with mudpasswd segfaulting. 2) Change: Included an init file for system V init scripts 3) Chnage: Added a spec file for rpm generation. Havn't tested it yet. Version 1.2.8: 1) Bug Fix: Another config file reading bug fixed. If you used tabs at the end of a value, they would not be discarded by the ftp server. 2) Bug Fix: Repaired the README file. Version 1.2.7: 1) Bug Fix: Rename bug fixed. Ops :-) Occured because errno wasn't reset correctly. Version 1.2.6: 1) Bug Fix: Fixed bug where garbage was printed if null password was supplied. Version 1.2.5: 1) Bug Fix: snprintf madness fixed. Server now works for all known snprintf types. 2) Bug Fix: fixed the provided snprintf so it reports -1 if result is too long. 3) Bug Fix: ftpwho would segfault in certain denied access cases. Version 1.2.4: 1) Bug Fix: Parsing problems with tab separating name and value pairs fixed. 2) Change: Ftpwho program revamped. It can now do reverse IP lookups for hostnames and supports regular options. Run ftpwho -h to see options. 3) Bug Fix: Problems with zero length strings on ftp commands fixed. No real problems, just zero length parameters need to be detected and reported as missing parameters. 2) Bug Fix: A secuity problem with cddump relative files has been fixed. If the user could create a symlink as the name of a relative cddump file, the user could view any file on the system over the control connection. Version 1.2.3 (was 1.1.1c) 1) Bug Fix: Active data connections now bind to specific interface. Old method seemed to fail when used with strict ip filewalls. 2) Bug Fix: If an error occured accepting a control connection, the server would bad. 3) Bug Fix: If the PASV command couldn't bind to a port, it wouldn't cleanly report the error. 4) Bug Fix: An extra close was hiding the real cause of data port connection failure. 5) Bug Fix: Some calls to create sockets were not checked correctly. 6) Bug Fix: No error was displayed if passive port connection accept fails 7) Bug Fix: Slight change in Makefile so that CFLAGS is recognised. Version 1.1.1b (now 1.2.2): 1) Bug Fix: if you didn't set authmethod in the config file, the server process would crash. 2) Bug Fix: if you use a non-DES crypt function, muddleftpd would not authenticate properly. This bugfix fixes for a least slackware 7.0. 3) Change: New versioning system. Now I copy the linux versioning system since I cannot get it right myself. 4) Bug Fix: if a list failed due that was not the fault of glob, then server would crash tring to free a non-existant variable: 5) Change: You can use group/usernames for uid/gid specification now in user config files and authentication modules. Version 1.1.1a (now 1.2.1): 1) Bug Fix: Long usernames would cause the server to crash. Not an exploitable bug, but not very nice looking. 2) Bug Fix: files dumped over control connection were not logged correctly. Version 1.1.1 (now 1.2.0): 1) Bug Fix: A minor memory leak was sealed. 2) Bug Fix: Changed ACL error code to EACCES instead of EPERM. 3) Documentation: Added the info file back. 4) Change: log entry generated when a user logs out of the ftp server 5) Bug Fix: Server will not allow client to specify a data port less than 1024. 6) Bug Fix: Changed byte count when starting download to total size of file regardless of restart position. Other ftp servers act this way, and some clients use this info. 7) Change: When authenticating users, the server will change to the configuration directory. This will improve robustness of marginally defined configurations. 8) Bug Fix: Maximum timeout was not set correctly when logging user in. 9) Bug Fix: Minor fixes for platform independance in mudpasswd. Version 1.1.1beta3: 1) Bug Fix: invalid rootdir message didn't show root dir. 2) Bug Fix: fix for site commands being logged twice. 3) Documentation: info files removed for now since maintainer hasn't reponded to email. 4) Bug Fix: Directory listing problems solved. Version 1.1.1beta2: 1) Bug Fix: Pam support didn't compile on system with dynamic linking in a library 2) Bug Fix: Small change to code to prevent problems if username length constants get changed. 3) Bug Fix: Fix to MDTM command, broke netscape access quite well :) 4) Bug Fix: Fix for netscape race and maybe other clients. Version 1.1.1beta1: 1) Change: Changed the error message management system. Now much better. 2) Change: Help now contains descriptions for each command. 3) Change: Full shadow password support with account expiry. 4) Change: User now gets message as to why login fails. 5) Bug Fix: strerror was compiled even if it already existed! 6) Change: PAM support has been added! 7) Bug Fix: now all root logins get demoted to user nobody like they should 8) Bug Fix: now user nobody from the password file is used to determine what user nobody is. Any system without a user nobody is in SERIOUS TROUBLE! 9) Change: Added the disabled user authentication which will disable a user. 10) Bug Fix: Added a copy of the usleep function for older computers. 11) Documentation: Fixed documentation for new features. 12) Bug Fix: Put limits on maximum generated string lengths to prevent users from filling virtual memory. 13) Change: Added SITE IDLE command. Version 1.1.1beta0: 1) Change: Log message emitted when user cannot login due to bad root dir 2) Change: Error messages for socket connection are better handled. 3) Change: added -d option to list a directory instead of its contents. 4) Change: Major refit of auth code. Now all auth code is modularied into the different sources. Makes adding new auth schemes easily. 5) Change: new unix auth module can autodetect shadow passwords! 6) Change: config files can handle windows style files. 7) Change: added an internal password file support module. 8) Change: added runasuser option in main config file. 9) Change: removed runasuid and runasgid from main config file. 10) Change: created a simple mudpasswd program to modify internal password files. 11) Change: Minor server reply tweeks. 12) Documentation: Fixed examples for new code. 13) Change: Added the badauthwait option to the main config file to cause the server to wait a specifed number of milliseconds if the user doesn't provide the correct password. 14) Change: Added the userjail option to user files so when the user logs in, he/she will not be able to log into a new user. Good for anonymous accounts. 15) Change: Added the logintrys option to the main config file. This tells the server how many attempts a connection has to login before the server refuses to log the user in. Version 1.1: 1) Documentation: Added man page and info pages. Thanks to Jonas Oberg for this. 2) Bug Fix: Spelling mistake in init.c fixed. Thanks to Jonas Oberg for noticing my mistake. 3) Change: Server will now detect if it needs root access to bind to a port and gives a message to the user if it is so. Version 1.1.beta3: Final beta if no bugs are found! 1) Bug Fix: Fixed Makefile so QUIET=1 option is recognised. 2) Bug Fix: Fixed spelling mistake in init.c (already instead of aleady) 3) Documentation: Added some documentation on how to build and install muddleftpd (muddleftpd.txt) 4) Documentation: Updated README and INSTALL. 5) Bug Fix: If unixuser is specified and that specified user doesn't exist, login will fail automaticly. 6) Bug Fix: If it can't load a user's config file, it will now output a log message. 7) Bug Fix: Checks on files and directories now done in user auth files. 8) Change: Minor optimisations to improve processing of file dumping, streamlines code. 9) Bug Fix: busydump was crashing, due to incorrect working directory value, fixed! 10) Bug Fix: the username in the shared memory structure is properly updated at the correct time. Allows a user with maxconnect 1, to relogin. 11) Documentation: Added documentation for user configuration files. 12) Bug Fix: now mud authenication stuff is not compiled by default. 13) Documentation: Added documentation for cookies in user config files. 14) Documentation: Added documentation for accepted ftp commands. 15) Documentation: Gave up on HTML documentation! Version 1.1.beta2: 1) Change: Failed magic cookie tranformations are logged so that the admin can find if cookies fail. (I decided that this change is minor enough and important enough to be added before version 1.1) 2) Bug Fix: Download statistics were not correctly tallyed. 3) Documentation: Added documentation for dumped file magic cookies (cookies.txt) 4) Documentation: Added documentation for ftpwho. (ftpwho.txt) 5) Documentation: changed user.other so that if the example config is directly used, it won't open gaping holes in the system. 6) Bug Fix: Server dies improperly on startup if shared memory isn't initalized 7) Bug Fix: Commented out error message about shadow passwords not working as root. Change 1 should produce a log entry if the user tries to use shadow passwords without root access. 8) Documentation: Created a new set of examples, that are more secure, and better for creating a full configuration. 9) Bug Fix: Updated socket.c, now if the server fails binding data connections for any reason, it lets the computer choose the port. Version 1.1.beta1: Thanks to Mike Javorski for the first 3 fixes. 1) Bug Fix: Removed SO_SNDLOWAT and SO_RCVLOWAT log messages because they are unimportant and seem to be annoying people :) The feature is still there, it will just fail quietly on systems that have problems with it. 2) Bug Fix: Manual page installation fixed (but commented out becuase the manual page is yet to be written. 3) Bug Fix: Fixed ftpwho.c for ANSI C complience. Now main returns an int. 4) Bug Fix: Defined prototypes for listing functions and found a bug where they wern't supplied correct parameters. 5) Bug Fix: Server now checks if you are already logged in before accepting a password command. 6) Bug Fix: Ops, I must have been on drugs to not have noticed this bug before now (and write the broken code). SIZE in ascii mode was badly broken. 7) Bug Fix: SITE CHMOD was broken and logged out the client 8) Bug Fix: HELP missed the first command when printing out a command list. 9) Bug Fix: When using runasuid/runasgid, the parent terminal holder would not get killed due to the process not having permission after changing uid. 10) Bug Fix: When using runasuid/runasgid, and listening on ports less than 1024, muddleftpd would fail to create data ports because it couldn't bind to the port. 11) Bug Fix: prototypes in ftpd.h for procnum.c fixed. 12) Bug Fix: ftpwho.c now includes as required. 13) Bug Fix: fixed compiler warning compiling sglob.c on systems without glob. 14) Bug Fix: Prototype for strerror if the system hasn't got an strerror 15) Bug Fix: Fixed problems about double defining crypt 16) Bug Fix: -lsocket and -lnsl should work for machines that need them now. Version 1.1.beta0: 1) Bug Fix: forkwrapper is declared int instead of pid_t in ftpd.h fixed. 2) Bug Fix: On systems that don't support GLOB_PERIOD, compile will fail, fixed. 3) Documentation: Added some documentation for the main config file, in doc/config.txt 4) Bug Fix: Compile warning fixed for ftp.c 5) Bug Fix: Fixed race condition in starting up program where tty could hang if the parent recieved the signal to give it back too soon. 6) Documentation: Added some HTML documentation (just a quick conversion of doc/config.txt) Version 1.1.alpha5: Imposing a feature freeze for Version 1.1. Only bugfixes and documentation from here. 1) Change: Magic cookies when authing clients is now handled more gracefully. No user side changes. This allows Change 6. 2) Bug Fix: Empty listing caused memory leak. Fixed. 3) Change: Server now holds the terminal until after the startup messages so the prompt occurs after it. 4) Change: Startup message fixed for correctness. 5) Bug Fix: pids are now type pid_t, gids are now type gid_t, and uids are now type uid_t in my program. They were ints before!. 6) Change: Now magic cookies work in dumped files (eg welcome file) so you can give info out. The cookies are similar to the real wu.ftpd cookies. 7) Change: Added email option in config file for magic cookie %E. 8) Change: Now you can bind to a port to a specific interface by using port/ip as a parameter to ftpport. eg to bind port 21 on the loopback device use "ftpport 21/127.0.0.1" in the config file. Version 1.1.alpha4: 1) Change: SITE command now operates similarly to normal command. No user visible changes. 2) Change: Messages have changed so that the code is more general. 3) Change: STAT ACCESS has been moved over the SITE ACCESS. 4) Change: help routine is more generalized, giving better results, less code and more maintainablity. 5) Change: Now I use config.h instead of lots of compile options. Thanks to Decklin Foster for the patch. 6) Change: The pidfile is used to check if muddleftpd is still running. If it is, muddleftpd refuses to start. Note, you can still have multiple instances of muddleftpd if they run with different config files. 7) Bug Fix: config file name was not initalized properly. 8) Change: Added a new user config option (quitdump) that prints a file when the user quits. Version 1.1.alpha3: 1) Bug Fix: New parameter bug where process will segfault if it cannot correctly substitue a %(a,b)h parameter. 2) Change: Ftp listing is better now, it recognises the -a option and displays all files. This improves interpolability with misbehaving clients. 3) Change: I removed the status reporting option and the code that does it. 4) Change: Shared memory used by muddleftpd can now be externally accessed. (for things like ftpwho) 5) Change: Added a simple ftpwho program that actually works without races by accessing the shared memory. 6) Change: The default config file is now specified in config.h Version 1.1.alpha2: 1) Change: Changed the status reporting so it now dumps info into a file that can be read by other programs. 3) Change: The admin now has the option to create a pidfile as muddleftpd starts. 2) Change: Changed the way parameters are processed. Now you can select a range of characters to include. eg %(10,12)h means to substitute characters 10 through 12 into the string. The old %h still works. Version 1.1.alpha1: 1) Change: Added simple shadow password support 2) Change: Changed the way listing works. Simpler, easier 3) Change: now STAT works. 4) Change: A list cannot be longer than MAXLISTSIZE 5) Bug Fix: A long running LIST -n ./ bug has been fixed. It caused an embarrasing infinite loop. Been in there for ages. A big thanks to Richard(Sputa@os3.os.ds.mfcr.cz) for the tipoff. 6) Bug Fix: Resume position should not be allowed to be negative. Version 1.1.alpha0: * means ported back to 1.0 1)*Bug Fix: Rename fixed again to check if RNFR was run before RNTO 2) Change: The main routine now uses the select.c services. 3) Change: The server can bind to many ports, and serve ftp over them 4)*Bug Fix: Memory leak in displaying symbolic links in listing. 5) Change: Internal list function now displays setuid/setgid and sticky bit. Rewrote to be much smaller. 6)*Bug Fix: Fixed ENOTDIR error to becone MYERR_NODIR instead of MYERR_NOFILE in file.c 7)*Bug Fix: Minor changes to error descriptions in ftp.c 8) Change: ~ works for going to your home directory. 9) Change: Download/Upload now don't memmove buffer. 10) Change: make a substitute glob using old BSD re_comp calls for very old systems. 11)*Bug Fix: Uid/Gid cache full causes problems. 12) Change: for passive downloads, makes sure the host that connects to the dataport is also the host that the control port is connected to 13)*Bug Fix: Obscure bug in ftplist.c fixed! 14) Change: The server sets the high and low water marks for the sockets on opening a data connection to improve performace. 15) Change: Added the STOU command! 16) Change: Added the ability to type a file before the user logs in 17) Change: Added the ability to type a file when the user enters a directory. 18) Change: The welcome file is now an absolute filename instead of relative to rootdir 19)*Bug Fix: Timeout didn't get updated properly when user logged on. 20) Change: Added timeout to STAT command. 21) Change: Added the APPE command! 22) Change: Added the ALLO command. Does nothing. 23) Change: Added the ACCT command. Does nothing. 24)*Bug Fix: The server didn't kill children ftpd processes. Now it does. 25)*Bug Fix: If you didn't specify a groupname in a user file, the server would crash. 26) Change: Changed maxthreads directive to maxusers. 27) Change: Cleaned up reading of commands. 28) Change: Started to use assertions to debug code. 29) Bug Fix: Server full log message not logged correctly. 30) Change: select.c adjusted to work better. 31) Bug Fix: server made 2 replys on logout. 32) Bug FIx: server can handle lots of dataconnections now. 33) Change: now too many login message is configurable per user using the busydump directive. 34) Change: ASCII upload resume disabled. It is not actually possible to this safely. Use the APPE command instead. 35) Change: Changed data collection to use shared memory rather than pipes. Faster, easier to access and allows future changes. 36) Change: Error messages now output the filename and line the error occured on. 37) Change: I am starting to use assersions to test features, find bugs. 38) Bug Fix: Server exits if it can't write to the log file, i.e disk full or other fatal error. 39) Change: Passive is handled better througth the main select handler. 40) Change: A simple strerror replacement has been thrown in for unlucky systems that don't have it. 41) Bug Fix: High and low water marks are only set if the constants for them exist. See 14. 42) Bug Fix: --prefix parameter in configure works as expected. Version 1.0: These fixed are ported back from version 1.1.alpha0. 1) Bug Fix: very obscure and rare bug fixed in ftplist.c 2) Bug Fix: Memory leak fixed in listing symbolic links. 3) Bug Fix: Rename fixed to check if the command RNFR was run first. 4) Bug Fix: Fixed ENOTDIR to become MYERR_NODIR instead of MYERR_NOFILE in file.c 5) Bug Fix: Modified error descriptions in error.c 6) Bug Fix: Fixed problems with full UID/GID caches. 7) Bug FIx: Timeout wasn't updated when user logged in. 8) Bug Fix: children processes are now automaticly killed when you kill the parent. 9) Change: Changed maxthreads to maxusers in the config file 10) Bug Fix: If you don't specify a groupname in the user config file, then the server will crash. Version 1.0.beta3: 1) Bug Fix: Buffers in acl.c fixed. Checked the rest of the code for possible buffer problems. 2) Bug Fix: stats.c buffers fixed. (not really a problem) 3) Bug Fix: pnums.c buffers fixed. (not really a problem) 4) Bug Fix: ftplist.c buffers fixed. (not really a problem) 5) Bug Fix: Rename properly fixed. For some reason it worked with the bug, and that worries me a little! 6) Change: reentrant.c (old name for original threaded version) cleaned up a little. Version 1.0.beta2: 1) Bug Fix: QUIT stopped working on 1.0.beta1, now fixed. 2) Bug Fix: Buffers in auth.c fixed completely. 3) Bug Fix: newfile.c has a realloc bug in it. ie it used a pointer to the buffer after remalloc was run, and since realloc may move the data to a new location, it was unstable but difficult to debug! 4) Bug Fix: a couple of memory over-freeing bugs fixed. 5) Change: Symbolic links listed properly. Version 1.0.beta1: 1) Bug Fix: unimplemented type would print response code twice. 2) Bug Fix: %U wasn't recognized unless unixuser was specified. 3) Bug Fix: Permanent group changes specified in config file would not work. 4) Change: FTP server now runs data transfers (almost) completely non-blocking. Timeout and ABOR work properly. ASCII resume works now too. 5) Change: Most of the code has been rewritten to use dynamic buffers, removing most problems with fixed buffer code. 6) Change: cdup, pwd, and cwd all use the same code now, thus all return the current directory 7) Change: mkdir now uses the 257 return code. 8) Change: all commands now give better error messages based on the real error, not the most likely error. Version 1.0.beta0: 1) First Version with CHANGES file. muddleftpd-1.3.13.1/README0100644000175000017500000000527107544536576013777 0ustar joergjoergMuddle.ftpd INTRODUCTION New Features since 1.2 * Faster, Leaner, Meaner (maybe not leaner) * Inetd support (can combine with xinetd for even better protection) * Single configuration file, with sophisticated group selection (much faster) * Better ACL support * Clients are now get the hostnames resolved. * Virutal server support (both multiple ip and single ip) * Rlimits are set for memory overuse. * Reload config with HUP signal (automatic for inetd) * Real chroot for muddleftpd with root access * Supplementary group support. * persistant and temporary ratio support. * Sendfile support for linux, freebsd. * Group count limits. * Dynamicly linked authentication modules. * Per group command disable ability * Download/Upload speed limiters. * USR1 signal now reopens log file. * Signifcantly better listing support, recursive listings, closer to real /bin/ls * EPSV and EPRT ftp commands now supported (ipv4 only) New Features since version 1.0 (a lot): * more opertunities to print out files to the user. * more supported platforms. * listening to multiple ports for connections. Also you can bind to specific interfaces now (on operating systems that support this). * better listing. * complete command set. * shadow password support. * magic cookie improvements (hmmm, cookie). Magic cookies can now be used in files that get printed to the user. * ftpwho program now added and operational. * STAT commands have all been moved to the more general SITE command. * user statistics (only minimal) * lots of non-visible changes, * and of course, bug fixes. DESCRIPTION: FTP servers tend to always want root access to do even the most basic stuff. This ftp server was designed to overcome this limit without limiting the access protection and safety of a regular ftp server. This ftp server can operate as a replacement for wu-ftpd, or it can operate under a single uid, running without any knowledge of the system password file. Anonymous access is availible too and you can actualy create as many guest accounts you like with same or different properties. To do this, it has full access settings per user. You can give permissions for particular directories or files. This server is also secure without being overly intrusive. Unlike wu-ftpd and many others, it doesn't do a chroot anywhere. It manages directories internally in a secure and fast way. This means the server doesn't need to run as root. Also since it doesn't ever run external programs, if the server does crash, the user won't be given any privliged access. To compile and install this server see the file doc/muddleftpd.txt To contact the author: Beau Kuiper: email ekuiperba@cc.curtin.edu.au Copyright (c) 1999 Beau Kuiper Under the GPL licence. muddleftpd-1.3.13.1/TESTING0100644000175000017500000000321007544536576014146 0ustar joergjoerg Testing plan for 2.0: In order to get muddleftpd ready for 2.0 release, the following must be tested. In addition, just before release, it must all be tested again, to prevent new bugs from sneaking in with the bugfixes for other things. 1) Test all ftp commands, basic DONE 2) Test all ftp commands, white box NOT DONE 3) Test listing, retreive in all clients: lynx DONE console ftp DONE netscape DONE ie 4.0 DONE ie 5.0 DONE ie 5.5 NOT DONE konqeror DONE cuteftp DONE wsftp DONE kfm NOT DONE mozilla NOT DONE 4) Test all ACL characters NOT DONE 5) Test the include directive NOT DONE 6) Test all configuration directives NOT DONE 7) Thougthorly test SIGHUP configuration reloading NOT DONE 8) Thougthorly test host based virtual servers NOT DONE 9) Stress test pnums code to expose possible timing bugs NOT DONE 10) Test compile and running on operating systems: Freebsd 3.x NOT DONE Freebsd 4.x NOT DONE Linux 2.4 DONE Linux 2.2 NOT DONE Linux 2.0 NOT DONE SunOS 4.x NOT DONE Solaris 2.6 NOT DONE IRIX 5.3 NOT DONE 11) Make sure rlimits for memory work: DONE 12) Test all authentication modules: authint NOT DONE authanon NOT DONE authpam NOT DONE authunix NOT DONE authdisable NOT DONE authmud NOT DONE authmsql NOT DONE authmysql NOT DONE authsmb NOT DONE 13) Test 8 and 9 in inetd mode NOT DONE 14) Test ftpwho NOT DONE 15) Test ratiotool NOT DONE 16) Test ratios in muddleftpd NOT DONE 17) Test mudpasswd NOT DONE 18) Test mudlogd NOT DONE 14) Tested everything again before 2.0 release NOT DONE muddleftpd-1.3.13.1/TODO0100644000175000017500000000175207544536576013607 0ustar joergjoergThings i must do soon: 1) Properly process arguments GNU style. (FOR V2.0) (done) 2) Authenication Tokens. This is to reduce the chance of someone using a dictionary based attack against the server. (FOR V1.2) (simple support in 1.1.1.b0) 3) Disabling ftp commands per user. (FOR V2.0) (done) 4) Password changing in server. (FOR V2.0) 5) Single configuration file. (FOR V2.0 or later) (done) 6) Dynamicly linked authenication routines. (FOR V2.0 or later) (done) 7) Adding Commands using Dynamic linking. (FOR V2.0 or later) 8) Upload/Download ratios (FOR V2.0 or later) (done) 9) Limiting bandwith used per user (FOR V2.0 or later) (done) 10) Encypted FTP (FOR V2.0) 11) Upload Notification via mail (FOR V2.0) 12) Multiple supplementary gid support (FOR V2.0) (done) 13) Ip restrictions per group (FOR V2.0 or later) (done) 14) Nice modification per group/user (FOR V2.0 or later) (done) 15) Virtual Server support (FOR V2.0 or later) (done) 16) Improved ACL support (FOR V2.0) (partially done) muddleftpd-1.3.13.1/autogen.sh0100755000175000017500000000074507554514276015113 0ustar joergjoerg#/bin/sh # this script creates all configure scripts and config header files. # it does it by finding all configure.ac files, and then running autoconf # and autoheader in the directories they were found in. echo Bootstraping build system... { find -name configure.ac } | sed 's/\/configure\.ac$//g' | { while read scriptdir; do echo Processing scripts for $scriptdir pushd $scriptdir > /dev/null autoconf autoheader rm -fr autom4te.cache popd > /dev/null done } muddleftpd-1.3.13.1/configure.ac0100644000175000017500000001177007751241540015366 0ustar joergjoergdnl Process this file with autoconf to produce a configure script. AC_INIT AC_PREREQ(2.54) AC_CONFIG_SRCDIR([src/acl.c]) AC_CONFIG_HEADER(config.h) dnl Checks for programs. AC_PROG_CC dnl Damn this, I hate writing tests like this! AC_DEFUN(AC_PROG_CC_SWITCH, [ dnl just run gcc program with -dynamic switch ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -$1""... $ac_c" 1>&6 echo "configure: checking whether ${CC-cc} accepts -$1" >&5 echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -$1 -c conftest.c 2>&1`"; then ac_cv_prog_cc_switch=yes else ac_cv_prog_cc_switch=no fi rm -f conftest* echo "$ac_t""$ac_cv_prog_cc_switch" 1>&6 if test "$ac_cv_prog_cc_switch" = yes; then CFLAGS="$ac_save_CFLAGS -$1" else CFLAGS=$ac_save_CFLAGS fi ]) dnl Replace `main' with a function in -lcrypt: AC_CHECK_LIB(crypt, main) AC_SEARCH_LIBS(connect, socket) AC_SEARCH_LIBS(gethostbyname, nsl) AC_SEARCH_LIBS(dlopen, dl) AC_CHECK_LIB(pam, main) AC_CHECK_LIB(cap, cap_init) dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h sys/time.h syslog.h unistd.h sys/uio.h) AC_CHECK_HEADERS(crypt.h dlfcn.h sys/capability.h netinet/in_systm.h stdarg.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_HEADER_TIME AC_STRUCT_TM AC_TYPE_UID_T dnl Checks for library functions. AC_TYPE_SIGNAL AC_FUNC_STRFTIME AC_CHECK_FUNCS(mkdir rmdir select socket strstr) dnl dnl check to see if snprintf returns what we expect. dnl AC_MSG_CHECKING([to see if snprintf work correctly]) AC_TRY_RUN([ #include #include int main() { FILE *outfile = fopen("snprintf-ok", "w"); char buffer[20]; int result; int ok; buffer[10] = 32; if (outfile == NULL) exit(1); result = snprintf(buffer, 10, "hellohellohello"); ok = 0; if ((result == 15) && (buffer[10] == 32)) ok = 1; if (ok) result = snprintf(NULL, 0, "hellohellohello"); if ((result == 15) && ok) fprintf(outfile, "yes"); else fprintf(outfile, "no"); fclose(outfile); exit(0); }],[ SNPCOMPAT=`cat snprintf-ok` rm -f snprintf-ok AC_MSG_RESULT([$SNPCOMPAT])], [AC_MSG_RESULT([error, assuming no])], [AC_MSG_RESULT([cross-compiling, assuming no])]) if test "$SNPCOMPAT" = "yes"; then AC_CHECK_FUNCS(snprintf vsnprintf) fi AC_CHECK_TYPE(off_t) dnl dnl check to see if we have LFS under linux dnl AC_SYS_LARGEFILE() dnl AC_MSG_CHECKING([for Linux LFS]) dnl AC_TRY_RUN([ dnl #define _GNU_SOURCE dnl #define _LARGEFILE64_SOURCE dnl #define _FILE_OFFSET_BITS 64 dnl #include dnl #include dnl int main() dnl { dnl FILE *outfile = fopen("lfs-ok", "w"); dnl dnl if (outfile == NULL) exit(1); dnl dnl if ((sizeof(off_t) == 8) && (sizeof(long int) == 4)) dnl fprintf(outfile, "yes"); dnl else dnl fprintf(outfile, "no"); dnl fclose(outfile); dnl exit(0); dnl }],[ dnl LINUXLFS=`cat lfs-ok` dnl rm -f lfs-ok dnl AC_MSG_RESULT([$LINUXLFS])], dnl [AC_MSG_RESULT([error, assuming no])], dnl [AC_MSG_RESULT([cross-compiling, assuming no])]) dnl if test "$LINUXLFS" = "yes"; then dnl AC_DEFINE(HAVE_LINUX_LFS,,[linux like large file support for 32 bit systems]) dnl fi AC_CHECK_FUNCS(memmove dlopen) AC_CHECK_FUNCS(strerror getspnam) AC_CHECK_FUNCS(usleep pam_start fgetpwent fgetgrent sendfile) AC_CHECK_FUNCS(cap_init seteuid setegid) AC_PROG_CC_SWITCH(rdynamic) dnl check for additional features dnl Checks for libraries. # MUD module AC_ARG_WITH(authmud, AC_HELP_STRING([--with-authmud], [create MUD authentication module. (no)]), authmud=$withval, authmud=no ) if test "$authmud" != no; then AC_CONFIG_SUBDIRS(modules/auth/authlibmud) modules="$modules authmud" fi # SMB module AC_ARG_WITH(authsmb, AC_HELP_STRING([--with-authsmb], [create SMB authentication module. (yes)]), authsmb=$withval, authsmb=yes ) if test "$authsmb" != no; then AC_CONFIG_SUBDIRS(modules/auth/authlibsmb) modules="$modules authsmb" fi # MSQL module AC_ARG_WITH(authmsql, AC_HELP_STRING([--with-authmsql], [create mSQL authentication module. (no)]), authmsql=$withval, authmsql=no ) AC_ARG_WITH(msqlpath, AC_HELP_STRING([--with-msqlpath], [specify the top level of the msql installation tree. (default is /usr/local/Hughes)]), msqltop=$withval, msqltop=/usr/local/Hughes ) if test "$authmsql" != no; then AC_CONFIG_SUBDIRS(modules/auth/authlibmsql) modules="$modules authmsql" fi # MYSQL module AC_ARG_WITH(authmysql, AC_HELP_STRING([--with-authmysql=DIR], [creates MySQL authentication module, optionally specifies the DIR of mysql files]), [authmysql="$withval"], [authmysql=no]) if test "$authmysql" != no; then AC_CONFIG_SUBDIRS(modules/auth/authlibmysql) modules="$modules authmysql" fi # work out zerobind default (false on linux, true on other systems) case `uname -s` in Linux) zero_bind=FALSE ;; *) zero_bind=TRUE ;; esac AC_SUBST(zerobind, "$zero_bind") AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile defaults.h]) AC_OUTPUT echo echo Muddleftpd is now ready to be compiled! echo echo Modules selected for compile: $modules echo muddleftpd-1.3.13.1/defaults.h.in0100644000175000017500000000245207554514276015474 0ustar joergjoerg/* This files specifies default values and other values */ /* Specify where the default config file is */ #define CONFIGFILE "/etc/muddleftpd/muddleftpd.conf" #define MAXSECTIONLEN 40 /* Maximum length of a section name */ #define MAXPENDCONN 10 /* Maximum connections for listen */ #define BUFFERSIZE 4096 /* Buffer size. Increase to improve throughput performace */ #define LOWATERMARK 4096 /* wait for this much data before sending/receiving */ #define BUFFSMALL 256 /* Filename and username buffer */ #define STRCACHESIZE 20 /* Elements in a string cache */ #define MAXMEMUSAGE 4096*1024 /* maximum memory usage */ #define MAXINCLUDEDEPTH 5 /* maximum recursion in include directives */ #define MAXUSERS 30 #define MAXTOOMANYUSERS 10 /* maximum number of connections to display too busy message to at once */ #define ALTLONGREPLIES FALSE #define LOGSTRENGTH 63 #define TIMEOUT 300 #define BADAUTHWAIT 3000000 #define SMARTBIND @zerobind@ #define ZEROBIND @zerobind@ #define LOGINTRIES 3 #define RDNSTIMEOUT 15 #define LOGFILE "/var/log/muddleftpd.log" #define LOGINDUMP "(null)" #define EMAIL "ftp@localhost" #define SCRATCHFILE "/etc/muddleftpd/muddleftpd.scratch" #define PROGNAME "muddleftpd" #define VERSTR "1.3.13" #undef ACCESSCMD #undef DUMPCMD muddleftpd-1.3.13.1/install-sh0100755000175000017500000001270107554514276015111 0ustar joergjoerg#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else : fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=$mkdirprog fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f "$src" ] || [ -d "$src" ] then : else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else : fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else : fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else : fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else : fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 muddleftpd-1.3.13.1/configure0100755000175000017500000054725507751444707015035 0ustar joergjoerg#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57. # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="src/acl.c" # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subdirs_all="$ac_subdirs_all modules/auth/authlibmud" ac_subdirs_all="$ac_subdirs_all modules/auth/authlibsmb" ac_subdirs_all="$ac_subdirs_all modules/auth/authlibmsql" ac_subdirs_all="$ac_subdirs_all modules/auth/authlibmysql" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP subdirs zerobind LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-largefile omit support for large files Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-authmud create MUD authentication module. (no) --with-authsmb create SMB authentication module. (yes) --with-authmsql create mSQL authentication module. (no) --with-msqlpath specify the top level of the msql installation tree. (default is /usr/local/Hughes) --with-authmysql=DIR creates MySQL authentication module, optionally specifies the DIR of mysql files Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd "$ac_popdir" done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for main in -lcrypt" >&5 echo $ECHO_N "checking for main in -lcrypt... $ECHO_C" >&6 if test "${ac_cv_lib_crypt_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcrypt $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_crypt_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_crypt_main=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_crypt_main" >&5 echo "${ECHO_T}$ac_cv_lib_crypt_main" >&6 if test $ac_cv_lib_crypt_main = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBCRYPT 1 _ACEOF LIBS="-lcrypt $LIBS" fi echo "$as_me:$LINENO: checking for library containing connect" >&5 echo $ECHO_N "checking for library containing connect... $ECHO_C" >&6 if test "${ac_cv_search_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_connect=no cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); int main () { connect (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_connect="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_connect" = no; then for ac_lib in socket; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); int main () { connect (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_connect="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_connect" >&5 echo "${ECHO_T}$ac_cv_search_connect" >&6 if test "$ac_cv_search_connect" != no; then test "$ac_cv_search_connect" = "none required" || LIBS="$ac_cv_search_connect $LIBS" fi echo "$as_me:$LINENO: checking for library containing gethostbyname" >&5 echo $ECHO_N "checking for library containing gethostbyname... $ECHO_C" >&6 if test "${ac_cv_search_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_gethostbyname=no cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); int main () { gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_gethostbyname="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_gethostbyname" = no; then for ac_lib in nsl; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); int main () { gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_gethostbyname="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_search_gethostbyname" >&6 if test "$ac_cv_search_gethostbyname" != no; then test "$ac_cv_search_gethostbyname" = "none required" || LIBS="$ac_cv_search_gethostbyname $LIBS" fi echo "$as_me:$LINENO: checking for library containing dlopen" >&5 echo $ECHO_N "checking for library containing dlopen... $ECHO_C" >&6 if test "${ac_cv_search_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_dlopen=no cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_dlopen="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_dlopen" = no; then for ac_lib in dl; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_dlopen="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_dlopen" >&5 echo "${ECHO_T}$ac_cv_search_dlopen" >&6 if test "$ac_cv_search_dlopen" != no; then test "$ac_cv_search_dlopen" = "none required" || LIBS="$ac_cv_search_dlopen $LIBS" fi echo "$as_me:$LINENO: checking for main in -lpam" >&5 echo $ECHO_N "checking for main in -lpam... $ECHO_C" >&6 if test "${ac_cv_lib_pam_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpam $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_pam_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_pam_main=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_pam_main" >&5 echo "${ECHO_T}$ac_cv_lib_pam_main" >&6 if test $ac_cv_lib_pam_main = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBPAM 1 _ACEOF LIBS="-lpam $LIBS" fi echo "$as_me:$LINENO: checking for cap_init in -lcap" >&5 echo $ECHO_N "checking for cap_init in -lcap... $ECHO_C" >&6 if test "${ac_cv_lib_cap_cap_init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcap $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char cap_init (); int main () { cap_init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_cap_cap_init=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_cap_cap_init=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_cap_cap_init" >&5 echo "${ECHO_T}$ac_cv_lib_cap_cap_init" >&6 if test $ac_cv_lib_cap_cap_init = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBCAP 1 _ACEOF LIBS="-lcap $LIBS" fi ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include <$ac_hdr> int main () { if ((DIR *) 0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo "$as_me:$LINENO: checking for library containing opendir" >&5 echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 if test "${ac_cv_search_opendir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_opendir=no cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char opendir (); int main () { opendir (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_opendir="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_opendir" = no; then for ac_lib in dir; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char opendir (); int main () { opendir (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_opendir="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 echo "${ECHO_T}$ac_cv_search_opendir" >&6 if test "$ac_cv_search_opendir" != no; then test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" fi else echo "$as_me:$LINENO: checking for library containing opendir" >&5 echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 if test "${ac_cv_search_opendir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_opendir=no cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char opendir (); int main () { opendir (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_opendir="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_opendir" = no; then for ac_lib in x; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char opendir (); int main () { opendir (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_opendir="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 echo "${ECHO_T}$ac_cv_search_opendir" >&6 if test "$ac_cv_search_opendir" != no; then test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6 if test "${ac_cv_header_sys_wait_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_sys_wait_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_sys_wait_h=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 if test $ac_cv_header_sys_wait_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_SYS_WAIT_H 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in fcntl.h sys/time.h syslog.h unistd.h sys/uio.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in crypt.h dlfcn.h sys/capability.h netinet/in_systm.h stdarg.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 if test "${ac_cv_header_time+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_time=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_time=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 echo "${ECHO_T}$ac_cv_header_time" >&6 if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\_ACEOF #define TIME_WITH_SYS_TIME 1 _ACEOF fi echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6 if test "${ac_cv_struct_tm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct tm *tp; tp->tm_sec; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_struct_tm=time.h else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_struct_tm=sys/time.h fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 echo "${ECHO_T}$ac_cv_struct_tm" >&6 if test $ac_cv_struct_tm = sys/time.h; then cat >>confdefs.h <<\_ACEOF #define TM_IN_SYS_TIME 1 _ACEOF fi echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5 echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6 if test "${ac_cv_type_uid_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "uid_t" >/dev/null 2>&1; then ac_cv_type_uid_t=yes else ac_cv_type_uid_t=no fi rm -f conftest* fi echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5 echo "${ECHO_T}$ac_cv_type_uid_t" >&6 if test $ac_cv_type_uid_t = no; then cat >>confdefs.h <<\_ACEOF #define uid_t int _ACEOF cat >>confdefs.h <<\_ACEOF #define gid_t int _ACEOF fi echo "$as_me:$LINENO: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 if test "${ac_cv_type_signal+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #ifdef signal # undef signal #endif #ifdef __cplusplus extern "C" void (*signal (int, void (*)(int)))(int); #else void (*signal ()) (); #endif int main () { int i; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_signal=int fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF for ac_func in strftime do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else # strftime is in -lintl on SCO UNIX. echo "$as_me:$LINENO: checking for strftime in -lintl" >&5 echo $ECHO_N "checking for strftime in -lintl... $ECHO_C" >&6 if test "${ac_cv_lib_intl_strftime+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char strftime (); int main () { strftime (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_intl_strftime=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_intl_strftime=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_intl_strftime" >&5 echo "${ECHO_T}$ac_cv_lib_intl_strftime" >&6 if test $ac_cv_lib_intl_strftime = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRFTIME 1 _ACEOF LIBS="-lintl $LIBS" fi fi done for ac_func in mkdir rmdir select socket strstr do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking to see if snprintf work correctly" >&5 echo $ECHO_N "checking to see if snprintf work correctly... $ECHO_C" >&6 if test "$cross_compiling" = yes; then echo "$as_me:$LINENO: result: cross-compiling, assuming no" >&5 echo "${ECHO_T}cross-compiling, assuming no" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main() { FILE *outfile = fopen("snprintf-ok", "w"); char buffer[20]; int result; int ok; buffer[10] = 32; if (outfile == NULL) exit(1); result = snprintf(buffer, 10, "hellohellohello"); ok = 0; if ((result == 15) && (buffer[10] == 32)) ok = 1; if (ok) result = snprintf(NULL, 0, "hellohellohello"); if ((result == 15) && ok) fprintf(outfile, "yes"); else fprintf(outfile, "no"); fclose(outfile); exit(0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then SNPCOMPAT=`cat snprintf-ok` rm -f snprintf-ok echo "$as_me:$LINENO: result: $SNPCOMPAT" >&5 echo "${ECHO_T}$SNPCOMPAT" >&6 else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) echo "$as_me:$LINENO: result: error, assuming no" >&5 echo "${ECHO_T}error, assuming no" >&6 fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi if test "$SNPCOMPAT" = "yes"; then for ac_func in snprintf vsnprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done fi echo "$as_me:$LINENO: checking for off_t" >&5 echo $ECHO_N "checking for off_t... $ECHO_C" >&6 if test "${ac_cv_type_off_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((off_t *) 0) return 0; if (sizeof (off_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_off_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_off_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 echo "${ECHO_T}$ac_cv_type_off_t" >&6 # Check whether --enable-largefile or --disable-largefile was given. if test "${enable_largefile+set}" = set; then enableval="$enable_largefile" fi; if test "$enable_largefile" != no; then echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5 echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6 if test "${ac_cv_sys_largefile_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then ac_save_CC=$CC while :; do # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext CC="$CC -n32" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sys_largefile_CC=' -n32'; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5 echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6 if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5 echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6 if test "${ac_cv_sys_file_offset_bits+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else while :; do ac_cv_sys_file_offset_bits=no cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _FILE_OFFSET_BITS 64 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sys_file_offset_bits=64; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext break done fi echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5 echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6 if test "$ac_cv_sys_file_offset_bits" != no; then cat >>confdefs.h <<_ACEOF #define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits _ACEOF fi rm -f conftest* echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5 echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6 if test "${ac_cv_sys_large_files+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else while :; do ac_cv_sys_large_files=no cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _LARGE_FILES 1 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sys_large_files=1; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext break done fi echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5 echo "${ECHO_T}$ac_cv_sys_large_files" >&6 if test "$ac_cv_sys_large_files" != no; then cat >>confdefs.h <<_ACEOF #define _LARGE_FILES $ac_cv_sys_large_files _ACEOF fi rm -f conftest* fi for ac_func in memmove dlopen do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in strerror getspnam do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in usleep pam_start fgetpwent fgetgrent sendfile do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in cap_init seteuid setegid do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -rdynamic""... $ac_c" 1>&6 echo "configure: checking whether ${CC-cc} accepts -rdynamic" >&5 echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -rdynamic -c conftest.c 2>&1`"; then ac_cv_prog_cc_switch=yes else ac_cv_prog_cc_switch=no fi rm -f conftest* echo "$ac_t""$ac_cv_prog_cc_switch" 1>&6 if test "$ac_cv_prog_cc_switch" = yes; then CFLAGS="$ac_save_CFLAGS -rdynamic" else CFLAGS=$ac_save_CFLAGS fi # MUD module # Check whether --with-authmud or --without-authmud was given. if test "${with_authmud+set}" = set; then withval="$with_authmud" authmud=$withval else authmud=no fi; if test "$authmud" != no; then ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. subdirs="$subdirs modules/auth/authlibmud" modules="$modules authmud" fi # SMB module # Check whether --with-authsmb or --without-authsmb was given. if test "${with_authsmb+set}" = set; then withval="$with_authsmb" authsmb=$withval else authsmb=yes fi; if test "$authsmb" != no; then subdirs="$subdirs modules/auth/authlibsmb" modules="$modules authsmb" fi # MSQL module # Check whether --with-authmsql or --without-authmsql was given. if test "${with_authmsql+set}" = set; then withval="$with_authmsql" authmsql=$withval else authmsql=no fi; # Check whether --with-msqlpath or --without-msqlpath was given. if test "${with_msqlpath+set}" = set; then withval="$with_msqlpath" msqltop=$withval else msqltop=/usr/local/Hughes fi; if test "$authmsql" != no; then subdirs="$subdirs modules/auth/authlibmsql" modules="$modules authmsql" fi # MYSQL module # Check whether --with-authmysql or --without-authmysql was given. if test "${with_authmysql+set}" = set; then withval="$with_authmysql" authmysql="$withval" else authmysql=no fi; if test "$authmysql" != no; then subdirs="$subdirs modules/auth/authlibmysql" modules="$modules authmysql" fi # work out zerobind default (false on linux, true on other systems) case `uname -s` in Linux) zero_bind=FALSE ;; *) zero_bind=TRUE ;; esac zerobind="$zero_bind" ac_config_files="$ac_config_files Makefile src/Makefile doc/Makefile defaults.h" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by $as_me, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "defaults.h" ) CONFIG_FILES="$CONFIG_FILES defaults.h" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@subdirs@,$subdirs,;t t s,@zerobind@,$zerobind,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi # # CONFIG_SUBDIRS section. # if test "$no_recursion" != yes; then # Remove --cache-file and --srcdir arguments so they do not pile up. ac_sub_configure_args= ac_prev= for ac_arg in $ac_configure_args; do if test -n "$ac_prev"; then ac_prev= continue fi case $ac_arg in -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ | --c=*) ;; --config-cache | -C) ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) ;; *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; esac done # Always prepend --prefix to ensure using the same prefix # in subdir configurations. ac_sub_configure_args="--prefix=$prefix $ac_sub_configure_args" ac_popdir=`pwd` for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue # Do not complain, so a configure script can configure whichever # parts of a large source tree are present. test -d $srcdir/$ac_dir || continue { echo "$as_me:$LINENO: configuring in $ac_dir" >&5 echo "$as_me: configuring in $ac_dir" >&6;} { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then ac_sub_configure="$SHELL '$ac_srcdir/configure.gnu'" elif test -f $ac_srcdir/configure; then ac_sub_configure="$SHELL '$ac_srcdir/configure'" elif test -f $ac_srcdir/configure.in; then ac_sub_configure=$ac_configure else { echo "$as_me:$LINENO: WARNING: no configuration information is in $ac_dir" >&5 echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} ac_sub_configure= fi # The recursion is here. if test -n "$ac_sub_configure"; then # Make the cache file name correct relative to the subdirectory. case $cache_file in [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; *) # Relative path. ac_sub_cache_file=$ac_top_builddir$cache_file ;; esac { echo "$as_me:$LINENO: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 echo "$as_me: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} # The eval makes quoting arguments work. eval $ac_sub_configure $ac_sub_configure_args \ --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir || { { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5 echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;} { (exit 1); exit 1; }; } fi cd $ac_popdir done fi echo echo Muddleftpd is now ready to be compiled! echo echo Modules selected for compile: $modules echo muddleftpd-1.3.13.1/config.h.in0100644000175000017500000001142307751444710015122 0ustar joergjoerg/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the `cap_init' function. */ #undef HAVE_CAP_INIT /* Define to 1 if you have the header file. */ #undef HAVE_CRYPT_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the `dlopen' function. */ #undef HAVE_DLOPEN /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `fgetgrent' function. */ #undef HAVE_FGETGRENT /* Define to 1 if you have the `fgetpwent' function. */ #undef HAVE_FGETPWENT /* Define to 1 if you have the `getspnam' function. */ #undef HAVE_GETSPNAM /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `cap' library (-lcap). */ #undef HAVE_LIBCAP /* Define to 1 if you have the `crypt' library (-lcrypt). */ #undef HAVE_LIBCRYPT /* Define to 1 if you have the `pam' library (-lpam). */ #undef HAVE_LIBPAM /* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `mkdir' function. */ #undef HAVE_MKDIR /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_SYSTM_H /* Define to 1 if you have the `pam_start' function. */ #undef HAVE_PAM_START /* Define to 1 if you have the `rmdir' function. */ #undef HAVE_RMDIR /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT /* Define to 1 if you have the `sendfile' function. */ #undef HAVE_SENDFILE /* Define to 1 if you have the `setegid' function. */ #undef HAVE_SETEGID /* Define to 1 if you have the `seteuid' function. */ #undef HAVE_SETEUID /* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF /* Define to 1 if you have the `socket' function. */ #undef HAVE_SOCKET /* Define to 1 if you have the header file. */ #undef HAVE_STDARG_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the `strftime' function. */ #undef HAVE_STRFTIME /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strstr' function. */ #undef HAVE_STRSTR /* Define to 1 if you have the header file. */ #undef HAVE_SYSLOG_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_CAPABILITY_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_UIO_H /* Define to 1 if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `usleep' function. */ #undef HAVE_USLEEP /* Define to 1 if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES /* Define to `int' if doesn't define. */ #undef gid_t /* Define to `int' if doesn't define. */ #undef uid_t