eaiovnaovbqoebvqoeavibavo PK9iZ@_@@man5/freetds.conf.5nu[.Dd May 2, 2017 .Os FreeTDS 1.4.9 .Dt FREETDS.CONF "FreeTDS 5" "FreeTDS Reference Manual" . .Sh NAME .Nm freetds.conf .Nd configuration file for FreeTDS . .Sh SYNOPSIS The .Pa freetds.conf file describes Sybase and Microsoft database servers to the FreeTDS library. It comprises sections headed by a servername, followed by a list of connection properties denoted as name-value pairs. Defaults are defined via a .Bq global section. This file supersedes the .Pa interfaces file that Sybase defines for the same purpose, although the latter is still supported. . .Sh DESCRIPTION A section begins with a servername \(em the name of the server \(em in square brackets. The servername is chosen at the client's descretion. (One exception: with Sybase ASA the servername must match the database name to be used.) .Pp Sections contain properties, one per line, in the form .Pp .Dl name = value .Pp where .Ar name is the connection property to be described. Servernames and properties are not case sensitive. Values are case-preserving i.e., copied literally. Comments begin with either a semicolon .Pq So ; Sc or pound sign .Pq So # Sc and continue to end of line. Blank lines are ignored. Whitespace surrounding the .So = Sc is ignored. . .Sh PROPERTIES .Bl -tag -width "emulate little endian" -compact . .It client charset encoding of client data; overrides locale(1) settings .Bl -tag -width "default:" -compact .It Domain: iconv character set names .It Default: ISO-8859-1 .El . .It connect timeout seconds to wait for response from connect request .Bl -tag -width "default:" -compact .It Domain: 0 to MAX_INT .It Default: none .El . .It debug flags logging granularity .Bl -tag -width "default:" -compact .It Domain: 32-bit integer .It Default: 0x4fff .El . .It dump file specifies location of a logfile and turns on logging .Bl -tag -width "default:" -compact .It Domain: valid file name .It Default: none .El . .It dump file append log data appended to file instead of re-writing for each connection .Bl -tag -width "default:" -compact .It Domain: yes/no .It Default: no .El . .It emulate little endian forces big endian machines to act as little endian to communicate with Microsoft Servers .Bl -tag -width "default:" -compact .It Domain: yes/no .It Default: no .El . .It encryption .Bl -tag -compact .It Em off disables encryption .It Em request use if available (default when tds version greater than 7.0) .It Em required allow encrypted connections only .El . .It host Name of the host the server is running on. .Bl -tag -width "default:" -compact .It Domain: host name or IP address .It Default: SYBASE .El . .It initial block size maximum size of a protocol block .Bl -tag -width "default:" -compact .It Domain: multiple of 512 .It Default: 512 .El . .It instance name of Microsoft SQL Server instance to connect to (supersedes .Em port ) .Bl -tag -width "default:" -compact .It Domain: instance name .It Default: none .El . .It port port number that the server is listening to .Bl -tag -width "default:" -compact .It Domain: any valid port .It Default: TDS 5.0, 5000; TDS 7.0 and up, 1433 .El . .It tds version TDS protocol version to use .Bl -tag -width "default:" -compact .It Domain: 4.2, 5.0, 7.0, 7.1, 7.2 .It Default: .Fl -with-tdsver value (5.0 if unspecified) .El . .It text size default value of TEXTSIZE, in bytes .Bl -tag -width "default:" -compact .It Domain: 0 to 4,294,967,295 .It Default: 4,294,967,295 .El . .It timeout seconds to wait for response to a query .Bl -tag -width "default:" -compact .It Domain: 0 to MAX_INT .It Default: none (wait forever) .El . .El .Pp Do not define both .Fa port and .Fa instance Ns \&. One implies the other. .Pp Boolean property values may be denoted as on/off, true/false, or 1/0. . .Ss DEBUG FLAGS The log's granularity can be controlled with the .Em debug flags property. .Bl -column -offset indent ".Sy 0x8000" ".Sy show source level info (source file and line)" .It Sy Value Ta Sy Meaning .It Li \ \ 0x02 severe error .It Li \ \ 0x04 error .It Li \ \ 0x08 warning .It Li \ \ 0x10 network .It Li \ \ 0x20 information level 1 .It Li \ \ 0x40 information level 2 .It Li \ \ 0x80 function trace and info .It Li 0x1000 show pid .It Li 0x2000 show time .It Li 0x4000 show source level info (source file and line) .It Li 0x8000 thread id (not implemented). .El . .Sh NAMES AND LOCATIONS The file is normally named .Pa /etc/freetds.conf or .Pa ${HOME}/.freetds.conf . That name can be overridden with the FREETDSCONF environment variable. .Pp FreeTDS will search conf files for a servername in the following order: .Bl -enum -offset indent -compact .It a filename set programatically via dbsetifile() that is in .conf format .It a filename in the environment variable FREETDSCONF that is in .conf format .It .Pa ${HOME}/.freetds.conf if extant .It .Pa /opt/cpanel/freetds/etc/freetds.conf .El .Pp The search stops with the first file containing the servername. .Pp If no conf file is found, FreeTDS searches for an .Pa interfaces file in the following order: .Bl -enum -offset indent -compact .It a filename set programatically via dbsetifile() that is in .Pa interfaces format .It .Pa ${HOME}/.interfaces .It .Pa $SYBASE/interfaces (where .Ev $SYBASE is an environment variable) .El .Pp If the requested servername is not found in any configuration file, the fallback mechanism is: .Bl -enum -offset indent -compact .It attempt to convert the name to an IP address with inet_addr(3), else .It attempt to convert the name to an IP address with gethostbyname(3), else .It attempt to look up the literal name .Dq SYBASE .El . .Sh ENVIRONMENT .Bl -tag -width "TDSDUMPCONFIG" -compact .It Ev FREETDSCONF overrides name and location of the system-wide conf file .It Ev TDSDUMP overrides the name and location of the FreeTDS log file .It Ev TDSDUMPCONFIG specifies a name and location of a file that logs the search of configuration files .It Ev TDSHOST overrides the host property .It Ev TDSPORT overrides the port property .It Ev TDSQUERY synonym for DSQUERY, the default servername .It Ev TDSVER overrides the version specified in the freetds.conf .El .Pp The environment variables .Ev TDSVER, Ev TDSDUMP, Ev TDSPORT, Ev TDSQUERY, and Ev TDSHOST override values set by a .conf or .Pa interfaces file. . .Sh FILES .Pa /opt/cpanel/freetds/etc/freetds.conf , ${HOME}/.freetds.conf . .Sh SEE ALSO .%B FreeTDS User Guide . .Sh HISTORY \.conf files first appeared with version 0.53 of FreeTDS. PK9iZ@G(O O man1/bsqlodbc.1nu[.\" cf. groff_mdoc .Dd March 25, 2015 .Os FreeTDS 1.4.9 .Dt BSQLODBC FreeTDS "FreeTDS Reference Manual" .\" .Sh NAME .Nm bsqlodbc .Nd batch SQL script processor using ODBC .\" .Sh SYNOPSIS .Pp .Nm .Op Fl hqv .Op Fl U Ar username .Op Fl P Ar password .Op Fl S Ar server .Op Fl D Ar database .Op Fl i Ar input_file .Op Fl o Ar output_file .Op Fl e Ar error_file .Op Fl t Ar field_term .Op Fl V Ar odbc_version .\" .Sh DESCRIPTION .Pp .Nm is a utility program distributed with FreeTDS. .Pp .Nm is a non-interactive equivalent of the .Ql isql utility programs distributed by Sybase and Microsoft. Like them, .Nm uses the command .Ql go on a line by itself as a separator between batches. The last batch need not be followed by .Ql go . .Pp .Nm makes use of the ODBC API provided by FreeTDS. This API is of course also available to application developers. .\" .Sh OPTIONS .Bl -tag -width indent .It Fl U Ar username Database server login name. .It Fl P Ar password Database server password. .It Fl S Ar server Database server to which to connect. .It Fl D Ar database Database to use. .It Fl i Ar input_file Name of script file, containing SQL. .It Fl o Ar output_file Name of output file, holding result data. .It Fl e Ar error_file Name of file for errors. .It Fl t Ar field_term Specifies the field terminator. Default is two spaces ( .Ql \ \ .Ns ). Recognized escape sequences are tab ( .Ql \et .Ns ), carriage return ( .Ql \er .Ns ), newline ( .Ql \en .Ns ), and backslash ( .Ql \e\e .Ns ). .It Fl h Print column headers with the data to the same file. .It Fl q Do not print column metadata, return status, or rowcount. Overrides .Fl h . .It Fl v Verbose mode, for more information about the ODBC interaction. This also reports the result set metadata, including and return code. All verbose data are written to standard error (or .Fl e Ns ), so as not to interfere with the data stream. .It Fl V Ar odbc_version Specify ODBC version (2 or 3). .El .\" .Sh NOTES .Pp .Nm is a filter; it reads from standard input, writes to standard output, and writes errors to standard error. The .Fl i , .Fl o , and .Fl e options override these defaults. .Sh EXIT STATUS .Nm exits 0 on success, and >0 if the server cannot process the query. .\" .Sh HISTORY .Nm first appeared in FreeTDS 0.65. .\" .Sh AUTHORS The .Nm utility was written by .An James K. Lowden Aq jklowden@freetds.org . PK9iZ(ܶ man1/bsqldb.1nu[.\" cf. groff_mdoc .Dd March 26, 2015 .Dt BSQLDB 1 .Os FreeTDS 1.4.9 .Sh NAME .Nm bsqldb .Nd batch SQL script processor using DB-Library .Sh SYNOPSIS .Nm .Op Fl hqv .Op Fl S Ar servername .Op Fl D Ar database .Op Fl U Ar username .Op Fl P Ar password .Op Fl i Ar input_file .Op Fl o Ar output_file .Op Fl e Ar error_file .Op Fl H Ar hostname .Op Fl t Ar field_term .Op Fl R Ar pivot_description .\" .Sh DESCRIPTION .Nm is a utility program distributed with FreeTDS. .Nm is a non-interactive equivalent of the "isql" utility programs distributed by Sybase and Microsoft. Like them, .Nm uses the command "go" on a line by itself as a separator between batches. The last batch need not be followed by "go". .Nm makes use of the DB-Library API provided by FreeTDS. This API is of course also available to application developers. .Sh OPTIONS .Bl -tag -width indent .It Fl D Ar database Database to use. .It Fl H Ar hostname hostname Override name of client sent to server. .It Fl P Ar password Database server password. .It Fl S Ar servername Database server to which to connect. .It Fl U Ar username Database server login name. If username is not provided, a domain login is attempted for TDS 7+ connections. .It Fl e Ar error_file Name of file for errors. .It Fl h Print column headers with the data to the same file. .It Fl i Ar input_file Name of script file, containing SQL. .It Fl o Ar output_file Name of output file, holding result data. .It Fl q Do not print column metadata, return status, or rowcount. Overrides .Fl h Ns . .It Fl t Ar field_term Specifies the field terminator. Default is two spaces (' '). Recognized escape sequences are tab ('\\t'), carriage return ('\\r'), newline ('\\n'), and backslash ('\\\\'). .It Fl v Verbose mode, for more information about the DB-Library interaction. This also reports the result set metadata, including and return code. All verbose data are written to standard error (or .Fl e Ns ), so as not to interfere with the data stream. .It Fl R Ar pivot_description Specify pivot trasformation. The format is .Ao Ar down\ columns Ac .Ao Ar across\ columns Ac .Ao Ar function Ac .Ao Ar value Ac . Columns are specified but numbers. The format of .Ar down columns and .Ar across columns is a comma separated list of columns. .Ar function is either count, sum, min or max. .El .\" .Sh ENVIRONMENT .Ev DSQUERY default .Ar servername .\" .Sh NOTES .Nm is a filter; it reads from standard input, writes to standard output, and writes errors to standard error. The .Fl i Ns , Fl o Ns , and Fl e options override these defaults. .Pp The source code for .Nm is intended as a model for DB-Library users. DB-Library has a rich set of functions, and it can be hard sometimes to understand how to use them, particularly the first time. If you find something about the source code unclear, you are encouraged to email the author your comments. .\" .Sh EXIT STATUS .Nm exits 0 on success, and >0 if the server cannot process the query. .Pp For messages with severity > 10, .Nm calls exit(3) with the severity level. For example, if the severity level is 16, .Nm will return an exit status of 16 to the shell. .\" .Sh HISTORY .Nm first appeared in FreeTDS 0.63. .\" .Sh AUTHORS The .Nm utility was written by .An "James K. Lowden" Aq jklowden@freetds.org . .\" .Sh BUGS Microsoft servers as of SQL Server 7.0 SP 3 do not return output parameters unless the RPC functions are used. This means .Nm cannot return output parameters for stored procedures with these servers. PK9iZsZ88 man1/fisql.1nu[.\" cf. groff_mdoc .Dd March 25, 2015 .Os FreeTDS 1.4.9 .Dt FISQL FreeTDS "FreeTDS Reference Manual" .\" .Sh NAME .Nm fisql .Nd interactive SQL shell .\" .Sh SYNOPSIS .Pp .Nm .Op Fl eFgpnvXY .Op Fl a Ar display_charset .Op Fl A Ar packet_size .Op Fl c Ar cmdend .Op Fl D Ar database .Op Fl E Ar editor .Op Fl h Ar headers .Op Fl H Ar hostname .Op Fl i Ar inputfile .Op Fl I Ar interfaces_file .Op Fl J Ar client_charset .Op Fl l Ar login_timeout .Op Fl m Ar errorlevel .Op Fl o Ar outputfile .Op Fl P Ar password .Op Fl s Ar colseparator .Op Fl S Ar server .Op Fl t Ar timeout .Op Fl U Ar username .Op Fl w Ar width .Op Fl y Ar sybase_dir .Op Fl z Ar language .\" .Sh DESCRIPTION .Pp .Nm is very similar to the .Ql isql utility programs distributed by Sybase and Microsoft. Like them, .Nm uses the command .Ql go on a line by itself as a separator between batches. .\" .Sh OPTIONS .Bl -tag -width indent .It Fl a Ar display_charset The client charset name. Not implemented. .It Fl A Ar packet_size Set protocol packet size. You should not need to set this parameter. .It Fl c Ar cmdend Command terminator, defaults to .Ql go Ns . .It Fl D Database name on the server to use. .It Fl e Echo SQL input (usually in outputfile) .It Fl E Ar editor Specify an editor to invoke. Defaults to vi. .It Fl F FIPS mode ON. Server returns a message (but processes the query anyway) when it encounters a non-standard SQL command. .It Fl g Display a brief help message .It Fl h Ar headers Number of rows after which to repeat the column headers. Default is once per resultset. .It Fl H Ar hostname Hostname of the client machine as it will be told to the server. .It Fl I Ar interfaces_file Name of the interfaces or freetds.conf file to use. .It Fl i Ar inputfile Name of script file, containing SQL. .It Fl J Ar client_charset Not implemented. .It Fl l Ar login_timeout How long to wait for the server to acknowledge a login attempt. .It Fl m Ar errorlevel For errors of the severity level specified or higher, print only the message number, state, and error level. Below that level, print nothing. .It Fl n Suppress line numbers in echoed output. .It Fl o Ar outputfile Name of output file, holding result data. .It Fl p Prints performance statistics. Not implemented. .It Fl P Ar password Database server password. .It Fl s Ar colseparator The column separator. Default is space. Shell metacharacters require quoting. .It Fl S Ar server Database server to which to connect. .It Fl t Ar timeout The query timeout, in seconds. How long to wait for a query to be processed. The default is indefinitely, or as determined by freetds.conf. .It Fl U Ar username Database server login name. .It Fl v Display version and copyright. .It Fl w Ar width How many characters wide to print the output. Defaults to 80. .It Fl X Use encrypted login. Not implemented in FreeTDS. .It Fl y Pa sybase_dir Sets the .Ev SYBASE environment variable. Not used by FreeTDS. .It Fl Y Use chained transactions. .It Fl z Ar language Name of a language for fisql's prompts and messages. Cf. DBSETLNATLANG. .El .\" .Sh NOTES .Nm is a filter; it reads from standard input, writes to standard output, and writes errors to standard error. The .Fl i Ns , .FL o Ns , and .Fl e options override these defaults. .Pp .Nm uses the DB-Library API provided by FreeTDS. It was first implemented using Sybase's own library and continues to work with it. Before (and after) modifying it, it would be well to test it with Sybase's library to assure compatibility between it and FreeTDS. EXIT STATUS .Pp .Nm exits 0 on success, and >0 if the server cannot process the query. .Pp .Nm will report any errors returned by the server, but will continue processing. In a production environment, this behavior may be insufficiently stringent. To make it extremely intolerant of errors, change the message and error handlers to call exit(3). .\" .Sh HISTORY .Nm first appeared in FreeTDS 0.65. .\" .Sh AUTHORS The .Nm utility was written by .An Nicholas S. Castellano Aq entropy@freetds.org Ns , who contributed it to the FreeTDS project under the terms of the GPL. .\" .Sh BUGS Requires the GNU readline library. PK9iZgo o man1/datacopy.1nu[.\" cf. groff_mdoc .Dd March 25, 2015 .Os FreeTDS 1.4.9 .Dt DATACOPY FreeTDS "FreeTDS Reference Manual" .\" .Sh NAME .Nm datacopy .Nd move table data between two servers .\" .Sh SYNOPSIS .Nm .Op Fl vdE .Bro .Fl t | .Fl a | .Fl c .Ar owner .Brc .Op Fl b Ar batchsize .Op Fl p Ar packetsize .Op Fl S Ar server/username/password/database/table_or_view .Op Fl D Ar server/username/password/database/table .Op Fl T Ar textsize .\" .Sh DESCRIPTION .Nm is a utility distributed with FreeTDS. .Nm will move table data from one server to another without the need for intermediate files. .Nm is much faster and more efficient than is freebcp out/in. .Pp .Nm makes use of the db-lib bcp API built into FreeTDS. This API is also available to application developers. .Pp .Nm can be used to migrate data between Sybase ASE and SQL Server or vice versa. .\" .Sh OPTIONS .Bl -tag -width indent .It Fl t Truncate target table before loading data. .It Fl a Append data to target table. .It Fl c Ar owner Create the target table with the same schema as the source table. .Nm will submit a .Ql CREATE TABLE command on the target server using the specified owner in the command, e.g. .Ql CREATE TABLE owner.table (.\|.\|.\&). .It Fl b Ar batchsize The number of rows per batch of data copied. Each batch of data is effectively 'committed' to the database. The default is 1000. .It Fl p Ar packetsize The number of bytes, per network packet, sent to and from the servers. Increased packet size can enhance performance. .It Fl T Ar textsize Specify size of TEXT/IMAGE column from network. .It Fl v Produce verbose output, including diagnostic timings. .It Fl d Produce freetds TDSDUMP output. (Serious debug only!) .It Fl S Ar server/username/password/database/table_or_view The connection information for the source server and the location/name of the table (or view) to be copied. If not specified, .Nm prompts the user for the information. .It Fl D Ar server/username/password/database/table The connection information for the destination server and the location/name of the target table. If not specified, .Nm prompts the user for the information. .It Fl E Keep identity values. .Sh SEE ALSO .Xr freebcp 1 , Xr defncopy 1 , Xr bsqldb 1 , Xr tsql 1 , .%B FreeTDS User Guide. .\" .Sh HISTORY .Pp .Nm first appeared in FreeTDS 0.64. .\" .Sh AUTHORS The .Nm utility was written by .An Bill Thompson Aq thompbil@exchange.uk.ml.com . PK9iZW man1/tsql.1nu[.\" cf. groff_mdoc .Dd March 25, 2015 .Os FreeTDS 1.4.9 .Dt TSQL FreeTDS "FreeTDS Reference Manual" .Sh NAME .Nm tsql .Nd utility to test FreeTDS connections and queries .Sh SYNOPSIS .Nm .Bro .Fl S Ar servername .Op Fl I Ar interface | .Fl H Ar hostname .Op Fl L .Op Fl p Ar port .Brc .Op Fl D Ar dbname .Op Fl U Ar username .Op Fl P Ar password .Op Fl o Ar options .Nm .Fl C .Sh DESCRIPTION .Nm is a FreeTDS diagnostic tool. It uses the TDS protocol to connect to a Sybase or Microsoft SQL Server, and lets the user issue queries. .Nm does not use the FreeTDS client libraries. Instead, it uses only the lowest level library, libtds, to test the protocol implementation. .Pp .Nm can be run in two ways, one which uses the freetds.conf and one which connects directly using the server's hostname and port. The .Fl H and .Fl p parameters are provided to let the user verify a server is listening on the named host and port. These parameters override any configuration files and environment variables. .Pl The .Fl S parameter can be used to test the local configuration. FreeTDS will use freetds.conf (or equivalent) and environment variables in the normal way to determine the server's IP address and port. You can use .Fl I to specify a filename, overriding FreeTDS's configuration file search algorithm. .Sh OPTIONS .Bl -tag -width indent .It Fl S Ar servername database server to which to connect. .It Fl D Ar dbname database to use. .It Fl I Ar interface freetds.conf or interfaces file describing servername. .It Fl H Ar hostname DNS hostname of the server. .It Fl p Ar port port at which SQL Server is listening. .It Fl U Ar username database login name. If username is not provided, a domain login is attempted for TDS 7+ connections. .It Fl P Ar password database password. .It Fl L list Microsoft server instances (with .Fl H Ns ). .It Fl C print some of the compile-time configuration parameters. .It Fl o Ar options apply the options specified to every command. .Bl -tag -width indent .It Fl f No footer .Bq result count .It Fl h No header .Bq titles .It Fl t Print time .It Fl v Print version .It Fl q Quiet .El .It Fl a Ar appname application name. .It Fl t Ar colterm column terminator. .It Fl r Ar rowterm row terminator. .It Fl r Ar rowterm row terminator. .It Fl J Ar charset character set. .It Fl v verbose mode. .El .\" .Sh NOTES If you can connect with .Ql tsql -S servername Ns , your basic FreeTDS installation is working. .Pp Typing .Ql exit Ns , .Ql quit Ns , or .Ql bye (or .Li ^D Ns ) exits .Nm Ns . .Pp Typing .Ql version displays the TDS protocol version. .Pp Command batches may be separated with .Ql go or .Ql GO Ns . If .Ql GO the version string is reported before executing the batch. .Pp After prompting for the password (if not provided with .Fl P Ns ), .Nm will attempt to connect to the remote server. .Nm displays a counter indicating the number of seconds elapsed during the connection attempt. Typically, .Nm immediately responds with a .Ql 1> prompt. If you see the counter (1, 2, 3, ...), most likely .Nm is unable to connect to the indicated server. .Pp .Nm is not a replacement for a complete isql such as sqsh (www.sqsh.org). If you have suggestions for ways to make .Nm more useful as a diagnostic tool, please post them to the FreeTDS mailing list for consideration. .Sh HISTORY .Nm first appeared in FreeTDS 0.60. .Sh AUTHORS The .Nm utility was written by .An Brian Bruns Ns . .Sh BUGS Several, to be sure, now that it's documented. :) PK9iZ; ; man1/defncopy.1nu[.\" cf. groff_mdoc .Dd April 26, 2012 .Os FreeTDS 1.4.9 .Dt DEFNCOPY FreeTDS "FreeTDS Reference Manual" .\" .Sh NAME .Nm defncopy .Nd extract procedures and views from a Microsoft server. .\" .Sh SYNOPSIS .Pp .Nm .Op Fl v .Op Fl U Ar username .Op Fl P Ar password .Op Fl S Ar server .Op Fl D Ar database .Op Fl i Ar input_file .Op Fl o Ar output_file .Bo .Ar owner.object_name .\" Elipsis according to Werner Lemberg: .\" http://www.mail-archive.com/groff@gnu.org/msg03122.html .Op Ar owner.object_name .\|.\|.\& .Bc .\" .Sh DESCRIPTION .Pp .Nm is a utility program distributed with FreeTDS. It replaces a similar program of the same name distributed by Sybase. .Pp .Nm reads the text of a stored procedure or view, and writes a script suitable for recreating the procedure or view. For tables, it reads the output of sp_help and constructs a .Ql CREATE TABLE statement, complete with .Ql CREATE INDEX Ns , too. .\" .Ar owner is optional if you or the database owner is the owner of the procedure/view being copied. .Ar object_name is the name of the system object you wish to extract. .\" .Sh OPTIONS .Bl -tag -width indent .It Fl U Ar username database server login name. .It Fl P Ar password database server password. .It Fl S Ar server database server to which to connect. .It Fl D Ar database database to use. Optional if the procedure/view being extracted is in your default database. .It Fl i Ar input_file a script to apply to the database. Not currently implemented. .It Fl o Ar output_file a file to hold the script, defaults to standard output. .It Fl v Show version information and copyright notice. .El .\" .Sh NOTES .Nm is a filter; it reads from standard input, writes to standard output, and writes errors to standard error. The .Fl i , .Fl o , and .Fl e options override these defaults. .Pp .Nm makes use of the db-lib API provided by FreeTDS. This API is of course also available to application developers. .Sh EXIT STATUS .Pp .Nm exits 0 on success, and >0 if the server cannot process the query. .Pp .Nm will report any errors returned by the server, but will continue processing. .\" .Sh HISTORY .Pp .Nm first appeared in FreeTDS 0.63. .\" .Sh AUTHORS The .Nm utility was written by .An James K. Lowden Aq jklowden@schemamania.org. .\" .Sh BUGS Works only with Microsoft servers and ancient Sybase servers. Does not create primary keys. Many options are defined by Sybase that this version does not implement. Feel free to correct this situation. In theory, .Nm could apply/produce DDL for any system object, but at present only tables, procedures and views are supported, and only for extraction. PK9iZufz man1/osql.1nu[.\" cf. groff_mdoc .Dd April 26, 2012 .Os FreeTDS 1.4.9 .Dt OSQL FreeTDS "FreeTDS Reference Manual" .\" .Sh NAME .Nm osql .Nd utility to test FreeTDS connections and queries .\" .Sh SYNOPSIS .Pp .Nm .Fl S Ar dsn .Fl U Ar username .Fl P Ar password .Op Fl I Pa ini_directory .\" .Sh DESCRIPTION .Pp .Nm is a diagnostic tool provided as part of FreeTDS. It is a Bourne shell script that checks and reports on your configuration files. If everything checks out OK, it invokes isql. .Pp .Nm works only with the isql that comes with unixODBC. .\" .Sh OPTIONS .Bl -tag -width indent .It Fl S Ar dsn the Data Source Name to which to connect, as known to .Pa odbc.ini Ns . .It Fl U Ar username database login name. .It Fl P Ar password database password. .It Fl I Ar ini_dir override .Pa odbc.ini file location. .El .\" .Sh EXAMPLE If you have an .Pa odbc.ini with a section like this: .Bd -literal -offset indent .Bq myDSN servername = myserver TDS_Version = 5.0 .Ed .Pp You would invoke .Nm as: .Pp .Li osql -S myDSN .Op .\|.\|.\& .\" .Sh FILES .Pa odbc.ini .Pa freetds.conf .\" .Sh NOTES If you can connect with .Ql osql -S servername -U user -P passwd Ns , your FreeTDS ODBC installation is working. .Pp .Nm guesses where unixODBC might look for its .Pa odbc.ini by examining the binary. This is not always an effective approach. If it doesn't work, you'll receive a report of candidate strings. Kindly pass along the output to help improve the guessing. .Pp If .Nm cannot intuit your .Pa odbc.ini directory, you can force the issue with the .Fl I option. However, you're then instructing .Nm what to test, not where unixODBC will eventually look. Your override is therefore only as good as you are. Look carefully at the error output before overriding. .Pp If you have suggestions for ways to make .Nm more useful as a diagnostic tool, please post them to the FreeTDS mailing list. .\" .Sh HISTORY .Nm first appeared in FreeTDS 0.65. .\" .Sh AUTHORS The .Nm utility was written by .An James K. Lowden Ns . PK9iZxman1/freebcp.1nu[.\" cf. groff_mdoc .Dd March 25, 2015 .Os FreeTDS 1.4.9 .Dt FREEBCP 1 .Sh NAME .Nm freebcp .Nd bulk loading utility for Sybase and Microsoft databases .Sh SYNOPSIS .Nm .Bo Bo Ao Ar database Ac Ns . Bc Ns Ao Ar owner Ac Ns . Bc Ns Aq Ar object_name .Bro .Ar in | .Ar [query] Ns Ar out .Brc .Ar datafile .Bro .Fl c | .Fl n | .Fl f Ar formatfile .Brc .Op Fl S Ar servername .Op Fl D Ar dbname .Op Fl U Ar username .Op Fl P Ar password .Op Fl b Ar batchsize .Op Fl F Ar firstrow .Op Fl L Ar lastrow .Op Fl e Ar errfile .Op Fl I Ar interfaces .Op Fl m Ar maxerror .Op Fl t Ar field_term .Op Fl r Ar row_term .Op Fl h Ar hints .Op Fl T Ar textsize .Op Fl A Ar packet_size .Op Fl O Ar options .Op Fl i Ar inputfile .Op Fl o Ar outputfile .Op Fl C Ar charset .Op Fl EdVv .\" .Sh DESCRIPTION .Nm is a utility program distributed with FreeTDS. .Nm replicates (in part at least) the functionality of the bcp utility programs distributed by Sybase and Microsoft. .Nm makes use of the DB-Library bcp API provided by FreeTDS. This API is also available to application developers. .Pp The manual pages or online help for Sybase or SQL Server can be referenced for more detailed information on bcp functionality. .\" .Sh TABLES\ AND\ FILES .Bl -tag -width indent .It Ar database The name of the database containing object to be copied. Optional if the table/view is in the default database for .Ar username . .It Ar schema The schema of the object being copied. If not provided, the default schema for .Ar username is used. .It Ar object The name of the database object you wish to access, typically a table. It can also be a view. All views can be read; some can be written, subject to constraints. With .Ar queryout Ns , Ar object can also be an SQL query. .It Ar in Copy data from a host file to a database table. .It Ar out Copy data from a database table to a host file. .It Ar queryout indicates that .Ar table_name is in fact SQL, rather than a database object. .Nm will execute the query and write the results to a file. (It is a good idea to have the query return one and only one result set.) .It Ar datafile The name of an operating system file. .El .\" .Sh OPTIONS .Bl -tag -width indent .It Fl A Ar packet_size Set the size of a TDS packet to packet_size. Not sure why you would want to do this, except as an experiment. .It Fl D Ar dbname The name of the default database to use. Overrides default database associated with the login account. Causes .Nm to issue a .Ic USE Ar dbname command immediately after logging in, before commencing BCP operations. .It Fl E Write the data in datafile to the table's IDENTITY column. Without this flag, the identity data present in the datafile will be ignored, and new IDENTITY values will be generated for the imported rows. .It Fl F Ar firstrow The first row to copy from the input file or database table. The default is the first row, row 1. .It Fl I Ar interfaces The name and location of the .Pa interfaces file to search when connecting to servername. Overrides .Pa freetds.conf. .It Fl L Ar lastrow The last row to copy from an input file or database table. The default is the last row. .It Fl O Ar options SQL text to set connection options prior to the bcp operation. If .Ar options is a valid filename, the SQL is read from the file instead. Sometimes needed for .Ar queryout . Example: .Li -O `SET QUOTED_IDENTIFIER ON' Ns . .It Fl P Ar password The password associated with .Ar username . .It Fl S Ar servername The name of the Database Server to which to connect. .It Fl T Ar textsize For text or image columns, set the maximum number of characters to request from the server. Defaults to the setting in .Pa freetds.conf . If not specified anywhere, defaults to the full size of the data. .It Fl U Ar username A database login name. For TDS\ 7+ connections, a domain login is attempted if .Ar username is not provided. .It Fl b Ar batchsize The number of rows per batch of data copied. Batching applies only when you are bulk copying into the database. Each batch of data is effectively .Dq committed into the database. The default value for .Ar batchsize is 1000. .It Fl c The host data file is (or will be) in "character" format, i.e., a text file. Encoding is determined by the client charset attribute in .Pa freetds.conf . .It Fl d Turn off any logging. (Unintuitive, perhaps.) .It Fl e Ar errfile Write errors to .Ar errfile . For uploads. Includes line and column information, and the row data. .It Fl f Ar formatfile The format of the host data file is described by .Ar formatfile . The layout of .Ar formatfile is identical to that understood by the Sybase and Microsoft bcp utilities, but is too complicated to describe here. .It Fl h Ar hints Set bcp hints. For valid values, cf. .Fn bcp_options in the FreeTDS Reference Manual. .It Fl m Ar maxerror Stop after encountering .Ar maxerror errors. Default 10. .It Fl n The host data file is in .Dq native format. This is a format that .Nm will be able to process, but is not portable or readable. .It Fl r Ar row_term The row terminator for a character file. May be more than one character. Default is newline ('\\n'). Cf\&. .Fl c Ns , above. .It Fl t Ar field_term The field terminator for character file. Also known as a column delimiter. May be more than one character. Default is tab ('\\t'). Cf\&. .Fl c Ns , above. .It Fl v .It Fl V Print the version information and exit. .It Fl i Ar inputfile Read input data from file specified. .It Fl o Ar outputfile Write output data to file specified. .It Fl C Ar charset Specify character set to use to talk to server. .El .Sh ENVIRONMENT .Ev DSQUERY default .Ar servername .\" .Sh NOTES When connecting to a Sybase database server, it is required that the TDS 5.0 protocol be used. When connecting to a Microsoft SQL Server 2000 database server, the TDS\ 7 (or later) protocol is required. .Pp Sybase and Microsoft define different versions of the bcp portion of TDS 4.2. Because FreeTDS has no way of knowing which type of server it's connected to, .Nm does not support version 4.2 of the TDS protocol. .\" .Sh HISTORY .Nm first appeared in FreeTDS 0.60 .Sh AUTHORS The .Nm utility was written by .An Bill Thompson Aq thompbil@exchange.uk.ml.com .Sh BUGS Currently, there is no support for text data types in .Nm Ns , when SQL Server 2000 is the target server. PK=iZ/\~8a8a man3/mcrypt.3nu[.TH MCRYPT 3 "10 March 2002" .SH NAME libmcrypt \- encryption/decryption library .SH SYNOPSIS [see also .I mcrypt.h for more information] .SH DESCRIPTION The .I libmcrypt is a data encryption library. The library is thread safe and provides encryption and decryption functions. This version of the library supports many encryption algorithms and encryption modes. Some algorithms which are supported: SERPENT, RIJNDAEL, 3DES, GOST, SAFER+, CAST-256, RC2, XTEA, 3WAY, TWOFISH, BLOWFISH, ARCFOUR, WAKE and more. .LP OFB, CBC, ECB, nOFB, nCFB and CFB are the modes that all algorithms may function. ECB, CBC, encrypt in blocks but CTR, nCFB, nOFB, CFB and OFB in bytes (streams). Note that CFB and OFB in the rest of the document represent the "8bit CFB or OFB" mode. nOFB and nCFB modes represents a n-bit OFB/CFB mode, n is used to represent the algorithm's block size. The library supports an extra STREAM mode to include some stream algorithms like WAKE or ARCFOUR. In this version of the library all modes and algorithms are modular, which means that the algorithm and the mode is loaded at run-time. This way you can add algorithms and modes faster, and much easier. .I LibMcrypt includes the following symmetric (block) algorithms: .B DES: The traditional DES algorithm designed by IBM and US NSA. Uses 56 bit key and 64 bit block. It is now considered a weak algorithm, due to its small key size (it was never intended for use with classified data). .B 3DES or Triple DES: DES but with multiple (triple) encryption. It encrypts the plaintext once, then decrypts it with the second key, and encrypts it again with the third key (outer cbc mode used for cbc). Much better than traditional DES since the key is now 168 bits (actually the effective key length is 112 bits due to the meet-in-the-middle attack). .B CAST-128: CAST was designed in Canada by Carlisle Adams and Stafford Tavares. The original algorithm used a 64bit key and block. The algorithm here is CAST-128 (also called CAST5) which has a 128bit key and 64bit block size. .B CAST-256: CAST-256 was designed by Carlisle Adams. It is a symmetric cipher designed in accordance with the CAST design procedure. It is an extention of the CAST-128, having a 128 bit block size, and up to 256 bit key size. .B xTEA: TEA stands for the Tiny Encryption Algorithm. It is a feistel cipher designed by David Wheeler & Roger M. Needham. The original TEA was intended for use in applications where code size is at a premium, or where it is necessary for someone to remember the algorithm and code it on an arbitrary machine at a later time. The algorithm used here is extended TEA and has a 128bit key size and 64bit block size. .B 3-WAY: The 3way algorithm designed by Joan Daemen. It uses key and block size of 96 bits. .B SKIPJACK: SKIPJACK was designed by the US NSA. It was part of the ill-fated "Clipper" Escrowed Encryption Standard (EES) (FIPS 185) proposal. It operates on 64bit blocks and uses a key of 80 bits. SKIPJACK is provided only as an extra module to libmcrypt. .B BLOWFISH: The Blowfish algorithm designed by Bruce Schneier. It is better and faster than DES. It can use a key up to 448 bits. .B TWOFISH: Twofish was designed by Bruce Schneier, Doug Whiting, John Kelsey, Chris Hall, David Wagner for Counterpane systems. Intended to be highly secure and highly flexible. It uses a 128bit block size and 128,192,256 bit key size. (Twofish is the default algorithm) .B LOKI97: LOKI97 was designed by Lawrie Brown and Josef Pieprzyk. It has a 128-bit block length and a 256bit key schedule, which can be initialized using 128, 192 or 256 bit keys. It has evolved from the earlier LOKI89 and LOKI91 64-bit block ciphers, with a strengthened key schedule and a larger keyspace. .B RC2: RC2 (RC stands for Rivest Cipher) was designed by Ron Rivest. It uses block size of 64 bit and a key size from 8 to 1024 bits. It is optimized for 16bit microprocessors (reflecting its age). It is described in the RFC2268. .B ARCFOUR: RC4 was designed by Ron Rivest. For several years this algorithm was considered a trade secret and details were not available. In September 1994 someone posted the source code in the cypherpunks mailing list. Although the source code is now available RC4 is trademarked by RSADSI so a compatible cipher named ARCFOUR is included in the mcrypt distribution. It is a stream cipher and has a maximum key of 2048 bits. .B RC6: RC6 was designed by Ron Rivest for RSA labs. In mcrypt it uses block size of 128 bit and a key size of 128/192/256 bits. Refer to RSA Labs and Ron Rivest for any copyright, patent or license issues for the RC6 algorithm. RC6 is provided only as an extra module to libmcrypt. .B RIJNDAEL: Rijndael is a block cipher, designed by Joan Daemen and Vincent Rijmen, and was approved for the USA's NIST Advanced Encryption Standard, FIPS-197. The cipher has a variable block length and key length. Rijndael can be implemented very efficiently on a wide range of processors and in hardware. The design of Rijndael was strongly influenced by the design of the block cipher Square. There exist three versions of this algorithm, namely: .B RIJNDAEL-128 (the AES winner) , .B RIJNDAEL-192 , .B RIJNDAEL-256 The numerals 128, 192 and 256 stand for the length of the block size. .B MARS: MARS is a 128-bit block cipher designed by IBM as a candidate for the Advanced Encryption Standard. Refer to IBM for any copyright, patent or license issues for the MARS algorithm. MARS is provided only as an extra module to libmcrypt. .B PANAMA: PANAMA is a cryptographic module that can be used both as a cryptographic hash function and as a stream cipher. It designed by Joan Daemen and Craig Clapp. PANAMA (the stream cipher) is included in libmcrypt. .B WAKE: WAKE stands for Word Auto Key Encryption, and is an encryption system for medium speed encryption of blocks and of high security. WAKE was designed by David J. Wheeler. It is intended to be fast on most computers and relies on repeated table use and having a large state space. .B SERPENT: Serpent is a 128-bit block cipher designed by Ross Anderson, Eli Biham and Lars Knudsen as a candidate for the Advanced Encryption Standard. Serpent's design was limited to well understood mechanisms, so that could rely on the wide experience of block cipher cryptanalysis, and achieve the highest practical level of assurance that no shortcut attack will be found. Serpent has twice as many rounds as are necessary, to block all currently known shortcut attacks. Despite these exacting design constraints, Serpent is faster than DES. .B IDEA: IDEA stands for International Data Encryption Algorithm and was designed by Xuejia Lai and James Massey. It operates on 64bit blocks and uses a key of 128 bits. Refer to Ascom-Tech AG for any copyright, patent or license issues for the IDEA algorithm. IDEA is provided only as an extra module to libmcrypt. .B ENIGMA (UNIX crypt): A one-rotor machine designed along the lines of Enigma but considerable trivialized. Very easy to break for a skilled cryptanalyst. I suggest against using it. Added just for completeness. .B GOST: A former soviet union's algorithm. An acronym for "Gosudarstvennyi Standard" or Government Standard. It uses a 256 bit key and a 64 bit block. The S-boxes used here are described in the Applied Cryptography book by Bruce Schneier. They were used in an application for the Central Bank of the Russian Federation. Some quotes from gost.c: The standard is written by A. Zabotin (project leader), G.P. Glazkov, and V.B. Isaeva. It was accepted and introduced into use by the action of the State Standards Committee of the USSR on 2 June 1989 as No. 1409. It was to be reviewed in 1993, but whether anyone wishes to take on this obligation from the USSR is questionable. This code is based on the 25 November 1993 draft translation by Aleksandr Malchik, with Whitfield Diffie, of the Government Standard of the U.S.S.R. GOST 28149-89, "Cryptographic Transformation Algorithm", effective 1 July 1990. (Whitfield.Diffie@eng.sun.com) Some details have been cleared up by the paper "Soviet Encryption Algorithm" by Josef Pieprzyk and Leonid Tombak of the University of Wollongong, New South Wales. (josef/leo@cs.adfa.oz.au) .B SAFER: SAFER (Secure And Fast Encryption Routine) is a block cipher developed by Prof. J.L. Massey at the Swiss Federal Institute of Technology. There exist four versions of this algorithm, namely: .B SAFER K-64 , .B SAFER K-128 , .B SAFER SK-64 and .B SAFER SK-128. The numerals 64 and 128 stand for the length of the user-selected key, 'K' stands for the original key schedule and 'SK' stands for the strengthened key schedule (in which some of the "weaknesses" of the original key schedule have been removed). In mcrypt only SAFER SK-64 and SAFER SK-128 are used. .B SAFER+: SAFER+ was designed by Prof. J.L. Massey, Prof. Gurgen H. Khachatrian and Dr. Melsik K. Kuregian for Cylink. SAFER+ is based on the existing SAFER family of ciphers and provides for a block size of 128bits and 128, 192 and 256 bits key length. .LP A short description of the modes supported by libmcrypt: .B STREAM: The mode used with stream ciphers. In this mode the keystream from the cipher is XORed with the plaintext. Thus you should NOT ever use the same key. .B ECB: The Electronic CodeBook mode. It is the simplest mode to use with a block cipher. Encrypts each block independently. It is a block mode so plaintext length should be a multiple of blocksize (n*blocksize). .B CBC: The Cipher Block Chaining mode. It is better than ECB since the plaintext is XOR'ed with the previous ciphertext. A random block should be placed as the first block (IV) so the same block or messages always encrypt to something different. It is a block mode so plaintext length should be a multiple of blocksize (n*blocksize). .B CFB: The Cipher-Feedback Mode (in 8bit). This is a self-synchronizing stream cipher implemented from a block cipher. This is the best mode to use for encrypting strings or streams. This mode requires an IV. .B OFB: The Output-Feedback Mode (in 8bit). This is a synchronous stream cipher implemented from a block cipher. It is intended for use in noisy lines, because corrupted ciphertext blocks do not corrupt the plaintext blocks that follow. Insecure (because used in 8bit mode) so it is recommended not to use it. Added just for completeness. .B nOFB: The Output-Feedback Mode (in nbit). n Is the size of the block of the algorithm. This is a synchronous stream cipher implemented from a block cipher. It is intended for use in noisy lines, because corrupted ciphertext blocks do not corrupt the plaintext blocks that follow. This mode operates in streams. .B nCFB: The Cipher-Feedback Mode (in nbit). n Is the size of the block of the algorithm. This is a self synchronizing stream cipher implemented from a block cipher. This mode operates in streams. .B CTR: The Counter Mode. This is a stream cipher implemented from a block cipher. This mode uses the cipher to encrypt a set of input blocks, called counters, to produce blocks that will be XORed with the plaintext. In libmcrypt the counter is the given IV which is incremented at each step. This mode operates in streams. .B Error Recovery in these modes: If bytes are removed or lost from the file or stream in ECB, CTR, CBC and OFB modes, are impossible to recover, although CFB and nCFB modes will recover. If some bytes are altered then a full block of plaintext is affected in ECB, nOFB and CTR modes, two blocks in CBC, nCFB and CFB modes, but only the corresponding byte in OFB mode. .LP Encryption can be done as follows: A call to function: .B MCRYPT mcrypt_module_open( char *algorithm, char* algorithm_directory, .B char* mode, char* mode_directory); This function associates the algorithm and the mode specified. The name of the algorithm is specified in algorithm, eg "twofish", and the algorithm_directory is the directory where the algorithm is (it may be null if it is the default). The same applies for the mode. The library is closed by calling mcrypt_module_close(), but you should not call that function if mcrypt_generic_end() is called before. Normally it returns an encryption descriptor, or MCRYPT_FAILED on error. A call to function: .B int mcrypt_generic_init( MCRYPT td, void *key, .B int lenofkey, .B void *IV); This function initializes all buffers for the specified thread The maximum value of lenofkey should be the one obtained by calling mcrypt_get_key_size() and every value smaller than this is legal. Note that Lenofkey should be specified in bytes not bits. The IV should normally have the size of the algorithms block size, but you must obtain the size by calling mcrypt_get_iv_size(). IV is ignored in ECB. IV MUST exist in CFB, CBC, STREAM, nOFB and OFB modes. It needs to be random and unique (but not secret). The same IV must be used for encryption/decryption. After calling this function you can use the descriptor for encryption or decryption (not both). Returns a negative value on error. To encrypt now call: .B int mcrypt_generic( MCRYPT td, void *plaintext, int len); This is the main encryption function. td is the encryption descriptor returned by mcrypt_generic_init(). Plaintext is the plaintext you wish to encrypt and len should be the length (in bytes) of the plaintext and it should be k*algorithms_block_size if used in a mode which operated in blocks (cbc, ecb, nofb), or whatever when used in cfb or ofb which operate in streams. The plaintext is replaced by the ciphertext. Returns 0 on success. To decrypt you can call: .B int mdecrypt_generic( MCRYPT td, void *ciphertext, int len); The decryption function. It is almost the same with mcrypt_generic. Returns 0 on success. When you're finished you should call: .B int mcrypt_generic_end( MCRYPT td); This function terminates encryption specified by the encryption descriptor (td). Actually it clears all buffers, and closes all the modules used. Returns a negative value on error. .B This function is deprecated. Use mcrypt_generic_deinit() and mcrypt_module_close() instead. .B int mcrypt_generic_deinit( MCRYPT td); This function terminates encryption specified by the encryption descriptor (td). Actually it clears all buffers. The difference with mcrypt_generic_end() is that this function does not close the modules used. Thus you should use mcrypt_module_close(). Using this function you gain in speed if you use the same modules for several encryptions. Returns a negative value on error. .B int mcrypt_module_close( MCRYPT td); This function closes the modules used by the descriptor td. .P These are some extra functions that operate on modules that have been opened: These functions have the prefix mcrypt_enc_*. .B int mcrypt_enc_set_state(MCRYPT td, void *state, int size); This function sets the state of the algorithm. Can be used only with block algorithms and certain modes like CBC, CFB etc. It is usefully if you want to restart or start a different encryption quickly. Returns zero on success. The state is the output of mcrypt_enc_get_state(). .B int mcrypt_enc_get_state(MCRYPT td, void *state, int *size); This function returns the state of the algorithm. Can be used only certain modes and algorithms. The size will hold the size of the state and the state must have enough bytes to hold it. Returns zero on success. .B int mcrypt_enc_self_test( MCRYPT td); This function runs the self test on the algorithm specified by the descriptor td. If the self test succeeds it returns zero. .B int mcrypt_enc_is_block_algorithm_mode( MCRYPT td); Returns 1 if the mode is for use with block algorithms, otherwise it returns 0. (eg. 0 for stream, and 1 for cbc, cfb, ofb) .B int mcrypt_enc_is_block_algorithm( MCRYPT td); Returns 1 if the algorithm is a block algorithm or 0 if it is a stream algorithm. .B int mcrypt_enc_is_block_mode( MCRYPT td); Returns 1 if the mode outputs blocks of bytes or 0 if it outputs bytes. (eg. 1 for cbc and ecb, and 0 for cfb and stream) .B int mcrypt_enc_get_block_size( MCRYPT td); Returns the block size of the algorithm specified by the encryption descriptor in bytes. The algorithm MUST be opened using mcrypt_module_open(). .B int mcrypt_enc_get_key_size( MCRYPT td); Returns the maximum supported key size of the algorithm specified by the encryption descriptor in bytes. The algorithm MUST be opened using mcrypt_module_open(). .B int* mcrypt_enc_get_supported_key_sizes( MCRYPT td, int* sizes) Returns the key sizes supported by the algorithm specified by the encryption descriptor. If sizes is zero and returns NULL then all key sizes between 1 and mcrypt_get_key_size() are supported by the algorithm. If it is 1 then only the mcrypt_get_key_size() size is supported and sizes[0] is equal to it. If it is greater than 1 then that number specifies the number of elements in sizes which are the key sizes that the algorithm supports. The returned value is allocated with malloc, so you should not forget to free it. .B int mcrypt_enc_get_iv_size( MCRYPT td); Returns size of the IV of the algorithm specified by the encryption descriptor in bytes. The algorithm MUST be opened using mcrypt_module_open(). If it is '0' then the IV is ignored in that algorithm. IV is used in CBC, CFB, OFB modes, and in some algorithms in STREAM mode. .B int mcrypt_enc_mode_has_iv( MCRYPT td); Returns 1 if the mode needs an IV, 0 otherwise. Some 'stream' algorithms may need an IV even if the mode itself does not need an IV. .B char* mcrypt_enc_get_algorithms_name( MCRYPT td); Returns a character array containing the name of the algorithm. The returned value is allocated with malloc, so you should not forget to free it. .B char* mcrypt_enc_get_modes_name( MCRYPT td); Returns a character array containing the name of the mode. The returned value is allocated with malloc, so you should not forget to free it. .P These are some extra functions that operate on modules: These functions have the prefix mcrypt_module_*. .B int mcrypt_module_self_test (char* algorithm, char* directory); This function runs the self test on the specified algorithm. If the self test succeeds it returns zero. .B int mcrypt_module_is_block_algorithm_mode( char* algorithm, char* directory); Returns 1 if the mode is for use with block algorithms, otherwise it returns 0. (eg. 0 for stream, and 1 for cbc, cfb, ofb) .B int mcrypt_module_is_block_algorithm( char* mode, char* directory); Returns 1 if the algorithm is a block algorithm or 0 if it is a stream algorithm. .B int mcrypt_module_is_block_mode( char* mode, char* directory); Returns 1 if the mode outputs blocks of bytes or 0 if it outputs bytes. (eg. 1 for cbc and ecb, and 0 for cfb and stream) .B int mcrypt_module_get_algo_block_size( char* algorithm, char* directory); Returns the block size of the algorithm. .B int mcrypt_module_get_algo_key_size( char* algorithm, char* directory); Returns the maximum supported key size of the algorithm. .B int* mcrypt_module_get_algo_supported_key_sizes( char* algorithm, char* directory, int* sizes); Returns the key sizes supported by the algorithm. If sizes is zero and returns NULL then all key sizes between 1 and mcrypt_get_key_size() are supported by the algorithm. If it is 1 then only the mcrypt_get_key_size() size is supported and sizes[0] is equal to it. If it is greater than 1 then that number specifies the number of elements in sizes which are the key sizes that the algorithm supports. This function differs to mcrypt_enc_get_supported_key_sizes(), because the return value here is allocated (not static), thus it should be freed. .LP .B char** mcrypt_list_algorithms ( char* libdir, int* size); Returns a pointer to a character array containing all the mcrypt algorithms located in the libdir, or if it is NULL, in the default directory. The size is the number of the character arrays. The arrays are allocated internally and should be freed by using mcrypt_free_p(). .B char** mcrypt_list_modes ( char* libdir, int *size); Returns a pointer to a character array containing all the mcrypt modes located in the libdir, or if it is NULL, in the default directory. The size is the number of the character arrays. The arrays should be freed by using mcrypt_free_p(). .B void mcrypt_free_p (char **p, int size); Frees the pointer to array returned by previous functions. .B void mcrypt_free (void *ptr); Frees the memory used by the pointer. .B void mcrypt_perror(int err); This function prints a human readable description of the error 'err' in the stderr. The err should be a value returned by mcrypt_generic_init(). .B const char* mcrypt_strerror(int err); This function returns a human readable description of the error 'err'. The err should be a value returned by mcrypt_generic_init(). .B int mcrypt_mutex_register ( void (*mutex_lock)(void) , void (*mutex_unlock)(void) ); This function is only used in multithreaded application and only if compiled with dynamic module loading support. This is actually used internally in libltdl. Except for the dynamic module loading libmcrypt is thread safe. .LP Some example programs follow here. Compile as "cc prog.c -lmcrypt", or "cc prog.c -lmcrypt -lltdl" depending on your installation. Libltdl is used for opening dynamic libraries (modules). .nf /* First example: Encrypts stdin to stdout using TWOFISH with 128 bit key and CFB */ #include #include #include /* #include */ main() { MCRYPT td; int i; char *key; char password[20]; char block_buffer; char *IV; int keysize=16; /* 128 bits */ key=calloc(1, keysize); strcpy(password, "A_large_key"); /* Generate the key using the password */ /* mhash_keygen( KEYGEN_MCRYPT, MHASH_MD5, key, keysize, NULL, 0, password, strlen(password)); */ memmove( key, password, strlen(password)); td = mcrypt_module_open("twofish", NULL, "cfb", NULL); if (td==MCRYPT_FAILED) { return 1; } IV = malloc(mcrypt_enc_get_iv_size(td)); /* Put random data in IV. Note these are not real random data, * consider using /dev/random or /dev/urandom. */ /* srand(time(0)); */ for (i=0; i< mcrypt_enc_get_iv_size( td); i++) { IV[i]=rand(); } i=mcrypt_generic_init( td, key, keysize, IV); if (i<0) { mcrypt_perror(i); return 1; } /* Encryption in CFB is performed in bytes */ while ( fread (&block_buffer, 1, 1, stdin) == 1 ) { mcrypt_generic (td, &block_buffer, 1); /* Comment above and uncomment this to decrypt */ /* mdecrypt_generic (td, &block_buffer, 1); */ fwrite ( &block_buffer, 1, 1, stdout); } /* Deinit the encryption thread, and unload the module */ mcrypt_generic_end(td); return 0; } /* Second Example: encrypts using CBC and SAFER+ with 192 bits key */ #include #include #include main() { MCRYPT td; int i; char *key; /* created using mcrypt_gen_key */ char *block_buffer; char *IV; int blocksize; int keysize = 24; /* 192 bits == 24 bytes */ key = calloc(1, keysize); strcpy(key, "A_large_and_random_key"); td = mcrypt_module_open("saferplus", NULL, "cbc", NULL); blocksize = mcrypt_enc_get_block_size(td); block_buffer = malloc(blocksize); /* but unfortunately this does not fill all the key so the rest bytes are * padded with zeros. Try to use large keys or convert them with mcrypt_gen_key(). */ IV=malloc(mcrypt_enc_get_iv_size(td)); /* Put random data in IV. Note these are not real random data, * consider using /dev/random or /dev/urandom. */ /* srand(time(0)); */ for (i=0; i < mcrypt_enc_get_iv_size(td); i++) { IV[i]=rand(); } mcrypt_generic_init( td, key, keysize, IV); /* Encryption in CBC is performed in blocks */ while ( fread (block_buffer, 1, blocksize, stdin) == blocksize ) { mcrypt_generic (td, block_buffer, blocksize); /* mdecrypt_generic (td, block_buffer, blocksize); */ fwrite ( block_buffer, 1, blocksize, stdout); } /* deinitialize the encryption thread */ mcrypt_generic_deinit (td); /* Unload the loaded module */ mcrypt_module_close(td); return 0; } .fi .LP The library does not install any signal handler. .LP Questions about libmcrypt should be sent to: .IP mcrypt-dev@lists.hellug.gr or, if this fails, to the author addresses given below. The mcrypt home page is: .IP http://mcrypt.hellug.gr .LP .SH AUTHORS Version 2.4 Copyright (C) 1998-1999 Nikos Mavroyanopoulos (nmav@hellug.gr). .LP Thanks to all the people who reported problems and suggested various improvements for mcrypt; who are too numerous to cite here. .LP .\" end of man page PK9iZ@_@@man5/freetds.conf.5nu[PK9iZ@G(O O man1/bsqlodbc.1nu[PK9iZ(ܶ #man1/bsqldb.1nu[PK9iZsZ88 1man1/fisql.1nu[PK9iZgo o xAman1/datacopy.1nu[PK9iZW &Kman1/tsql.1nu[PK9iZ; ; Xman1/defncopy.1nu[PK9iZufz vcman1/osql.1nu[PK9iZxkman1/freebcp.1nu[PK=iZ/\~8a8a man3/mcrypt.3nu[PK