pax_global_header00006660000000000000000000000064133455371310014517gustar00rootroot0000000000000052 comment=9d476577804906442598ec51a279459a47cf4420 mgetty-1.2.1/000077500000000000000000000000001334553713100130315ustar00rootroot00000000000000mgetty-1.2.1/BUGS000066400000000000000000000043311334553713100135150ustar00rootroot00000000000000Hi, as you may imagine, I get about 10 - 30 mails a day, with questions, suggestions, bug reports about mgetty. Since very many of those mails are answered in the manual, or your modem's manual, please make sure that you have read all those manuals before mailing me (I can get very unfriendly if the question is clearly answered somewhere in there!). There's a very detailed section on "Problems common to many modem types" in the mgetty manual, and still those questions are asked so very frequently :-( The second type of mails that usually evoke very short and unfriendly results are bug reports "it does not work" without any informations about the used hardware, modem, what exactly went wrong, ... So, here's what I need - your modem type (if you know it, include the ROM version number) - the operating system (with version number) - operating system specials (custom serial driver, unusual serial hardware) - a mgetty log file (VERY IMPORTANT). Where the log file is stored is controlled by the LOG_PATH definition in policy.h, and please start mgetty/sendfax with a log level high enough (-x5 or more) to capture all modem commands and responses. Please trim the log file to just contain one (or few) invocations of mgetty/sendfax, I really hate it if people think they are doing me some good and mail me a logfile containing four weeks mgetty activity, totalling 5000 lines... - if you're experience problems when *sending* faxes, try to find out what (if anything) came out at the receiving end. This can be quite important for finding flow control related bugs. - if you want to send a question about some message, don't transcribe it - copy it (cut and paste) exactly as it was printed. If you have read the manual, and provide all those informations, your chances that I take enough time to closely read your mail and answer it in a friendly manner are quite high. If some/most informations are missing, I sometimes get very unfriendly... (Naturally there are some exceptions of this, e.g., if I have already exchanged a couple of mails with you, and your name does ring a bell in my head, there is no need to include all the stuff in every mail...) gert mgetty-1.2.1/COPYING000066400000000000000000000431641334553713100140740ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, 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 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., 675 Mass Ave, Cambridge, MA 02139, 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. mgetty-1.2.1/ChangeLog000066400000000000000000002014451334553713100146110ustar00rootroot00000000000000Mon Sep 10 20:51:51 CEST 2018 Gert Doering * Makefile: release 1.2.1 Sun Sep 9 18:36:09 CEST 2018 Gert Doering * Details are now all in Git, so use "git log" for more detailed change logging (+timestamps) * fax/faxrunq.in, fax/faxq.in: properly quote input from JOB files, avoid attack with shell metacharacters (CVE-2018-16741) * contrib/scrtsc.c: remove from distribution (CVE-2018-16742) * contrib/next-login/next-login.c: fix buffer overflow on username (CVE-2018-16743) * faxrec.c, policy.h: rework mail handling, avoid potential buffer overrun by means of "mail-to" config variable (CVE-2018-16744) * g32pbm.c: fix invalid lseek() handling (infinite loop) * pbm2g3.c: fix handling of invalid PBM input * Makefile: repair "make diff" building * git import: add stuff that was missed for 1.2.0 release (it was in the 1.2.0 tarball, but missing in git repo) Tue Mar 6 13:45:33 CET 2018 Gert Doering * release 1.2.0, exactly 25 years after 0.1 "Mar 6 1993 mgetty01.tpz" (unfortunately the original post to alt.sources can no longer been found, the oldest version groups.google.com has in its archives are 0.14 and 0.20 from October and November 1993) Tue Mar 6 12:03:33 CET 2018 Gert Doering * cnd.c, conf_mg.c, conf_mg.h, mgetty.c, mgetty.h, logname.c, login.c, t/t_ring.c, doc/mgetty.texi-in - merge "cid-program" patch set from Alex Manoussakis (after 10 years...) * policy.h: default MAILER to "/usr/sbin/sendmail" * policy.h: default CONSOLE to "/dev/null" - as /dev/console seems to cause hangs on FreeBSD 10 * mg_utmp.h: ut_time compatibility #define for utmpx on FreeBSD needs to be ut_tv.tv_sec, not ut_tv (struct timeval) Mon Mar 5 19:32:23 CET 2018 Gert Doering * conf_mg.c, conf_mg.h, mgetty.c: new option "open-delay " (same thing as for sendfax, after DTR toggling, wait millseconds before flushing input and starting AT commands) * doc/mgetty.texi-in: document open-delay Sun Mar 4 20:22:47 CET 2018 Gert Doering * Makefile, version.h: make this is version 1.2.0 * distro/faxrunqd.service: add systemd service file for faxrunqd Tue Feb 9 16:09:21 CET 2016 Gert Doering * g3/pbm2g3.c, g3/g3cat.c: change "inline" to "static inline", avoid link-time explosion with C99 compilers Wed Aug 19 19:36:48 CEST 2015 Gert Doering * utmp.c, mg_utmp.h: apply FreeBSD port patches to adjust to 9.x (no or login() anymore, utmpx and setutxent()) Thu Apr 3 11:05:13 CEST 2014 Gert Doering * class1.h, class1.c, class1lib.c: rename FRAMESIZE to C1_FRAMESIZE to avoid conflict with AIX headers already using FRAMESIZE (*sigh*) Sun Feb 2 14:06:41 CET 2014 Gert Doering * config.c, logfile.c, logname.c, login.c, modem.c, ring.c, faxlib.c, faxrecp.c, class1lib.c, cnd.c, g3/pbm2g3.c, goodies.c, fax/faxq-helper.c, callback/callback.c: convert all "char" expressions to (uch) when calling ctype.h macros (*sigh*) * fax_lib.h: add prototype for fax1_send_page() and fax1_send_nsf() * class1lib.c: fix signed/unsigned char warning in strncpy() call * g3file.c: fix signed/unsigned char warning in function calls * tio.c: #include on BSD Sun Feb 2 13:24:40 CET 2014 Michal Sekletar * bug fixes based on static code analysis (mem leaks, buffer overruns) * do_chat.c: test if(action != NULL) in all places * logfile.c: Moved call to close to else branch of if-statement to avoid passing invalid file descriptor in case log_fd == -1 * g3/g32pbm.c, g3/g3cat.c: pass actual file descriptor to close(), not negative result from read() * logfile.c: in logmail(), skip fwrite() if read() returns <= 0 * faxlib.c: avoid potential buffer overrun (off-by-one) when copying a maximum-length NSF (theoretical possiblity as NSF frame length is bounded) * voice/libpvf/lib.c: avoid buffer overrun with terminating zero byte in read_pvf_header() when reading a malformed PVF file (= 2nd line longer than VOICE_BUF_LEN) * g3/g32pbm.c: fix memleak in scalebm(): add missing free(mulvec) * g3/pbm2g3.c: fix memleak in convert_pbm_raw(): add free(linebuf) * voice/libpvf/fft.c: fix memleaks in pvffft(), always free(real) and free(imag) (introducing exit labels and jumping there) * faxrecp.c: in fax_get_page_data(), ensure that fax_fp is actually valid (fdopen() *can* fail) - and always fclose() it on exit * do_chat.c: fclose(fp) on error exit * voice/libvoice/record.c: fclose(fd) on error-exit * voice/libvoice/play.c: ensure fclose(fd) on all returns Fri Jan 31 17:44:00 CET 2014 Gert Doering * frontends/dir2fax: added simple "scan directory, fax out" script Fri Jan 31 14:40:28 CET 2014 Gert Doering * faxsend.c: increase timeout value between and "OK" to whatever is needed to cope for "large documents, slow receiver, huge buffers in network and/or DIVA cards". Fri Jan 31 11:23:59 CET 2014 Gert Doering * mgetty.h: introduce "port_type_t" enum to store port type in sendfax * sendfax.c: add proper port type handling to get rid of all the TIO_* errors for unsupported function calls on PT_RAW_SOCKET ports * clean_line.c, clean_line(): if FAX_SEND_SOCKETS, never use VTIME * do_chat.c, clean_line.c: move clean_line() from do_chat.c to clean_line.c (we need it from sendfax, and it fits nowhere else) * faxlib.c: recognize "NO ANSWER" as final "dial-failed" response * Makefile: add rule for mgetty-launchd, not built by default. * Makefile: remove support for "sentinelized" binaries Tue Jan 28 13:21:15 CET 2014 Gert Doering * goodies.c: add safe_strdup() function * socket.c: add call-out module to connect to remote "modems" reachable via raw TCP/IP sockets - like a DIVA ISDN board made accessible by ser2net. Conditional on #ifdef FAX_SEND_SOCKETS * sendfax.c: if a tty name is "ttyRInmm", magically map that to a remote tty via socket.c (connect to modemserver, on TCP port 50000+). Handle differences between "local tty" and "raw socket" ports in termio(s) initialization etc. * io.c: do not declare poll() prototype on BSD * faxlib.c: permit higher "fax max speed" than 14400 by proper hex-encoding the result of "(max_speed/2400)-1". DIVA cards can do up to 33600, encoded as 'D'. * config.c: add wildcard matching to section_key matches - like "port ttyRI???" -> match on all Ports starting with "ttyRI" and up to 3 characters. Useful to set common modem-init stuff for 30 lines on a DIVA PRI board... Sun Jan 26 20:18:07 CET 2014 Gert Doering * policy.h: add and explain FAX_SEND_SOCKETS option * Makefile: add socket.c/socket.o, cleanup LIBS and gdiff usage Fri Jul 5 11:32:42 CEST 2013 * fax/faxrunqd.in: treat "exit(15)" from sendfax as extra-bad, adding +2 to mq_badness counter (this error hints at "the tty got completely stuck, each fax sent there will be delayed for many minutes until sendfax is killed" -> avoid using that tty) Fri Feb 24 14:40:15 CET 2012 Gert Doering * goodies.c: implement get_ps_args() for _AIX (6+, with /proc) * mgetty-launchd.c: new tool to run mgetty from "non-init" processes (mainly written for IBM HACMP cluster environments, where inittab cannot easily be used because the modem devices and mgetty processes have to move with the cluster, and ttys on a remote terminal server can only be accessed from a single node at a time) * utmp.c: set ut_host on AIX, zero new utmp entry before using (otherwise ut_host might contain garbage if not set), introduce new entry point: make_utmp_wtmp_pid() Wed Feb 15 20:52:48 CET 2012 Gert Doering * we have a public GIT now: git://github.greenie.net/mgetty.git (readonly, so send your patches by mail) Wed Feb 1 15:23:09 CET 2012 Gert Doering * utmp.c: on AIX (#ifdef AIX_SRC), if there is no existing utmp entry, create a new one (needed if using AIX' res.mgmt.) * mgetty.c: #ifdef AIX_SRC, create INIT_PROCESS utmp entry on start Mon Jul 11 11:21:20 CEST 2011 * atsms.c: add new option '-Z' -> "zap modem" (do full SIM reset with AT+CFUN=1,1 if AT+CPIN? query returns ERROR) Mon Mar 28 20:03:31 CEST 2011 Gert Doering * fax/faxspool.in: print number of pages in "success!" message * fax/faxspool.rules: add sample statements for HTML-to-Fax Tue Jan 18 17:09:11 CET 2011 * fax/faxrunqd.in: pass verbose error list to "modem error script" (in $MODEM_ERROR_VERBOSE env variable) - help humans understand Fri Oct 8 12:50:07 CEST 2010 Gert Doering * g3/g3cat.c: when reporting invalid g3 code, use "fd" for ftell(), not "0" (artifact from "could only handle single file on stdin") * g3/g3cat.c, g3/g32pbm.c: use ftell(..., SEEK_CUR) not (..., 1) Sat Sep 25 18:31:21 CEST 2010 Gert Doering * frontends/mail2fax06/mail2fax.pl: substitute problem characters in attachment file names by "_" before passing to faxspool Wed Sep 22 11:02:09 CEST 2010 Gert Doering * sms.c: cleanup sub-process handling and console redirection (double-fork()/exec() now) * mgetty.c, mgetty.h: move handle_incoming_sms() prototype from mgetty.h to mgetty.c (uid_t/gid_t non-availability) Wed Sep 15 11:21:28 CEST 2010 Gert Doering * policy.h: add new block for #define SMS + explanations * sms.c: NEW - handling of incoming SMS messages and delivery reports (read from GSM modem, call external script handler) * conf_mg.[ch] - add sms-handler and sms-handler-{user,group} options * mgetty.c: add recognition of +CMTI: and +CDSI: SMS status messages to ring_chat_actions[] -> A_SMS_* action * mgetty.c: add new state: St_incoming_sms, and call out to handle_incoming_sms() to handle SMS related stuff * mgetty.c: make "dialout!" logging more useful (log dialout command) * mgetty.h: add A_SMS_* action types and prototypes Fri Aug 13 15:49:45 MEST 2010 Gert Doering * fax/faxrunqd.in: log faxrunqd.policy file parsing to log file (no longer to stdout). * fax/faxrunqd.in: ignore leading whitespace in faxrunqd.policy lines (INCOMPATIBLE CHANGE, those lines now suddenly start working!) Fri Jul 16 18:26:23 MEST 2010 Gert Doering * tap/atsms.c: handle "waiting for delivery report times out" more gracefully - don't flag as "SMS transmission error" Tue Jun 29 16:02:00 MEST 2010 Gert Doering * fax/faxrunqd.in: extend 'time constraint' handling with plugin infrastructure for really weird cases Mon Jun 28 13:23:21 MEST 2010 Gert Doering * release 1.1.37 Fri Jun 4 14:56:46 MEST 2010 Gert Doering * the following fixes prompted by Wouter van Marle... * fax/faxspool.in: implement "-t hh:mm-hh:mm" time-range syntax * fax/faxq.in: properly display queued jobs with time-range field * fax/faxrunqd.in: correctly handle jobs running out of the end of their sent-time window. ** Changes handling of "-t hh:mm" to "from hh:mm to midnight" ** * doc/faxqueue.5in: document "time hhmm-hhmm" syntax & constraints Sat Feb 20 14:04:11 MET 2010 Gert Doering * tools/microcom.c: improve read-from-device exception handling Wed Feb 17 09:28:44 MET 2010 Gert Doering * Makefile: split CC/HOSTCC for easier cross-compiling Tue Nov 24 16:05:20 MET 2009 Gert Doering * tap/atsms.c: add SMS retrieval from AT GSM modems Tue Jul 7 16:43:11 MEST 2009 Gert Doring * fax/faxrunqd.in: add run-time configurable delay after failures * faxrunq.config: add example lines for "delay-rule" option * doc/faxrunqd.8in: document "delay-rule" option Thu Mar 19 16:10:50 MET 2009 Gert Doering * Makefile, conf_sf.c, conf_sf.h: change working of version.h (now it only contains #define's, the actual variable assignment happens in conf*.c - prerequisites for inclusion in class1lib.c) * class1.c: send NSF frame on reception (optional) * class1lib.c: implement class1_send_nsf(), send mgetty version Sat Mar 14 12:54:19 MET 2009 Getr Doering * hyla_nsf.c: import updates from Hylafax NSF.c++ Wed Feb 25 14:02:20 MET 2009 Gert Doering * fax/faxrunqd.in: enhance and clarify per-modem statistics Wed Feb 18 09:20:55 MET 2009 Gert Doering * Makefile, doc/Makefile: cleanup "make install" warnings Fri Mar 7 15:53:23 MET 2008 Gert Doering * ring.c: be flexible regarding whitespace in FM:...TO:... (Blatzheim) Thu Jan 31 17:26:18 MET 2008 Gert Doering * sendfax.c, conf_sf.c, conf_sf.h: new option for sendfax: reset-after-fail --> sent to modem after dial failures Sun Sep 9 13:56:46 MEST 2007 Stepan Kasal * Makefile: file COPYING was missing Tue Aug 21 11:48:44 MEST 2007 Gert Doering * fax/faxspool.in: add @DATE +@ to faxheader processing Fri Jun 15 13:11:24 MEST 2007 Gert Doering * add missing files (g3file.c), re-release 1.1.36 Fri Jun 15 09:13:20 MEST 2007 Gert Doering * release 1.1.36 Wed May 16 17:46:39 MEST 2007 Gert Doering * faxsend.c: (optionally) insert 100 0-bytes at start of page, to help modems that have problems with the before-EOL timing (new USRs) * fax_lib.c: add new MQ_ bit for 0-padding Sat May 5 14:03:16 MEST 2007 Gert Doering * fax/faxrunqd.in: make wait() interruptible, avoid queue stalls if only one modem active and this modem has a very long job. Additionally, detect hung sendfax processes, and kill()' em. * faxlib.c: recognize modem ID for Blatzheim ISDN/hybrid modems Fri Jan 19 08:36:49 MET 2007 Gert Doering * fax/faxrunqd.in: add functionality to run external scripts if the fax queue reaches a "high water mark" length, and if a given modem has more than consecutive errors * doc/faxrunqd.8in: document new options Thu Dec 7 16:44:55 MET 2006 Gert Doering * fax/faxspool.in: add @S@ for faxheader (replace with job id) Wed Nov 22 16:41:47 MET 2006 Gert Doering * sendfax.c: for "failed transmitting", log #of pages successfully sent + #of retries (important for judging significance of errors) * conf_sf.c: add new sendfax option "-R " to set "max_tries" value * doc/sendfax.8in: document -R Wed Oct 25 13:50:17 MEST 2006 Gert Doering * tools/README: update documentation, add "microcom" * class1lib.c: in fax1_send_frame(): make logging more uniform and easier to read. Handle case of "NO CARRIER" after frame has been sent, and check for internal consistency regarding "we have carrier" vs. "use existing carrier" (ugly) * class1.c: on reception, don't try to send DIS when CSI frame couldn't be sent. Log # of current re-try. Thu Oct 19 10:01:02 MEST 2006 Jan-Peter Koopmann * add exim4 documentation to frontends/mail2fax06/README Fri Sep 29 13:05:40 MEST 2006 Gert Doering * class1lib.c: check all fax_send() return values (in case flow control gets stuck, we might have a timeout in there) * class1.c: properly implement scan line time handling / byte padding * class1.c: implement re-training on TCF/FTT, including stepdown * class1lib.c: implement fax1_st_table[] for scan line time handling (bit ordering in DCS/DIS frames is just weird). Add scan time parameter to fax1_send_dcs() * fax/faxspool.rules: add conversion rules for .jpg and .doc Wed Sep 27 11:49:45 MEST 2006 Gert Doering * fax/faxrunqd.in: fix write combining bug with partially-sent jobs Tue Sep 26 11:05:36 MEST 2006 Gert Doering * voice/libvoice/*: sparc64 compatibility fixes (*int vs. *p_int) * voice/Makefile: pull in new object files (hyla_nsf.o, g3file.o) * g3file.c: implement first draft of generic G3 I/O module, including EOL padding * t/t_g3f_c.c, t/t_g3file.in: test routines for g3file.c * class1.c: change fax1_send_page() to use g3_send_file() * fax/faxspool.in: netpbm calls "giftoppm" now "giftopnm" -> adapt Fri Sep 22 23:43:51 MEST 2006 Gert Doering * frontends/mail2fax06/: implement new mail to fax conversion tool, in perl, using MIME::Parser, which will properly handle attachments Wed Jun 14 11:38:54 MEST 2006 Gert Doering * tools/microcom.c: add to fix missing prototype warnings * config.c: insert {} to silence over-eager compiler warnings * tio.c: change "static char[] tio_compilation_type" into "#ident" (get rid of "unused variable" warning, save a few bytes .data) * locks.c: get rid of "unused variable tries" compiler warning * hyla_nsf.c: add mgetty T.35 vendor code to table Sat Jun 10 13:45:04 MEST 2006 Gert Doering * mgetty has its own ITU T.35 vendor code now! [0x04 0x81 0x0e] Fri May 26 22:04:20 MEST 2006 Gert Doering * tools/mid.c: implement "-Q" (quick query) Thu Apr 13 12:07:16 MEST 2006 Gert Doering * faxlib.c: handle USR reporting format for NSF frames Sun Apr 9 18:39:51 MEST 2006 Gert Doering * fax/faxrunqd.in: fix quoting bug in `date` call (Klaus Weglehner) * hyla_nsf.c: import new set of tables from Hylafax NSF.c++ Wed Mar 29 14:26:48 MEST 2006 Gert Doering * hyla_nsf.c, class1.c, class1.h: silence compiler complaints * config.h: cast return value of c_bool() to (boolean) Wed Mar 22 15:10:18 MET 2006 Gert Doering * class1.c: hand off incoming NSF frames to decoder * faxlib.c: convert incoming NSF frames to binary, hand off to decoder * hyla_nsf.c: import NSF vendor tables + decoder from Hylafax Tue Mar 7 15:10:13 MET 2006 Gert Doering * class1.c: fax1_send_page(): fix end-of-page handling, reorder sending of TSI and DCS to correctly handle RTP/RTN * class1.c: fax1_send_page(): properly use fax_send_swaptable[] (page sending works now, if receiver doesn't need padding) * class1.c: fax1_send_page(): fix first and last chunk of page data (digifax header wasn't skipped, and last chunk was lost) * class1.c: handle DCN in fax1_dial_and_phase_AB() * class1.c: add receive torture test (to sender), more logging * fax_lib.h: define CAN character (cancel, ctrl-x) * class1lib.c: fax1_receive_frame(): if waiting for start-of-frame already runs into timeout, don't even try to read end-of-frame modem response (robustness) * class1lib.c: tell modem (send CAN character) when we timeout after AT+FRH=n, to make sure recovering works Mon Mar 6 17:27:04 MET 2006 Gert Doering * class1lib.c: don't query AT+FRH=?/+FTH=? carriers Wed Feb 22 18:10:50 MET 2006 Gert Doering * */Makefile: move all "fullclean" extras into "clean" target, remove "make fullclean" * Makefile: for "make fullclean" or "distclean", just do "clean" Wed Feb 22 14:36:16 MET 2006 Gert Doering * release 1.1.35 Sat Feb 18 13:42:59 MET 2006 Gert Doering * tio.c: tio_check_speed(): set errno to EINVAL for invalid speeds * doc/faxq-helper.8in: add man page Thu Feb 9 18:44:06 MET 2006 Gert Doering * fax_lib.h, class1lib.c: implement MQ_C1_NO_V17 Thu Jan 19 14:41:33 MET 2006 Gert Doering * fax/faxrunq.in: implement same acct.log format as in faxrunqd 1.71 * www/faxhist.in: adapt to new acct.log, cleanup sorted output * www/faxhists.in: adapt to new acct.log, show total number of lines Fri Jan 13 15:06:26 MET 2006 Gert Doering * fax/faxrunqd.in: change output format for acct.log to something that is more consistant and easier to parse Tue Jan 3 11:17:07 MET 2006 Gert Doering * use +FAA=x for adaptive answer in class 1.0 mode, +FAE=x in class 1 (this is very ill-standardized. Some modems accept both, some only one or the other) Sun Jan 1 17:19:08 MET 2006 Gert Doering * class1.c, class1lib.c: make (receive) code robust against all sort of unexpected behaviours (modem responses not coming back in time, sudden hangups from the remote end, need for re-tries, etc.) still not the full T.30 flow chart, but important parts of it. Sat Dec 31 17:01:19 MET 2005 Gert Doering * class 1 fax reception now "mostly works" * class1lib.c: correctly construct DIS frame from modem capabilities + user settings * faxrecp.c: use fax_recv_swaptable[] for bit swapping (if needed) * faxlib.c: initialize fax_recv_swaptable[] to swap bits in class 1/1.0 mode, add lots of comments to explain background * mgetty.c: get non-adaptive answering in class 1/1.0 right * various: handle "class 1" and "class 1.0" the same way (for now) Fri Dec 30 22:35:00 MET 2005 Gert Doering * class1.c, class1lib.c: rework frame sending, handle DCS * faxrec.c: split faxrec() into fax class-independent part and class 2/2.0 handler (fax2_highlevel_receive()) * faxrec.c, policy.h: drop FAX_USRobotics cruft * conf_mg.c: drop FAX_USRobotics -> SWITCHBAUD 19200 logic Wed Dec 28 22:56:57 MET 2005 Gert Doering * faxrec.c, mg_m_init.c: preparations for fax class 1 receive * class1.c, class1lib.c: very preliminary fax class 1 receiver * class1.h: fix wrong value for T30_DCN Tue Dec 20 22:01:48 MET 2005 Warren Burstein * conf_mg.c: fix typo if MAIL_TO is undefined Wed Nov 30 09:46:52 MET 2005 Gert Doering * release 1.1.34 Sat Nov 26 14:28:09 MET 2005 Gert Doering * mg_m_init.c: write to log file if blocking open() is used * logfile.c, tio.c, tio.h, mgetty.h: portability changes to GNU/kFreeBSD (by Robin Elfrink) * Makefile: new master FTP site is mgetty.greenie.net Thu Nov 24 17:38:44 MET 2005 Gert Doering * faxlib.c, voice/libvoice/detect.c: understand ATI response 1507 for another ZyXEL Omni 56K variant (56k Pro) * doc/mgetty.texi-in: document login-env-ttyprompt-hack * policy.h: drop description of ENV_TTYPROMPT, point to mgetty.texi * logname.c: replace #ifdef ENV_TTYPROMPT with run-time check of the new config option, login-env-ttyprompt-hack * mgetty.c: pass c_bool(env_ttyprompt) to getlogname() * conf_mg.h, conf_mg.c: add option login-env-ttyprompt-hack * mgetty.c: cleanup, use set_env_var() to set TERM=... Wed Nov 9 10:12:36 MET 2005 Gert Doering / D.Binderman * locks.c: a lprintf() call was missing a file name argument Fri Jun 17 19:05:27 MEST 2005 Gert Doering * faxlib.c: remove #ifdef FAX_USRobotics -> MQ_USR_FMINSP (if someone still has such an old modem, setting "modem_quirks 0x20" will do the same thing at run-time) Wed Jun 15 11:43:12 MEST 2005 Marcus Meissner * voice/libvoice/record.c: fix (non-exploitable) 1-byte buffer overflow in construction of RMD file header Wed May 25 16:04:11 MEST 2005 Gert Doering * sendfax.c: alarm() out of fcntl() if it hangs > 10s. (AIX problem) Mon Apr 25 16:27:14 MEST 2005 Gert Doering * logname.c: drain tty output before changing CR/LF settings * mgetty.h, callback/callback.c: SIG_HDLR_ARGS cleanup * mgetty.h, locks.c: prototype for rmlocks() cleaned up * faxlib.c: decode & log receiver capabilities (+FDIS/+FIS) Sat Apr 16 11:51:25 MEST 2005 Gert Doering * cnd.c: add destination number format (NDID=...) for Digi DataFire * fax/faxq.in: add "faxq stop" and "faxq start" functionality * doc/faxq.1in: document start/stop Sun Apr 10 23:02:00 MEST 2005 Gert Doering * release 1.1.33 * fax/faxq-helper.c: repair creation of multi-page fax JOB files Wed Mar 23 10:57:05 MET 2005 Gert Doering * ring.c: repair detection of V.253 RING signalling (R) Wed Mar 16 12:08:44 MET 2005 Gert Doering * t/t_ring.c: add test module for "ring.c" and "cnd.c" functions Sun Mar 13 12:43:08 MET 2005 Gert Doering * release 1.1.32 * voice/: import vgetty jumbo patch from Juergen Kosel, adding full duplex voice (experimental) and V.253 fixes * voice/libpvf/wav.c, voice/pvftools/pvfcut.c, pvfecho.c, pvfreverse.c: fix realloc(NULL) induced core dumps on older OSes Sun Feb 27 12:58:29 MET 2005 Gert Doering * g3/Makefile: add tests for g3cat -L/-w * g3/g3cat.c: add -L switch (cap lines in output file) * doc/g3cat.1in: document all command line switches * Makefile, mksed.c: new setting: SHELL_TRAP_POSIX * t/t_trap.in: test for correct shell/trap behaviour * fax/faxrunq.in: get correct "trap 0" syntax from sedscript Thu Feb 24 17:24:18 MET 2005 Gert Doering * fax/faxq-helper.c: fix scrubbing of JOB file lines, create "user" line if not present * fax/faxspool.in: don't pass logname/id information to faxq-helper anymore (unless "-u" is set) - caused weird problems, gains nothing Thu Feb 17 12:08:13 MET 2005 Gert Doering * fax/faxrunqd.in: speed up detection of new jobs in queue (<10s) * fax/faxrunqd.in: change over to 'use strict' perl Mon Feb 14 13:41:49 MET 2005 Karsten Keil * doc/mgetty.texi-in: dirindex node * mgetty.h: on __powerpc64__ platforms, define PTR_IS_LONG Wed Feb 9 10:46:08 MET 2005 Gert Doering * config.h: portability fixes ((int) cast) for 64bit platforms Mon Jan 3 17:46:36 MET 2005 Matthias Andree * fax/faxrunq.in: workaround for bash 3.x "trap" incompatibility Wed Nov 24 14:33:43 MET 2004 Gert Doering * tools/microcom.c: add utra-light terminal program * fax/faxrunqd.in: Implement 'sendfax-tty-map' (run tty-specific sendfax binary) * fax/faxrunqd.in, faxrunq.in: implement update-call-program Sun Nov 14 21:28:07 MET 2004 fdc@cliwe.ping.de (Frank D. Cringle) * frontends/X11/viewfax: import viewfax-2.6 Sat Nov 13 23:12:53 MET 2004 Gert Doering * doc/faxrunqd.8in: document sendfax-tty-map & update-call-program * fax/faxspool.in: fix wrong test for "$HOME/.make.coverpg" * fax/faxspool.in: fix spooling from stdin ("faxspool 123 -") * faxlib.c: recognize "Eicon ISDN Modem" as DIVA card with class 2 Thu Nov 11 21:54:11 MET 2004 Gert Doering * t/Makefile, t/t_echo.sh: add tests for $ECHO setting Mon Nov 8 21:07:35 MET 2004 Gert Doering * incorporate portability patches from NetBSD pkgsrc tree Tue Nov 2 09:17:37 MET 2004 Gert Doering * add t/ subdirectory and t/t_conf.c struct/int size test program * Makefile: call t/Makefile for "make test" Sat Jul 24 16:54:52 MEST 2004 Gert Doering * release 1.1.31 * doc/mgetty.texi-in: add section on isdn4linux and CAPI Sat Jul 17 17:21:38 MEST 2004 Gert Doering * doc/sff2g3.1in: add man page for sff2g3 Sat Jul 17 12:18:28 MEST 2004 Andreas Barth * cnd.c: add "+CLIP:" string for caller ID * voice/libvoice/detect.c: ATI codes for Zoom and Multitech modems * voice/libvoice/V253modem.c: more flexible sample/s. handling (old stuff was fixed at 7200 hz) * voice/pvftools/pvftormd.c: accept 7200, 8000, 11025 Hz for "Lucent" * fax/faxspool.in: use per-user .faxheader/.make.coverpg files instead of global defaults (if per-user files exists) Fri Jul 16 19:03:48 MEST 2004 Gert Doering * g3/Makefile: add "make test" test suite (for G3 tools) * g3/sff2g3.c: NEW: converter from CAPI SFF fax format to raw G3 * Makefile: pack g3/sff2g3.c Thu Feb 5 18:40:29 MET 2004 Gert Doering * fax/faxspool: rework umask saving/restoring (use subshell trick) Sat Jan 10 00:01:25 MET 2004 Gert Doering * faxlib.c: add 1503 ID code (ZyXEL U-90E) Tue Dec 16 12:46:52 MET 2003 Andreas Barth * Makefile: remove -DAUTO_PPP * policy.h: include FIDO and AUTO_PPP here Fri Dec 5 22:46:47 MET 2003 Ken Findlay * login.c: empty lines should never match, not even empty user names Mon Nov 17 20:08:59 MET 2003 Gert Doering * mgetty.c: log warning if parent PID is not "1" (init) * mgetty.cfg.in: add clarification about "direct yes" to sample cfg Fri Nov 7 21:47:27 MET 2003 Andreas Barth * fax/faxspool.in: add per-user faxheader and coverpg files * doc/faxspool.1in, mgetty.texi: document new feature Thu Oct 9 12:44:47 MEST 2003 Gert Doering * fax/faxspool.in: reject empty (0 bytes) input files Sun Oct 5 13:59:51 MEST 2003 Gert Doering * do_chat.c: make clean_line() logging show the timeout value Mon Sep 29 23:36:34 MEST 2003 Andreas Barth * contrib/g3tolj.c, g3toxwd.c: clean up protoypes and return types * various .c files: integrate Debian cleanup fixes (usually adding and/or where missing) Wed Aug 20 12:39:53 MEST 2003 Gert Doering (gert@greenie.muc.de) * fax/faxrunqd.in: change signal handling - use HUP for graceful exit, and dump statistics to logfile upon receipt of USR2 Sat Jun 28 22:14:35 MEST 2003 Gert Doering (gert@greenie.muc.de) * fax/faxq-helper.c: honour user umask when spooling G3 files (user decides whether group/other can read faxes) * fax/faxspoool.in: reset umask after creating tmpdir (with umask 077) * fax/faxq-helper.c: file name validation was overly strict - accept anything that's printable, not a space, '/' or '\' Thu Jun 12 16:56:44 MEST 2003 Gert Doering (gert@greenie.muc.de) * faxlib.c: Multitech and USR return class 2.0/2.1 +FPS:, values in decimal, not hex -> change +FPS: parser to do decimal for those modems (via modem_quirks |= MQ_FPS_NOT_HEX) * fax_lib.h: add MQ_FPS_NOT_HEX modem quirk bit * faxrec.c, faxrecp.c: understand VR=8 for "normal mode" (200x100 dpi) Mon Apr 28 19:41:14 MEST 2003 Gert Doering (gert@greenie.muc.de) * logname: make "buffer overrun" error message more precise Wed Apr 23 10:49:25 MEST 2003 John R. Jackson * voice/libutil/access.c: more verbose error reporting Wed Apr 9 23:05:23 MEST 2003 Gert Doering (gert@greenie.muc.de) * fax/faxspool.in: fix spooling without header line (-h -) Sun Apr 6 16:09:14 MEST 2003 Andreas Barth * mgetty.8in, mgetty.texi-in: document escape sequences for /etc/issue and login prompt. Wed Mar 5 21:37:38 MET 2003 Gert Doering (gert@greenie.muc.de) * Makefile: abort "make install" before installing faxspool if fax user does not exist * Makefile: unconditionally chown $FAX_SPOOL_OUT to fax user Tue Feb 4 17:46:45 MET 2003 Gert Doering (gert@greenie.muc.de) * fax/faxq-helper.c: uid=0 overrides access permission checks * fax/faxrm.in: bugfix: get faxq-helper path from sedscript Tue Jan 21 14:27:39 MET 2003 Gert Doering (gert@greenie.muc.de) * fax/faxspool.in: abort with a proper error message on input file names containing white space or quote characters Tue Jan 14 14:30:42 MET 2003 Gert Doering (gert@greenie.muc.de) * fax/faxrunqd.in: include "success" counter in per_phone_statistics * ugly.h: #define USE_VARARGS for non-Ansi C compilers * logfile.c: change #include<> sequence to catch USE_VARARGS def. Wed Jan 8 23:03:26 MET 2003 Gert Doering (gert@greenie.muc.de) * fax/faxrunqd.in: if a fax job fails, reschedule on different modem (if possible) * voice/libvoice/V253modem.c: fix ELSA_RMD_NAME (used for V.253 modem <-> other modem RMD equivalency checks) Mon Dec 16 14:08:06 MET 2002 Gert Doering (gert@greenie.muc.de) * release 1.1.30 Sun Dec 15 20:45:48 MET 2002 Gert Doering (gert@greenie.muc.de) * voice/vgetty/answer.c, voice/include/default.c: integrate Paul Fox' pre_message and beep_sound patches Thu Dec 12 07:33:12 MET 2002 Gert Doering (gert@greenie.muc.de) * voice/libvoice/detect.c: recognize MultiTech MT3334ZDXV * faxhng.c: add some result codes for the i4l DIVA driver * voice/libvoice/IS_101.c: fix DTMF events for the unshielded case Thu Dec 5 17:40:05 MET 2002 Gert Doering (gert@greenie.muc.de) * voice/vgetty/answer.c: accept arbitrary ring types, not only 0..6 Wed Dec 4 09:15:47 MET 2002 Gert Doering (gert@greenie.muc.de) * ring.c: map DRON/DROF return codes to binary word, use result as distinctive RING number Tue Dec 3 23:10:05 MET 2002 Gert Doering (gert@greenie.muc.de) * frontends/www/README: add user authentication example Mon Nov 25 22:16:41 MET 2002 Gert Doering (gert@greenie.muc.de) * voice/libvoice/V253modem.c: repair messed-up 16 bit PCM patch Mon Nov 25 14:05:20 MET 2002 Gert Doering (gert@greenie.muc.de) * release 1.1.29 * voice/libvoice/detect.c: insert delay before sending ATE0 to modem (timing issue - modem might not have sent the full \r\n sequence from the last "OK" yet when the new AT comes in) Sat Nov 23 12:55:39 MET 2002 Gert Doering (gert@greenie.muc.de) * doc/*.[158]in: bring man pages up to date * tools/ltest.c, tools/mid.c: adapt to new lprintf() prototype * mgetty.h, logfile.c: adapt to use and "..." function declaration (unless USE_VARARGS is set, which is needed for NeXT platforms). Karsten Keil . * Makefile: relax permissions on sendfax and faxrunq.config install - must be readable/executeable by user "fax" now * doc/faxrunqd.8in: document "-u", minor updates * fax/faxrunqd.in, fax/faxspool.in, fax/faxrunq.in: revert Aug 6, 200 change - put faxqueue_done back into $FAX_SPOOL_OUT/ (faxrunq/faxrunqd have no access rights to $VARRUNDIR/ anymore, and $FAX_SPOOL_OUT is no longer world writeable anyway) * fax/faxq.in: change from .last_run to faxqueue_done * fax/faxrunqd.in: add "-u " switch (set uid to ) * fax/faxq-helper.c: finalize new fax queue handling using helper process (suid fax) and a fax queue that is no longer world-readable (open issue since 1994 :) ) * faxrecp.c: implement experimental teergrubing mode (signal "page bad, please retransmit" at the end of each page - or just hang up hard on caller). Activared with "modem-quirks 0x100" or "0x200", respectively. Tue Nov 19 12:13:46 MET 2002 Gert Doering (gert@greenie.muc.de) * voice/libvoice/V253Modem.c: add 16 bit linear PCM support (patch coming from Peter Bruley) * voice/pvftools/pvftormd.c, rmdtopvf.c: add 16 bit linear PCM * rework faxq-helper concept (suid root -> suid fax) * fax/faxq.in: adap "-r" to use faxq-helper Sun Nov 17 22:19:56 MET 2002 Gert Doering (gert@greenie.muc.de) * fax/faxspool.in: adapt to use faxq-helper * fax/faxrm.in: adapt to use faxq-helper * Makefile: create FAX_SPOOL_OUT with mode 755 and owner FAX_OUT_USER * Makefile: add FAX_OUT_USER definition, pass lots of variables to fax/Makefile (for faxq-helper) * README.1st: add instructions about FAX_OUT_USER setup * doc/mgetty.texi-in add instructions about FAX_OUT_USER setup Wed Nov 13 23:12:30 MET 2002 Gert Doering (gert@greenie.muc.de) * fax/faxrunqd.in: fix symlink / file overwrite race in JOB files. Pointed out by Jablonovsky Alexander * doc/faxrunq.8in: point out insecurity in symlink handling Tue Nov 12 22:42:33 MET 2002 Nalin Dahyabhai * mgetty.h: Intel 64bit platforms (__x86_64__) needs PTR_IS_LONG Wed Nov 6 23:56:05 MET 2002 Gert Doering (gert@greenie.muc.de) * voice/libvoice/IS_101.c: implement DLE shielding for long DTMF tones for V.253 (initially by Lee Howard ) * mgetty.c: throw out DIST_RING #define - not used anymore Tue Nov 5 22:41:29 MET 2002 Gert Doering (gert@greenie.muc.de) * ring.c: make sure action strings (CONNECT) are only recognized at the beginning if a line, not in the middle (Paul Fox, pgf@foxharp.boston.ma.us, CALLER NAME = CONNECTICUT). * cnd.c: replace non-printable characters and quotes in caller ID or caller name strings with ' ' - safeguard for passing them to shell later on. Mon Nov 4 23:43:28 MET 2002 Gert Doering (gert@greenie.muc.de) * doc/mgetty.texi-in: add stuff about recent multitech modems, superfine+v.34 fax, and rework chapter about common problems * faxlib.c: fix ugliness with USR modems reporting remote fax ID as " 12345" -> skip leading '"' and all whitespace Sun Oct 20 14:32:05 MEST 2002 Gert Doering (gert@greenie.muc.de) * cnd.c: possible buffer overrun via CallName (found by "A. Guru" ) Mon Apr 8 22:28:11 MEST 2002 Gert Doering (gert@greenie.muc.de) * fax/faxrunqd: fix priority vs. write combining bug Mon Mar 11 19:26:29 MET 2002 Gert Doering (gert@greenie.muc.de) * login.c: check for close-on-exec bit on FD 0 (FreeBSD 4.1 bug) Sat Mar 2 19:23:35 MET 2002 Gert Doering (gert@greenie.muc.de) * login.c: export Caller Name as environment variable $CALLER_NAME Wed Feb 20 18:28:40 MET 2002 Gert Doering (gert@greenie.muc.de) * login.c: make message about bad permissions even more clear Thu Jan 10 21:11:20 MET 2002 Gert Doering (gert@greenie.muc.de) * release 1.1.28 * faxrec.c: replace "0"'s by "STDIN" (readability) Fri Jan 4 18:50:31 MET 2002 Gert Doering (gert@greenie.muc.de) * doc/mgetty.texi-in: some updates * doc/faxrunq.1in, doc/faxrunqd.8in: document calling convention changes (as below) * fax/faxrunq(d).in: pass (last) sendfax return code as 2nd argument to success/failure program Mon Dec 17 22:55:56 MET 2001 Gert Doering (gert@greenie.muc.de) * policy.h, utmp.c: incorporate some NetBSD changes * various: change time() prototype to "time_t time(time_t *tloc)" * mgetty.h, syslibs.h, logfile.c: some #ifdef fiddling for Darwin Sun Dec 16 14:56:18 MET 2001 Gert Doering (gert@greenie.muc.de) * doc/faxrunq.1in, doc/faxrunqd.8in: document more stuff * fax/faxrunq, fax/faxrunqd: don't run queue if a file $FAX_SPOOL_OUT/stop exists. Sun Dec 2 14:23:34 CET 2001 Gert Doering (gert@greenie.muc.de) * login.c: MAX_LOGIN_ARGS handling reworked (claimed N, but allowed only N-1), plus warning message improved. Sun Oct 21 16:40:51 MEST 2001 Gert Doering (gert@greenie.muc.de) * release 1.1.27 * doc/mgetty.texi-in: work on isdn4linux notes * cnd.c (cndtable): add swedish ZyXEL caller ID format (T. Lundgren) * cnd.c (cndtable): add "CALLED NUMBER:" (Jan Oberlaender/i4l) Fri Sep 28 23:06:24 MEST 2001 Gert Doering (gert@greenie.muc.de) * various: adaptions to OpenBSD (similar to NetBSD) Mon Jun 18 22:26:08 MEST 2001 Gert Doering (gert@greenie.muc.de) * mgetty.h: patch to adapt to Linux/S390 (PTR_IS_LONG) * frontends/www/: integrate new version from Neko Mon Apr 16 10:56:21 MEST 2001 Gert Doering (gert@greenie.muc.de) * release 1.1.26 * frontends/windows/lprfax.txt: add description of "fax port monitor" Tue Mar 13 21:32:47 MET 2001 Gert Doering (gert@greenie.muc.de) * login.c: export current tty as $DEVICE to shell Sat Feb 24 11:48:11 MET 2001 Gert Doering (gert@greenie.muc.de) * updates to frontends/www/ (minor bug fixes) * updates to voice/ (see voice/ChangeLog) Sat Feb 24 12:47:19 2001 Marc SCHAEFER * dialin.config: added V253 codes for OUT_OF_AREA and PRIVATE. Thu Feb 1 22:20:10 MET 2001 Gert Doering (gert@greenie.muc.de) * release 1.1.25 Sat Jan 27 19:14:15 MET 2001 Gert Doering (gert@greenie.muc.de) * mksed.c: fix @KVG_PID_FILE@ * getdisk.c: fix overflow on file systems with > 2G (2^31 bytes) free * getdisk.c: default MINFREESPACE from policy.h was interpreted as *bytes*, not as *kbytes*. Which kind of defeats the purpose of checking for "enough disk space". Fixed, work with kbytes now. Fri Jan 19 20:51:31 MET 2001 Gert Doering (gert@greenie.muc.de) * ring.c: add isdn4linux form "RING/" (*sigh*) Mon Jan 8 11:19:16 MET 2001 Gert Doering (gert@greenie.muc.de) * goodies.c: fix include files (Linux/FreeBSD/SVR4 dependent) Sun Jan 7 21:10:28 MET 2001 Gert Doering (gert@greenie.muc.de) * release 1.1.24 Sun Jan 7 00:28:09 MET 2001 Gert Doering (gert@greenie.muc.de) * faxrecp.c: check access rights first, space second (this will give clearer log messages for non-existing directories) * getdisk.c: fix #ifdef mess (this code did never work!) Fri Jan 5 19:30:39 CET 2001 Gert Doering (gert@mobile.greenie.muc.de) * faxrecp.c: accept multiple directories for fax storage, separated by ':'. Use the first one that is writeable and has enough disk space. * mgetty.c, conf_mg.c, conf_mg.c: add "fax-spool-in" config file option to set the incoming fax dir(s). * doc/mgetty.texi-in: document fax-spool-in Thu Jan 4 18:32:24 CET 2001 Gert Doering (gert@mobile.greenie.muc.de) * faxrecp.c: change fax page writing to open( O_EXCL|O_CREAT ) * locks.c: use mkstemp() to create tmp file, if available, open( O_EXCL|O_CREAT ) otherwise. * goodies.c: FreeBSD 3.3 already has /proc//cmdline Thu Dec 21 23:04:25 MET 2000 Gert Doering (gert@greenie.muc.de) * release 1.1.23 * goodies.c: on FreeBSD 4, use /proc//cmdline * mgetty.c: understand VMA_FAX vgetty return codes (unexpected +FCO) Sat Sep 23 16:50:14 MEST 2000 Gert Doering (gert@greenie.muc.de) * mgetty.h: Intel ia64 adaptions (PTR_IS_LONG) (coming from RedHat patches) Sat Aug 26 13:10:00 MEST 2000 Gert Doering (gert@greenie.muc.de) * frontends/X11/: new viewfax version (2.5) Thu Aug 17 19:58:20 MEST 2000 Gert Doering (gert@greenie.muc.de) * release 1.1.22 Mon Aug 14 21:20:26 MEST 2000 Gert Doering (gert@greenie.muc.de) * callback/callback.c: use VARRUNDIR instead of MGETTY_PID_FILE * mgetty.c: use VARRUNDIR to get name of PID file, non-conditional * policy.h: MGETTY_PID_FILE is gone, VARRUNDIR used instead * mgetty.c: write CallerId to UTMP, if available, Connect otherwise Sun Aug 6 16:13:43 MEST 2000 Gert Doering (gert@greenie.muc.de) * fax/faxspool: convert .pdf files via Acroread (contributed by Michael Fischer v. Mollard, mfvm@gmx.de). * Makefile, mksed: introduce $VARRUNDIR * fax/faxrunqd.in, fax/faxrunq.in, fax/faxspool.in: change location of ".last_run" to $VARRUNDIR/faxqueue_done (previously, $fax_spool_out/.last_run creation was vulnerable to symlink attacks) Tue Jul 4 20:56:30 MEST 2000 Gert Doering (gert@greenie.muc.de) * cnd.c: add NMBR= format for Digi DataFire RAS Tue Nov 02 15:23:52 1999 Gert Doering (gert@greenie.muc.de) * login.c: add \Y hack (simplar to \I) to get CallerID in ut_host field Sat Jul 31 22:10:09 1999 Gert Doering (gert@greenie.muc.de) * faxlib.c: distinguish Elink 310 and Elink 343 Sat Jul 22 11:23:29 2000 Marc SCHAEFER * SGML FAQ update. Sat Jul 24 23:25:17 1999 Gert Doering (gert@greenie.muc.de) * release 1.1.21 * ring.c: accept a few additional caller/called ID formats Mon Jun 07 22:42:29 1999 Gert Doering (gert@greenie.muc.de) * ring.c: fix bug with CalledNr saving if msn_list is empty Thu May 27 15:49:11 1999 Gert Doering (gd@medat.de) * frontends/www/: check in latest version (view both queues) * fax/faxspool.in: implement calling of external programs to do the G3 conversion (fall back to internal functions) Sat May 22 13:37:28 1999 Gert Doering (gd@medat.de) * fax/faxrunqd.in: phase II of "write combining" done (send multiple faxes to one number in one sendfax call) Sun May 09 13:05:50 1999 Gert Doering (gert@greenie.muc.de) * ring.c: count "NMBR =" line as "RING", so answering is quicker even when waiting for the Caller ID line to come in. Sat May 01 22:20:15 1999 Gert Doering (gert@greenie.muc.de) * fax/faxrunqd.in: restructure code to handle multiple jobs to same phone number (preparations for "write combining") Sun Feb 28 14:26:08 1999 Gert Doering (gert@greenie.muc.de) * mg_m_init.c: add need-dsr / DSR+CTS test loop (modem off) * conf_mg.h, conf_mg.c: add need-dsr flag * fax/faxrunqd.in: fix "pid file" handling bug (recognize own PID) Wed Feb 24 14:05:58 1999 Gert Doering (gd@medat.de) * conf_mg.h, conf_mg.c: add data-flow/fax-send-flow/fax-rec-flow * conf_sf.h, conf_sf.c: add fax-send-flow/fax-rec-flow * config.c: implement CT_FLOWL (flow control definition) * mgetty.h, tio.h: move FLOW_* definitions to mgetty.h * config.h, login.c: fix non-ANSI-C bugs Tue Feb 16 21:10:31 1999 Gert Doering (gert@greenie.muc.de) * frontends/www/faxsend.in: finish first cut * conf_mg.c, login.c, mgetty.c: make login.config run-time configurable Sat Feb 13 13:19:18 1999 Gert Doering (gert@greenie.muc.de) * fax/faxrunqd.in: implement -V * fax/faxrunqd.in, faxrunq.in: write program name to .last_run Sun Jan 17 18:22:48 1999 Gert Doering (gert@greenie.muc.de) * implement automatic PGP signing of created tarballs * release 1.1.20 * login.c: log warning if too many command line arguments given Sat Jan 16 18:19:36 1999 Gert Doering (gert@greenie.muc.de) * frontends/www: detail fixes, some new features * contrib/ptylogin/: add Marc Schaefer's ptylogin program, for securing modem/shell access to really untrustworthy people. Tue Jan 12 14:39:15 1999 Gert Doering (gert@greenie.muc.de) * cnd.c: accept ELSA (V25bis?) multi-line responses +MCR/+MRR * faxrec.c: log number of sent pages (for polling) * policy.h: change comments for EXEC_FUSER * mgetty.c: remove #ifndef linux (et al) around EXEC_FUSER Sun Dec 06 20:06:35 1998 Igor Sysoev (gert@greenie.muc.de) * locks.c: fix internal race condition (that could lead to deleteding "foreign" lock files) Tue Nov 24 21:09:05 1998 Gert Doering (gert@greenie.muc.de) * release 1.1.19 * frontends/www/faxhists.cgi: new search function (for acct.log) Sun Nov 22 11:05:58 1998 Gert Doering (gert@greenie.muc.de) * faxlib.c: add Zoom/NX autodetection * frontends/www: fine tuning, better error messages, modularity Thu Nov 19 22:30:43 1998 Gert Doering (gert@greenie.muc.de) * ring.c: merge ISDN MSN/CallerID for Zoom/NX (Thomas Schuett) Thu Nov 12 16:26:59 1998 Gert Doering (gert@greenie.muc.de) * merge Debian documentation/faxrunq.config updates * frontends/www: 'make install' works now Tue Oct 13 17:24:20 1998 Gert Doering (gert@greenie.muc.de) * frontends/www: more work on the WWW GUI * faxlib.c: ignore quote characters in the remote fax id completely (USR modems always send them) Fri Sep 11 11:29:17 1998 Gert Doering (gert@greenie.muc.de) * release 1.1.18 Wed Sep 09 23:22:27 1998 Gert Doering (gert@greenie.muc.de) * merge Marc's latest voice/ tree * some work on frontends/www/ Mon Sep 07 08:57:16 1998 Gert Doering (gert@greenie.muc.de) * mg_m_init: if TIOCSCTTY fails and getppid() != 1, log a warning "must run mgetty from /etc/inittab" (Russell King). Tue Sep 01 12:09:16 1998 Gert Doering (gert@greenie.muc.de) * mgetty.c: after "waiting...", call log_close() to make sure that the log file is properly reopened (could have been moved away by "savelog" etc. in the meantime) (Phil Hands/Debian) * logfile.c: add log_close() function * ring.c: fix 'forgetting of dist_ring number' bug (Joerg Friedrich) * logname.c(ln_escape_prompt): add some more escape sequences to get same features as 'agetty' (Phil Hands/Debian) Fri Aug 28 16:23:49 1998 Gert Doering / Simone Demmel * frontends/www/: work on WWW GUI Tue Aug 11 16:34:19 1998 Gert Doering (gd@medat.de) * fax/faxrunq.in: implement $max_fail_total, restructure code Fri Aug 07 19:41:39 1998 Gert Doering (gert@greenie.muc.de) * release 1.1.17 Mon Aug 03 22:02:16 1998 Gert Doering (gert@greenie.muc.de) * policy.h: remove FAXSEND_NO_XON * doc/mgetty.texi-in: document "modem-quirks" * mgetty.c(main): implement "post-init-chat" for modems that forget some part of their setup during fax/voice initialization * conf_mg.c, conf_mg.h: add "post-init-chat" command Sun Aug 02 22:50:53 1998 Gert Doering (gert@greenie.muc.de) * mgetty.c: remove all "RING A" / "RING 1" etc. action items -- they will break the new distinctive RING code in ring.c (found by Gord Lamb) Tue Jul 21 00:03:18 1998 Frank D. Cringle (fdc@cliwe.ping.de) * fax/faxrunqd.in: get rid of "not reached" warning after exec() Thu Jul 16 11:24:30 1998 Gert Doering (gert@greenie.muc.de) * README.1st: point to the mailing list Sun Jul 05 22:28:05 1998 Gert Doering (gert@greenie.muc.de) * release 1.1.16 (this bug is just too embarassing) * doc/mgetty.texi-in: rewrite US Robotics chapter * policy.h, doc/mgetty.texi-in, doc/modems.db: remove all references to FAX_SEND_IGNORE_CARRIER, this is really better done using sendfax.config. * conf_sf.c: make "ignore-carrier yes" the default value * ring.c: fix bug with standalone CallerID/RING (Florian La Roche) Thu Jul 02 11:42:54 1998 Gert Doering (gd@medat.de) * release 1.1.15 (on time for the C't magazine article) * sendfax.c: better logging for command line errors * conf_sf.c, conf_sf.h: add fax_max_speed/fax_min_speed/-M * sendfax.c: use fax_max_speed settings * conf_mg.c, conf_mg.h: add fax_max_speed/fax_min_speed * mgetty.c, mgetty.c, mg_m_init.c: use fax_max_speed settings Fri Jun 19 22:30:02 1998 Gert Doering (gert@greenie.muc.de) * cnd.c: add 'CallName' to call to 'cnd-program' Wed Jun 17 11:37:52 1998 Gert Doering (gert@greenie.muc.de) * Makefile, tio.h: throw away AIX3_FLOW, use '!_AIX41' instead * login.cfg.in: clarify comments, remove 'kdebug 7' * mgetty.c: change call to vgetty_answer to use new dist_ring flag Mon Jun 01 14:08:56 1998 Gert Doering (gert@greenie.muc.de) * cnd.c: implement cnd_call() [using system(), so beware...] * mgetty.c: call "cnd_call" (in cnd.c) to decide upon call acception * conf_mg.c, conf_mg.h: add "cnd-program" option * doc/mgetty.texi-in: document "cnd-program" (CallerID/mgetty.config) * callback/callback.c: fix stupid bug with "+" and "?" precendence, implement "-d" option (thanks to Gabor J. Toth) Mon May 25 13:49:19 1998 Gert Doering (gd@medat.de) * fax/faxrunq.in, faxrunqd.in: put job number (F...) into acct.log Sat May 09 16:36:52 1998 Gert Doering (gert@greenie.muc.de) * mgetty.h, logname.c: fix from Olaf Kirch to accept PPP frames with escaped "ALL STATIONS" byte (0xFF). Sat May 02 20:51:32 1998 Gert Doering (gert@greenie.muc.de) * ring.c: save ISDN MSN to CalledNr * cnd.c: new global variable, "CalledNr" for called number (MSN) * mgetty.c: pass information about "callback?" to login_dispatch() Thu Apr 23 20:18:06 1998 Gert Doering (gd@medat.de) * fax/faxrunqd.in: make faxrunqd more robust in case of modem outages, and make it load-balance jobs better. Sat Apr 18 23:32:19 1998 Gert Doering (gert@greenie.muc.de) * cnd.c: add support for "Kortex Adaptix" CallerID format * conf_mg.c, conf_mg.h: add "msn-list" option * ring.c: implement MSN -> distinctive RING mapping Fri Apr 17 09:35:49 1998 Gert Doering (gert@greenie.muc.de) * ring.c: implement ELSA and ZyXEL-I CallerID/MSN display * ring.c: adapt to USR type B CallerID: "RING 12345" * fax/faxspool.in: use "wc -w", not "wc -l" (Joseph Kwok). Wed Apr 15 21:49:56 1998 Gert Doering (gert@greenie.muc.de) * mgetty.c, mgetty.h: use wait_for_ring() instead of do_chat() now [no support for distinctive RING yet]. Mon Apr 13 20:00:44 1998 Gert Doering (gert@greenie.muc.de) * ring.c: start work on RING handler rewrite Sun Apr 05 15:11:49 1998 Gert Doering (gert@greenie.muc.de) * logname.c: replace \Y in /etc/issue with the Caller ID Thu Apr 02 18:45:13 1998 Gert Doering (gert@greenie.muc.de) * release 1.1.14 * mgetty.c: recognize "RING U" as A_RING5 (Nick Holloway) * logname.c, g3/g32pbm.c: fix some warnings (Florian La Roche) Wed Apr 01 20:05:28 1998 Gert Doering (gert@greenie.muc.de) * Makefile, ftp.sh: gzip diffs before uploading * Makefile, doc/mgetty.texi: new master FTP site: alpha.greenie.net Sat Mar 28 22:29:08 1998 Gert Doering (gert@greenie.muc.de) * release 1.1.13 Thu Mar 26 10:04:20 1998 Gert Doering (gert@greenie.muc.de) * cnd.c: repair ELSA CID support * frontends/dialog/: remove listen.in, doesn't work anymore * Makefile: remove all references to VOICE_DIR Sat Mar 14 19:25:31 1998 Gert Doering (gert@greenie.muc.de) * cnd.c: add [preliminary] support for ELSA ISDN Caller-ID * fax/faxrunqd: new scheduler with all bells and whistles done Fri Feb 06 17:19:23 1998 Gert Doering (gd@medat.de) * fax/faxrunqd: first cut of new scheduler / queue manager Tue Jan 27 12:34:36 1998 Gert Doering (gd@medat.de) * release 1.1.12 * new voice tree from Marc * fax/faxrunqd: preparations for new per-modem queues Tue Jan 20 11:40:40 1998 Gert Doering (gd@medat.de) * fax/faxrunqd: change format of "faxrunqd.policy" file * tools/ltest.c: add -d, -k options (RTSL) * tio.c: implement tio_set_rs232_lines() (for systems with the TIOCMBI[CS] ioctl() calls) Sun Jan 18 18:08:35 1998 Gert Doering (gert@greenie.muc.de) * mg_m_init.c: add detection for "setserial spd_hi/spd_vhi" and warn user if this is active (use of setserial is deprecated) Fri Dec 19 17:06:55 1997 Gert Doering (gd@medat.de) * sendfax.c: add better logging (L_AUDIT) for "failed startups" Tue Dec 16 12:35:47 1997 Gert Doering (gert@greenie.muc.de) * release 1.1.11 * voice/: revert to 1.1.9 * div: put single quotes around all occurences of "caller=" in L_AUDIT messages - may contain whitespace. * logfile: do not convert trailing \n for L_AUDIT lines to "_" Mon Dec 15 00:22:04 1997 Gert Doering (gert@greenie.muc.de) * class1.c, class1lib.c, class1.h: preliminary work for class 1 support Fri Dec 12 15:12:49 1997 Gert Doering (gert@greenie.muc.de) * fax/faxrunq.in: change format of 'acct.log' into a more machine- readable form (same as faxrunqd uses) * sendfax.c, faxlib.c: add necessary "hooks" for first class 1 implementation * class1lib.c: start low-level class 1 work Wed Dec 10 12:52:13 1997 Gert Doering (gd@medat.de) * fax/faxrunqd.in: use age of job in sorting queue (to prevent starving very long jobs on very busy machines) * fax/faxrunqd.in: correctly handle case if sendfax is killed by an unexpected/uncaught signal. * fax/faxq.in: add "-P" option, create .queue-changed if -r/-P used * fax/faxrunqd.in: if $FAX_SPOO_OUT/.queue-changed exists, flush in-memory queue and re-read fax queue from disk Tue Dec 09 13:31:19 1997 Gert Doering (gert@greenie.muc.de) * frontends/voice: add am_tools.tar (answering machine) * faxlib.c: add 56k Rockwell modems (ATI -> 56000) * faxsend.c, policy.h: FAXSEND_NO_XON is obsolete, use "modem-quirks 0x08" in sendfax.config instead. Sun Dec 07 13:50:01 1997 Gert Doering (gert@greenie.muc.de) * release 1.1.10 * voice/: fix minor build problems on SCO. Sat Dec 06 00:45:17 1997 Gert Doering (gert@greenie.muc.de) * conf_mg.c, conf_mg.h, conf_sf.c, conf_sf.h: add "modem-quirks" * conf_mg.c: fix accident "fallthrough" for "-b" * modem.c (mdm_get_idstring): never return NULL, use "" * faxlib.c,sendfax.c: add new modem type (auto1), start playing with modem capability identification via AT+FCLASS=? Thu Dec 04 12:48:22 1997 Gert Doering (gert@greenie.muc.de) * faxlib.c: add auto-detection for USR V.32terbo/fax bugs * fax/faxrunqd.in: add "policy routing" feature Tue Dec 02 17:21:48 1997 Gert Doering (gert@greenie.muc.de) * sendfax.c, mgetty.c: be more paranoid about queue flushing when exit()ing after modem initialization failure Fri Nov 28 11:31:10 1997 Gert Doering (gd@medat.de) * faxlib.c: prepare for class 2.1/V.34 speeds * mgetty.c: write user ID and parent PID to log file (diagnosis) Wed Nov 26 18:05:20 1997 Gert Doering (gert@greenie.muc.de) * conf_sf.c: implement '-D' as command-line option to set 'dial-prefix' Tue Nov 18 11:57:46 1997 Gert Doering (gd@medat.de) * fax_lib.h, faxlib.c: make FAX_USRobotics a "modem quirks" flag * mgetty.h: on GLIBC 2.x systems, use HAVE_SIGINTERRUPT, otherwise timeout handling breaks (glibc restarts system functions) Sat Nov 15 21:15:36 1997 Gert Doering (gert@greenie.muc.de) * fax/faxrunqd.in: scheduler tweaks, SIGUSR2, logging, config Tue Nov 11 21:24:46 1997 Gert Doering (gd@medat.de) * fax/faxrunqd.in: smarter scheduling for many jobs on many modems Mon Nov 03 10:01:24 1997 Gert Doering (gert@greenie.muc.de) * voice/: switch over to remote-CVS Sat Nov 1 17:31:37 MET 1997 Gert Doering (gert@greenie.muc.de) * policy.h: make /var/log/sendfax.log the default for FAX_LOG Fri Oct 31 13:54:39 1997 Gert Doering (gert@greenie.muc.de) * doc/mgetty.texi-in: add warning about recent Rockwelloid junk. * faxlib.c, faxrecp.c: if modem autodetect finds a Rockwell modem (ATI returns 28800 or 33600), disable line quality check, because Rockwell modems usually don't understand AT+FPS=2. Junk. * sendfax.c, conf_sf.h, conf_sf.c: add "open-delay " option * fax/faxrunqd.in: start external processes with " 28800 and ATI3 -> "": assume Dr.Neuhaus Cybermod * config.c: accept negative numbers for CT_INT as well Thu Jun 05 23:20:37 1997 Frank Bartels (knarf@camelot.de) * policy.h: default for the log files is now /var/log/mgetty.ttyX Tue May 27 23:35:36 1997 Andreas Jaeger (aj@arthur.rhein-neckar.de) * tools/ltest.c: fix compiler warnings and "return 0" * Makefile: add comment to link "-lutil" on Linux / GNU Libc 2.0 * utmp.c: use updwtmp() on GNU Libc 2.0 systems Mon May 26 23:41:33 1997 Roeland Th. Jansen (bengel@xs4all.nl) * magic.o: prevent cats from logging into the computer Sat May 24 20:29:39 1997 Gert Doering (gert@greenie) * mgetty.c (St_go_to_jail): fix wrong resetting of CallerId * fax/faxrm.in: remove .source-files subdirectory, if existant Mon May 19 21:23:39 1997 Gert Doering (gert@greenie) * faxlib.c: add ATI code for USR 56K modems (5601) * cnd.c: fix typo in CallerID variable name Fri May 09 11:35:17 1997 Gert Doering (gert@greenie) * faxlib.c: chop off leading whitespace of fax_station_id Mon May 05 19:13:14 1997 Gert Doering (gert@greenie) * release 1.1.6 * Makefile: generate version diffs now (finally) Sat May 03 19:06:17 1997 Gert Doering (gert@greenie) * faxlib.c: rewrite modem identify function to use mdm_get_idstring for ATI, and maybe ATI1, ATI3, ..., for more detailed information about *this* modem type (firmware etc.) [see log files] * modem.c: new function: mdm_get_idstring() * modem.c: change mdm_command timeout to 10 seconds * cnd.c: add better logging * faxlib.c: add recognition of ZyXEL Omni.NET (ATI: 1281/1292) Thu Apr 17 17:33:40 1997 Gert Doering (gert@greenie) * fax/faxq: print "priority" field, if set in the JOB file * fax/faxspool: implement -P option (for faxrunqd) Wed Apr 16 11:06:03 1997 Gert Doering (gert@greenie) * release 1.1.5 * voice/: new voice code beta Sat Apr 12 16:47:42 1997 Gert Doering (gert@greenie) * tools/ltest.c: fix fcntl() call * faxlib.c: add all modem "ATI" codes that I know of (so far) * faxlib.c: preliminary support for modem type auto-detection with ATI (*very* preliminary) * callback/callback.c: drain output queue before signalling mgetty Thu Apr 10 10:13:34 1997 Gert Doering (gert@greenie) * voice/vgetty/Makefile: link ../../faxrecp.o * Makefile: call mkidir with "./mkidir" (if "." is not in $PATH) Sun Apr 6 17:26:41 1997 Gert Doering (gert@greenie) * logfile.c (sprintf): convert non-printable characters to '_' * release version 1.1.4 * mgetty.c (main): undo the "modem-check-time" change. If you use mgetty on direct serial lines, set "modem-check-time -1" in policy.h. Wed Apr 02 19:40:46 1997 Gert Doering (gert@greenie) * Makefile, tools/Makefile: fix bugs with move of "kvg" * revoke 1.1.3, because of stupid bugs that will cause many questions Mon Mar 31 15:06:42 1997 Gert Doering (gert@greenie) * release version 1.1.3 * sendfax.c: print meaningful message on non-class2/2.0 modems. * faxlib.c: remove special handling of "ERROR" response in class 2.0 (it can only happen after end-of-page is sent, and this is already handled in fax_send_ppm), because sometimes the USR Courier sends ERROR after ATD, and this confuses sendfax (*ugly*). * faxlib.c: add faxlib_init() to re-initialize everything * mgetty.c, faxrec.c: do the ATH0 command in "mgetty.c" (don't interfere with reception of multiple faxes from voice apps) * faxlib.c: accept "NO DIALTONE" and "NO DIAL TONE" (USR special) Fri Mar 28 13:55:18 1997 Kim-Minh Kaplan (gert@greenie) * mgetty.c: don't use "modem-check-time" on direct lines (-r) Wed Mar 26 12:45:57 1997 Gert Doering (gert@greenie) * tools/ltest.c: new line tester, to show RS232 status * contrib/g3hack.c: is now in frontends/X11/viewfax*/g3hack.c * Makefile: clean up some comments * mgetty.c: protect printing of issue file with alarm() [Knarf] Mon Mar 24 21:06:58 1997 Steffen Reith (gert@greenie) * conf_sf.c: make FAX_SEND_IGNORE_CARRIER the default value for "ignore-carrier y/n" in sendfax.config Thu Mar 20 12:52:25 1997 Bjarne Kvamme (gert@greenie) * faxsend.c: remove locks on panic_exit, use exit(15) not (11) Sun Mar 09 10:57:19 1997 Gert Doering (gert@greenie) * Makefile: use "mkidirs" for directory creation - "make bindist" works now even with "unsual" path settings Sun Mar 02 12:15:24 1997 Gert Doering (gert@greenie) * tools/, g3/: move "tools" directory to "g3", create new "tools" directory for auxiliary utilities like "kvg" or "ltest". Mon Feb 24 22:18:03 1997 Gert Doering (gert@greenie) * faxrec.c, faxrecp.c: split "protocol" and "high level" functions * Makefile: sendfax links faxrecp.o only, mgetty links both * faxrec.c: add creation of UTMP record for incoming faxes ("last") Thu Feb 20 11:17:11 1997 Gert Doering (gert@greenie) * release 1.1.2 * voice/: add new voice tree from Marc Mon Feb 17 21:36:04 1997 Gert Doering (gert@greenie) * mksed.c: add @NOLOGIN@ * doc/mgetty.8in: add description of /etc/nologin.ttyxx Sun Feb 02 23:44:00 1997 Gert Doering (gert@greenie) * Makefile: split $LDFLAGS into $(LDFLAGS) (in front of the linker command line) and $(LIBS) (after all the object files) Wed Jan 22 20:58:40 1997 Gert Doering (gert@greenie) * config.c (get_config): log name of config file being read Mon Jan 20 11:37:30 1997 Gert Doering (gert@greenie.muc.de) * release 1.1.0 mgetty-1.2.1/ChangeLog-pre-1.1000066400000000000000000002450501334553713100156720ustar00rootroot00000000000000Mon Jan 20 11:37:30 1997 Gert Doering (gert@greenie.muc.de) * release 1.1.0 Sun Jan 12 16:24:40 1997 Gert Doering (gert@greenie.muc.de) * doc/mgetty.texi-in: update references to FAX_SEND_IGNORE_CARRIER * sendfax.c: throw out #ifdef FAX_SEND_IGNORE_CARRIER, use config file flag "ignore-carrier y/n" * faxsend.c: remove #ifndef's for FAX_SEND_IGNORE_CARRIER - worst thing that can happen is setting CLOCAL twice, and that should not do harm. * conf_mg.c, conf_sf.c: add brackets around union initialization * release 1.0 Thu Jan 09 21:30:15 1997 Gert Doering (gert@greenie.muc.de) * frontends/tcl/faxview-0.2: patch up to latest Tcl/Tk * mgetty.c, logname.c: make login timeout runtime-configurable * conf_sf.h, conf_sf.c: add new option "ignore-carrier" (yet unused) * fax/faxspool.in: prepend @BINDIR@ to $PATH Thu Jan 02 15:14:00 1997 Gert Doering (gert@greenie.muc.de) * release 0.99.9 * everything: rename pbmtog3 to pbm2g3, and g3topbm to g32pbm. Mon Dec 23 19:06:35 1996 Gert Doering (gert@greenie.muc.de) * release 0.99.8 Sat Dec 21 17:23:28 1996 Gert Doering (gert@greenie.muc.de) * fax/faxspool.in: fix lock file / t-bit problem * fax/faxspool.in: move driver selection for ghostscript to top of script, so you can easily use "faxg3" instead of "dfaxhigh". * fax/faxspool.in: always call "dvips" with "-P dfaxhigh" (low) now. * tio.c, tio.h: move #include , for _AIX and TIOCMGET Sun Dec 15 16:45:56 1996 Gert Doering (gert@greenie.muc.de) * add SIG_HDLR_ARGS definition to all signal handling functions, get rid of compilation warnings on SCO OSR 5.0 [and others] Thu Dec 12 22:51:43 1996 Gert Doering (gert@greenie.muc.de) * NeXT compilation warning cleanup * release 0.99.7 * new voice code (USR drivers) Sat Dec 07 18:55:41 1996 Gert Doering (gert@greenie.muc.de) * fax/faxq.in: write "Status re-activated" to JOB file Wed Dec 04 21:25:36 1996 Gert Doering (gert@greenie.muc.de) * release 0.99.6 * voice/: new voice release from Marc Thu Nov 28 22:02:13 1996 Gert Doering (gd@medat.de) * fax/faxq.in: print time of last "faxrunq" run (if "-v") * fax/faxrunq.in: make ".last_run" world-readable * fax/faxspool.in: new algorithm for naming temporary G3 files: fix problems with file names starting with ".", with *FAST* machines that can do more than one G3 file per second, and with fax files more than 100 pages long. Tue Nov 26 22:21:43 1996 Gert Doering (gert@greenie) * dialin.config: must be "all", not "any" for "catch-all" keyword * release 0.99.5 * faxrunq.config: sample file is installed as "starting point" * doc/faxrunq.1in: document configuration file * faxrunq.in: add configuration file handling (faxrun.config) and more flexibility concerning sending of mails and execution of programs depending on success/failures when sending the faxes. * faxspool.in: add "-c" flag, add some more comments * faxspool.in: fix "input" flag handling * mgetty.c: add quick fix for ZyXEL's "unexpected CONNECT" Sun Nov 24 12:20:48 1996 Gert Doering (gert@greenie) * mgetty.c (main): fix distinguished ring handling in case of "rings_wanted != 1". Thu Nov 21 23:09:11 1996 Gert Doering (gert@greenie) * tio.c: on linux, #include (compilation warnings) * conf_mg.c: make "verbose" #ifdef USE_GETTYDEFS * newslock: add * sendfax.c: set port speed *after* reading the device specific part of sendfax.config (Wim Osterholt) Mon Nov 18 20:39:27 1996 Gert Doering (gert@greenie) * mg_utmp.h, logfile.c: SCO ODT 5.0 adaptions Thu Nov 14 22:41:34 1996 Gert Doering (gert@greenie) * release 0.99.4 * voice/: new voice tree from Marc, more modem drivers Wed Nov 13 21:24:46 1996 Gert Doering (gert@greenie) * various: small AIX 4 fixes [compiles cleanly and works!] * doc/mgetty.texi-in: add some notes to the SunOS4 section Sun Nov 10 18:30:11 1996 Gert Doering (gert@greenie) * logname.c (getlogname): ignore 0x00 and 0x01 bytes in the log name - ZyXEL 2864DI/X.75 seems to send a couple after CONNECT. * callback/callback.c: fix problem with device names containing '/' * mg_m_init.c (mg_get_device): barf if DSR is low - it usually means "the modem is switched off" or "the cable is bad" * cnd.c (cndfind): remove #ifdef ELINK, always accept "raw" CID * conf_mg.c: remove explicit setting of "cnd-chat" if ELINK is defined. If you need it, set "get-cnd-chat AT\\O OK" in mgetty.config. * mksed.c: add @LOG_LEVEL@ * mgetty.cfg.in: change setting of owner/group into an example Fri Nov 08 20:48:43 1996 Gert Doering / Christoph Lameter * logname.c: send Fido's EMSI_REQ only if "do_fido == TRUE" * mgetty.c: change getlogname() prototype and call accordingly * conf_mg.c, conf_mg.h: add "fido-send-emsi y/n" flag Thu Nov 07 20:27:25 1996 Gert Doering (gert@greenie) * release 0.99.3 * doc/Makefile: improve behaviour in absence of text formatting tools * voice/: Marc's new ever-improved vgetty-Nov07. Thu Oct 24 14:24:26 1996 Gert Doering, Al Longyear, Teodore T'so * locklib/: starting work on generic, cross-program + cross-platform device locking library Mon Oct 21 11:49:36 1996 Gert Doering (gert@greenie) * doc/mgetty.texi: updated Creatix section * faxrec.c (notify_mail): change wording in case of fax polling Fri Oct 18 00:20:17 1996 Gert Doering (gert@greenie) * fax/faxspool.in: fix "test ...]" typo (SCO ksh doesn't care) Wed Oct 16 13:19:44 1996 Gert Doering (gert@greenie) * test release 0.99.2 * patches/fas212.p1: include patch for FAS to enable TIOCMGET & co. * tio.c (tio_toggle_dtr): pass mctl as *pointer* unless TIOCM_VALUE is defined (then pass as absolute value). * tio.c (tio_toggle_dtr): use TIOCMBIS/BIC to toggle DTR on Linux Thu Oct 10 23:43:43 1996 Gert Doering / Jamie Zawinski (jwz@netscape.com) * various: minor SGI/IRIX portability issues * doc/mgetty.texi-in: remove voice chapter, explain why Sat Oct 5 15:20:48 1996 Gert Doering (gert@greenie) * frontends/fax-by-lpr.txt: include "lpr" backend for faxing (nice!) * mgetty.c (main): make logging clearer for "missing ringback" Thu Oct 3 10:53:46 1996 Gert Doering (gert@greenie) * doc/Makefile (mgetty.dvi): add "-" to texi2dvi and dvips calls Wed Oct 2 11:31:54 1996 Gert Doering (gert@greenie) * mgetty.c (DIST_RING): make DIST_RING default on #ifdef VOICE * Makefile: fix new versioning scheme for "make beta" * faxrec.c (faxrec): don't send notify mail if "notify" field empty Sun Sep 29 17:01:56 1996 Gert Doering (gert@greenie) * fax/faxspool.in ($FAX_SEQ): make job IDs generated a less ugly (using "newslock" instead of unique'ifying job ID with PID) * fax/faxq.in (jobs): implement "-r" option (Martin Schulze) Sat Sep 28 23:34:38 1996 Gert Doering (gert@greenie) * Makefile: change version naming, use major/minor numbering scheme similar to Linux kernel (Marc) Mon Sep 16 21:49:43 1996 Giuseppe Ghibo (ghibo@galileo.polito.it) * mgetty.c: fix tio_mode_sane() calls to honour "ignore-carrier" Sun Sep 15 23:53:51 1996 Gert Doering (gert@greenie) * mgetty.c (main): general cleanup, write L_AUDIT message with dev="Device" if mg_init_data fails (Knarf), add dev="Device" to some of the more common error conditions Tue Sep 10 12:27:29 MET DST 1996 Gert Doering (gert@greenie) * sendfax.c (main): log state of FAX_SEND_IGNORE_CARRIER * tio.c: implement tio_get_rs232_lines() function * mgetty.c: if DCD is not active before exec'ing login, log warning * mg_m_init.c: if DCD is active before toggle DTR, log warning Mon Aug 26 13:38:36 1996 Gert Doering (gert@greenie) * tio.h: add defines for RS232 status lines (TIO_F_*) Sun Aug 25 10:10:26 1996 Gert Doering (gert@greenie) * sendfax.c: add compilation date and time to log file * mgetty.c: ditto Thu Aug 22 22:17:58 1996 Gert Doering (gert@greenie) * config.c (display_cd): #ifdef PTR_IS_LONG, print CT_INT with "%ld" * callback/conf_cb.c: Alpha fixes ( (int) --> (p_int) ) * mgetty.h: on __alpha__, #define PTR_IS_LONG (for config.h) Mon Aug 12 18:56:58 1996 Gert Doering (gert@greenie) * fax/faxrunq.in (jobs): add handling of exit(5): "NO DIALTONE" Wed Aug 07 11:04:17 1996 Gert Doering (gert@greenie) * doc/mgetty.texi-in: update voice part somewhat * voice/: include current voice tree Tue Jul 16 17:03:07 1996 Gert Doering (gert@greenie) * logname.c (getlogname): show in log file message exactly which options (FIDO/AUTO_PPP) are compiled into binary Sat Jul 13 12:31:19 1996 Gert Doering (gert@greenie) * fax/faxspool.in: make sequence number generation a bit smarter : if set in "sendfax.config", take FAX_STATION_ID from there Wed Jul 10 17:22:53 1996 Gert Doering (gert@greenie) * fax/faxq.in (jobs): add more switches (-aosr), show locked jobs * sendfax.c: add "dev=" to all L_AUDIT messages (an easy way to identify problematical modem/receiver combinations in a multi-line multi-modem environment) * fax/faxrunq.in (jobs): change locking strategy. Don't use "mv" any longer, use "link()" [via "newslock.c" from c-news]. Cleaner. * fax/faxrunq.in (PATH): prepend @BINDIR@ to PATH * compat/: pack "newslock.c" from C-News distribution. Tue Jul 09 11:29:13 1996 Gert Doering (gert@greenie) * policy.h (LOCK): make "/var/lock/LCK..%s" the default for Linux * mgetty.h: add "force_seq" to mg_init_data() prototype * mgetty.c: add "force_init_chat" to call to mg_init_data() * conf_mg.h: add "force_init_chat" to struct c * conf_mg.c: pre-initialize force_init_chat with "DLE ETX +++ATH" * mg_m_init.c(mg_init_data): change of modem initialization: do not send "+++ATH" every time, instead use a shorter (and quicker) initialization sequence, and only if that fails, send DLE ETX +++ ATH0 to "force init" the modem. If that fails as well, complain. * doc/mgetty.texi-in: add description of "force-init-chat" Tue Jul 02 23:55:35 1996 Gert Doering (gert@greenie) * Makefile: in "make tar", don't pack ".files" files Mon Jul 1 19:42:41 1996 Gert Doering (gert@greenie) * doc/mgetty.texi: found the comment that killed "texi2nroff", now the "ASCII manual" is back, finally!! * logfile.c (lprintf): don't send L_FATAL errors to console if syslogging is active (let syslogd do that, if desired) * login.c (login_dispatch): set env variables CALLER_ID and CONNECT. * samples/new_fax.mime2: better Fax-To-MIME converter by M. Spott Fri Jun 28 23:57:47 1996 Gert Doering (gert@greenie) * voice/: include Marc's vgetty release3 * logname.c (getlogname): if AutoPPP is detected, switch line to "raw" mode, so we don't echo PPP frames back to the caller Thu Jun 20 18:39:55 1996 Gert Doering (gert@greenie) * callback.c: after CONNECT, wait a bit before signalling mgetty (avoid some weird problem with hanging serial ports on Solaris) * conf_cb.c, conf_cb.h: add "prompt-waittime" parameter Tue Jun 04 19:55:09 1996 Gert Doering (gert@greenie) * conf_*.c, config.h: work around sizeof(int) != sizeof(char*) problem on ALPHA machines (ugly, but works). Sat Jun 01 18:47:59 1996 Olaf Flebbe * tio.c/tio.h: IRIX port (SVR4 but has no "termiox") Mon May 27 19:45:56 1996 Gert Doering (gert@greenie) * sendfax.c (main): write release version string to log file * faxrec.c: if first fax_wait_for(OK) fails, it will most likely be a problem with "switchbd". Write "hint" mesg to the log file. Sun May 26 11:31:08 1996 Gert Doering (gert@greenie) * doc/mgetty.texi: Section about NeXTStep added (thanks!) * tools/g3cat.c: make read/write buffers larger -> speedup * faxhng.c: add +FHS:-5: "timeout" message * fax_lib.h: add FHUP_TIMEOUT (-5) error code * faxlib.c: if fax_wait_for() hits timeout, set fax_hangup_code to FHUP_TIMEOUT, so upper layers can print sensible error msg * mgetty.h: add #define HAVE_MMAP (future extentions) * doc/mgetty.texi: typos fixed Sat May 25 12:28:45 MET DST 1996 Gert Doering (gert@greenie) * tools/g3cat.c (main): complete "fixing line width" code * doc/g3cat.1in: document "-w" Wed May 22 20:28:45 MET DST 1996 Gert Doering (gert@greenie) * tools/g3cat.c (main): fix line width on the fly, add "-w" option Sat May 18 13:25:31 1996 Gert Doering (gert@greenie) * fax/faxspool.in (spooldir): accept "Mail text" and "mail text" etc. Thu Apr 18 19:50:06 1996 Gert Doering (gert@greenie) * conf_sf.c: fix kaput initialization of "c.acct_handle" * logfile.c (lputs): log the string "NULL" if a null pointer is passed Thu Apr 11 21:33:10 1996 Gert Doering (gert@greenie) * mksed.c (main): generate @KVG_PID_FILE@ for kvg/MGETTY_PID_FILE Tue Apr 2 13:59:36 MET DST 1996 Gert Doering (gert@mobile.greenie.muc.de) * conf_cb.c: "modem_init" is a "chat" now, not a "string" anymore * callback.c: do proper modem initialization before dialout (with do_chat() / "modem-init" config file option). Some hacks to glue together do_chat.o and callback. * sendfax.c: add 'acct="..."' to all L_AUDIT messages (accounting) * sendfax.c: clean up L_AUDIT messages * conf_mg.[ch]: add "ignore-carrier" keyword * mgetty.c (St_get_login): if "ignore_carrier" is set, keep CLOCAL Thu Mar 28 22:33:16 1996 Gert Doering (gert@greenie) * doc/mgetty.texi-in (Systems): add section about HP-UX Tue Mar 26 13:01:40 1996 Wolfram Gloger (gert@greenie) * config.c: add support for escape sequences (\[rnt "\]) Tue Mar 12 22:04:34 1996 Gert Doering (gert@greenie) * fax/faxrunq.in (jobs): add support for "acct_handle" -> "-A" * fax/faxq.in: add support for "acct_handle" * fax/faxspool.in: add "-A" option (see below) Sun Mar 10 22:01:56 1996 Gert Doering (gert@greenie) * conf_sf.c: add "-A" option (set accounting handle -- just plain text data, passed through into log file, for acct. purposes) * conf_sf.h: add "acct_handle" to struct config * goodies.c: add putenv() and strdup() replacements for NeXT * logfile.c: NeXT varargs hack not necessary on non-POSIX systems Thu Mar 7 19:17:12 1996 Gert Doering (gert@greenie) * logname.c (getlogname): make logging clearer for FIDO/**EMSI case Wed Mar 06 12:30:04 1996 Gert Doering (gert@greenie) * mgetty.c: move NeXT_repair_line() up * goodies.c (NeXT_repair_line): remove EVENP/ODDP stuff Sun Mar 3 16:19:47 1996 Ben Stuyts (ben@stuyts.nl) * syslibs.h: include on NeXT systems w/o POSIX * tio.c: BSD_SGTTY adaptions - should work now * mg_m_init.c (mg_open_device): NeXT has no O_NOCTTY, so get rid of controlling tty via "ioctl( TIOCNOCTTY )" after open() * logname.c (ln_escape_prompt): use gethostname() on NeXTs * do_chat.c (clean_line): NeXT/SGTTY adaptions Sun Feb 25 22:22:22 1996 Gert Doering (gert@greenie) * mgetty.c (St_get_login): set IXANY now, if FLOW_SOFT is reques- ted for FLOW_DATA (easier for users, but can't have it for voice) * tio.c (tio_set_flowcontrol): add TIO_XON_IXANY to signal "if IXON is set, set IXANY as well" (conflict voice <-> data login) Sat Feb 24 22:00:57 1996 Gert Doering (gert@greenie) * logname.c (logname): recognize "NO CARRIER" and "ERROR" as "die immediately, no valid user name" condition Thu Feb 15 16:52:31 1996 Gert Doering (gert@greenie) * fax/faxspool.in (fs_cvt_ascii): use "Courier-Bold" font for gslp.ps Thu Feb 15 16:19:33 1996 Frank Bartels (knarf@camelot.de) * mgetty.c (main): initialize signal handlers before all else, make sure SIGUSR1 (for callback) is set up before checking for locks Thu Jan 25 19:14:36 1996 Gert Doering (gert@greenie) * mgetty.c (St_dialout): make utmp entry first, then close() standard file descriptors (fixes "dialout" problem on FreeBSD) Sat Jan 20 16:08:17 1996 Gert Doering (gert@greenie) * mgetty.h: add prototype for steal_lock() * mgetty.c: upon callback, steal lock file from callout process * locks.c: add steal_lock(), reorganize do_makelock() somewhat Mon Jan 15 00:14:59 1996 Gert Doering (gert@greenie) * cnd.c (cndtable): add FM: for ZyXEL 2864I, add some comments * mgetty.c (st_sig_callback): implemented most "glue" parts needed for callback. It actually works already! * locks.c (makelock): make sure, lock[] is *NOT* set if lock file couldn't be made, so that rmlocks() can't remove foreign files Wed Jan 3 19:23:48 1996 Gert Doering (gert@greenie) * faxrec.c (fax_notify_program): don't call program if no pages received or if no page file names available (won't make sense) * fax_lib.h: remove mdm_command() and fax_read_byte() prototypes * mgetty.h: add mdm_*() prototypes * logname.c: log AUDIT message upon login timeout Sun Dec 31 00:53:53 1995 Gert Doering (gert@greenie) * policy.h (CALLBACK_CONFIG): add CALLBACK_CONFIG + comments * mgetty.c (VOICE): incorporate Marc's new voice changes * voice/*: completely new rewrite (Marc) Mon Dec 18 21:57:53 1995 Gert Doering (gert@greenie) * faxrec.c (fax_poll_send_pages): add "NULL" parameter to call to fax_send_page() [*bytes_sent] (fax_notify_mail): add Device name to mail (Knarf's wish is my command) * fax_lib.h: add "bytes_sent" parameter to fax_send_page() * sendfax.c (main): add total number of pages, resent pages, and transmitted bytes to "success" log file entry Sat Dec 2 00:03:24 1995 Gert Doering (gert@greenie) * config.c (get_config): if key matches CT_KEYWORD, ignore everything below up to the next section_key (for Marc) * config.h: add "pseudo-type" CT_KEYWORD Mon Nov 27 18:59:31 1995 Gert Doering (gert@greenie) * conf_mg.c (mgetty_parse_args): add "-V" option: print version nr. Sat Nov 25 15:11:04 1995 Gernot Zander (gert@greenie) * mgetty.c (sig_new_config): if mgetty receives SIGUSR2, it will restart (exit) when idle, ignore the signal otherwise. This can be used to safely reload a configuration without disturbing active calls. Fri Nov 24 21:26:55 1995 Michael Staats (gert@greenie) * mg_utmp.h: add prototypes for get/setutent(), on _AIX * do_stat.c (get_statistics): ANSI/K&R fixes * mg_m_init.c (mg_init_fax): ANSI/K&R fixes * do_chat.c (do_chat_send): ANSI/K&R fixes Mon Nov 20 19:34:45 1995 Uwe Storbeck (gert@greenie) * faxrec.c (fax_get_page_data): change file permission and ownership before starting actual reception (race condition). Sun Nov 12 13:10:02 1995 Gert Doering (gert@greenie) * logname.c (getlogname): change input handling (raw mode), should *finally* fix the old BS/DEL/ECHOE problem on Linux * mg_m_init.c (mg_open_device): make error messages easier to read Sun Nov 5 15:45:28 1995 Gert Doering (gert@greenie) * fax/faxspool.in (spooldir): recognize "Mail text" as ASCII Sat Nov 4 16:48:46 1995 Gert Doering (gert@greenie) * faxsend.c: when switching off H/W flow control on SunOS (because the DCD line will go low after the last page), make sure the buffer is completely drained before -- otherwise, we risk modem overrun. (Thanks to Nils Jonsson). * tio.c: implement tio_drain_output() Wed Nov 1 23:56:36 1995 Gert Doering (gert@greenie) * tio.h: add tio_drain_output() and tio_break() * tio.c: add tio_break() [send a BREAK] Sun Oct 29 22:46:36 1995 Gert Doering (gert@greenie) * faxspool: if called with "-h -", don't put header line on pages Wed Oct 25 18:46:36 1995 Gert Doering (gert@greenie) * sendfax.c (main): exit(5) on NO DIALTONE (not exit(10)) * faxlib.c (fax_wait_for): add proper support for NO DIALTONE * fax_lib.h (FHUP_NODIAL): add #define for NO DIALTONE * faxhng.c: add NO DIALTONE response, move error numbers Sun Oct 22 15:50:01 1995 Erik Olson (eriko@wrq.com) * logname.c: add auto-detection code for incoming PPP calls * mgetty.h: add defines for PPP * login.cfg.in: add sample /AUTOPPP/ line Sat Sep 30 10:53:11 1995 Gert Doering (gert@greenie) * tools/g3topbm.c: add credits Tue Sep 19 23:08:43 1995 Gert Doering (gert@greenie) * sendfax.c (main): correct byte order for polling on class 2.0 (hack) Sat Sep 16 22:13:51 1995 Gert Doering (gert@greenie) * mksed.c: added PERL and TKPERL Fri Sep 15 13:56:44 1995 Gert Doering (gert@greenie) * fax/faxspool.in: use only fullname, nothing more, from passwd * fax/faxq.in (jobs): print "Send time:" only if set Wed Sep 6 18:27:00 1995 Gert Doering (gert@greenie) * sendfax.c (main): implement renaming of sent pages ('-r') make exit_usage() messages a bit easier to read * conf_sf.c: add "-r" option * conf_sf.h: add "rename_files" Wed Aug 30 13:52:01 1995 Gert Doering (gert@greenie) * release version 0.98 Wed Aug 9 10:06:36 1995 Gert Doering (gert@greenie) * various: include NeXT fixes by Christian Starkjohann * locks.c (do_makelock): if unlink(stale lock) fails, because of permission problems or whatever, we'll loop forever. Fixed. Sun Aug 6 18:27:06 1995 Gert Doering (gert@greenie) * mgetty.c (main): make "gettydefs tag" message mode understandable Fri Aug 4 09:23:28 1995 Gert Doering (gert@greenie) * faxrec.c: make receipient of fax_notify mail run-time configurable Sun Jul 30 19:44:42 1995 Gert Doering (gert@greenie) * utmp.c (make_utmp_wtmp): do not NULL-terminate ut_user field if username is same size as ut_user field Sat Jul 29 13:55:28 1995 Gert Doering (gert@greenie) * faxlib.c (fax_wait_for): result code of +FPTS: xx,yy,zz is decimally coded, +FPS: in hex * sendfax.c (main): in class 2 mode, add AT+FNR=1,1,1,0 (otherwise, the modem won't report connection parameters et.al.) * added sample mgetty.cfg.in and sendfax.cfg.in files * Makefile: install mgetty.config and sendfax.config sample files Sat Jul 29 13:44:48 1995 Robert Vogelgesang (gert@greenie) * logfile.c (lprintf): set close-on-exec bit for log file Mon Jul 24 15:20:29 1995 Michael Rendell (michael@cs.mun.ca) * config.c (fgetline): skip over leading whitespace in comment lines Wed Jul 5 15:01:45 1995 Gert Doering (gert@greenie) * policy.h: on SCO, set default MAILER to /usr/lib/mail/execmail * logname.c (getlogname): log EOF explicitely Sun Jul 2 11:39:25 1995 Gert Doering (gert@greenie) * mgetty.c: add +FHS: and +FHNG: to "failure" strings Fri Jun 30 00:06:57 1995 Gert Doering (gert@greenie) * login.c (login_dispatch): more detailed logging * conf_mg.c (mgetty_parse_args): dumb bug, now -C works again Tue Jun 26 21:23:22 1995 Gert Doering (gert@greenie) * locks.c (rmlocks): barf if unlink() fails * mgetty.c (St_go_to_jail): wait for line to settle down before removing locks and go to St_waiting. * mgetty.c (init): voice_message_light has to be called *before* removing locks... (only if #ifdev VOICE anyway) Thu Jun 15 09:23:22 1995 Gert Doering (gert@greenie) * do_stat.c (get_statistics): add current time to statistics_file Wed Jun 14 20:00:05 1995 Gert Doering (gert@greenie) * fax/faxspool.in (/etc/magic): cut of "foo.bar:" part of file output * fax/faxrunq.in (jobs): work around BASH bug with trap/subshell Mon Jun 12 22:29:39 1995 Gert Doering (gert@greenie) * locks.c (get_lock_name): convert only *last* character to lowercase if LOCKS_LOWERCASE is set. * policy.h (LOCKS_LOWERCASE): change comment Mon Jun 5 10:18:03 1995 Gert Doering (gert@greenie) * mg_m_init.c (mg_init_fax): add "fax_only" setup * conf_mg.c: add "fax-only" option / -F command line flag * voice/zplay.c: initialize modem with ATV1Q0 * Makefile: create *all* directories at "make install" time Thu May 18 23:04:08 1995 Gert Doering (gert@greenie) * fax/faxspool.in (AWK): with gs 3.33, gslp.ps and -dSAFER do not work together. Throw out -dSAFER, won't harm *here*. Fri Apr 28 00:28:05 1995 Gert Doering (gert@greenie) * mgetty.c (main): fix vgetty problem with number of rings / toll saver feature (vgetty subtracting toll-saver-rings multiple times) Sun Apr 23 11:22:26 1995 Gert Doering (gert@greenie) * locks.c (makelock): set lock[0] to 0 if do_makelock() fails -- some weirdos like to kill running mgettys with "kill" or "init 4" while someone dials out, and mgetty tended to unlink() foreign lock files in that scenario... Wed Apr 19 14:22:13 1995 Gert Doering (gert@greenie) * do_stat.c (get_statistics): implement (yet-simple) statistics grabbing support (-> Uwe Fuerst, Chris Lewis) * do_chat.c: move "send" part into separate function Tue Apr 18 15:57:11 1995 Russel Nelson (nelson@crynwr.com) * tools/g3topbm.c (main): -n/-f flags, auto-detect resolution Sun Apr 16 22:52:37 1995 Gert Doering (gert@greenie) * config.h: protect against double inclusion (->vgetty) * mgetty.h: protect against double inclusion (->vgetty) Mon Apr 10 22:14:13 1995 Gert Doering (gert@greenie) * mgetty.c (main): conf_set_string doesn't take a ";"... Thu Apr 6 12:57:26 1995 Gert Doering (gert@greenie) * faxrec.c (faxpoll_send_pages): allow multiple pages to be polled * Makefile: included "do_stat.c" (silly me) Tue Apr 4 00:30:35 1995 Gert Doering (gert@greenie) * fax/faxrunq.in (.last_run): if "set noclobber" is set, overwriting a file with "date >.last_run" won't work. "rm -f". * mgetty.c (main): add call to "get_statistics", if desired (main): if issue_file starts with "!", execute via system() * conf_mg.h: add "statistics-chat" and "statistics-file" Fri Mar 31 19:51:08 1995 Stefan Muehlenweg (muehlenw@hydromod.de) * doc/mgetty.texi-in (Solaris2): Add section about Solaris Wed Mar 29 00:21:30 1995 Gert Doering (gert@greenie) * faxsend.c (fax_send_ppm): if FAX_SEND_IGNORE_CARRIER is set, do not call tio_carrier()/tio_set(), because it will mess up some internal kernel structures on SVR42 (and it isn't needed anyway) Sun Mar 26 19:21:13 1995 Gert Doering (gert@greenie) * fax/faxq.in: add help text * fax/faxspool.in (fs_cvt_dvi): add sample code for "dvi2ps" : add a few more suffixes (.asc, .pcl) and "file" results (PCL) * fax/faxrunq.in (jobs): return "subject" in status mails (jobs): fix problem with "date +%H%M" and SCCS * fax/faxq.in (jobs): print "subject" field as "Re:" if present Sun Mar 24 19:04:04 1995 Gert Doering (gert@greenie) * faxqueue.5in: add "subject" keyword Fri Mar 24 00:04:04 1995 Gert Doering (gert@greenie) * sendfax.c (main): implement "max-tries-continue" * policy.h: change MODEM_INIT_STRING to a sane default for all modem types. ZyXEL specific stuff goes to config file. * conf_sf.c: add "max-tries-continue" keyword * tio.h: make POSIX_TERMIOS the default on SCO Unix systems * mgetty.c (St_answer_phone): implement get-cnd-chat (for ELINKs) Tue Mar 14 09:20:33 1995 Tony Leneis (tony@plaza.ds.adp.com) * getdisk.c, tio.h, io.c: some m88k adaptions Mon Feb 27 16:43:12 1995 Gert Doering (gert@greenie) * sendfax.c (main): handle +FHS:3 and +FHS:4 properly Fri Feb 24 14:56:28 1995 Gert Doering (gert@greenie) * config.c (get_config): empty string is interpreted as TRUE for boolean configuration values Thu Feb 23 14:57:03 1995 Gert Doering (gert@greenie) * faxrec.c (faxrec): add explicit ATH0 for creatix (won't return from bitrate-fixed-to-19200 otherwise). Sat Feb 11 22:57:04 1995 Gert Doering (gert@greenie) * mgetty.c (main): add option to set TERM=xxx from config file Fri Feb 10 19:47:30 1995 Gert Doering (gert@greenie) * sendfax.c (fax_sig_goodbye): if pressed before starting to dial, log "time=0s". Tue Jan 31 21:34:37 1995 Gert Doering (gert@greenie) * io.c: fixed problem with system includes on SCO Unix/Xenix Fri Jan 27 20:29:55 1995 Gert Doering (gert@greenie) * fax/faxspool.in (fs_cvt_ascii): call gslp.ps "-B" Wed Jan 25 10:54:03 1995 Gert Doering (gert@greenie) * faxrec.c (fax_notify_mail): show in first line whether reception was successful Sat Jan 14 19:34:43 1995 Gert Doering (gert@greenie) * tio.c: NeXT adaptions Mon Jan 9 22:56:55 1995 Gert Doering (gert@greenie) * tio.h (FLOW_BOTH): add definition :) Fri Dec 23 12:04:56 1994 Gert Doering (gert@greenie) * doc/mgetty.texi-in (runtime-mgetty): add description of runtime config files for mgetty * config.c (get_config): accept octal / hexadecimal integer values * config.c (conf_get_chat): fix stupid unterminated-string bug Fri Dec 16 22:09:34 1994 Gert Doering (gert@greenie) * mg_m_init.c (mg_get_ctty): on HP/UX, do not try TIOCSCTTY Mon Dec 12 16:04:01 1994 Gert Doering (gert@greenie) * faxsend.c: remove REVERSE definition (unused) * tio.h: add for _AIX (default ctrl keys) Sun Dec 11 18:20:49 1994 Gert Doering (gert@greenie) * conf_mg.c: change semantics of FAX_IN_OWNER/GROUP Thu Dec 8 16:14:26 1994 Gert Doering (gert@greenie) * policy.h (MINFREESPACE): change from byte units to kbyte Tue Dec 6 15:46:27 1994 Gert Doering (gert@greenie) * cnd.c (cndlookup): use makepath() to make "dialin.config" relative to CONFDIR * sendfax.c (main): move "invalid modem class" warning * conf_sf.c: initialize "modem-handshake" field only if FAX_MODEM_HANDSHAKE is defined * policy.h (FAX_STATION_ID): changed default to "xxxxxxxx" Mon Dec 5 19:07:09 1994 Gert Doering (gert@greenie) * fax/faxspool.in: use @CONFDIR@ for configuration stuff, rename global fax alias file to "faxaliases" * doc/mgetty.texi-in (runtime-sendfax): config files documented Sat Dec 3 22:25:29 1994 Gert Doering (gert@greenie) * Makefile: pack and compile conf_sf.* * sendfax.c: add configuration file reading * conf_sf.c: reorder confiuration items * fax/faxrunq.in (FAX_SENDER): do not set "-l" (->config file) Thu Dec 1 16:15:41 1994 Gert Doering (gert@greenie) * logfile.c (log_init_paths): if path name changes, and log file is already open, close log and reopen with new name Wed Nov 30 20:49:36 1994 Gert Doering (gert@greenie) * mksed.c, Makefile: add CONFDIR * Makefile: add conf_sf.c/.h * policy.h: add SENDFAX_CONFIG, change comments regarding config files Tue Nov 22 07:58:05 1994 Gert Doering (gert@greenie) * mg_m_init.c (mg_open_device): on errno=EAGAIN, try open() again (Linux sends this if a process blocks on open() and a parallel dial-out finishes) * do_chat.c (clean_line): add device name to "got too many junk" line Mon Nov 21 10:03:09 1994 Gert Doering (gert@greenie) * cnd.c (cndfind): Rockwell format recognition broke ZyXEL CND. Fixed. * faxrec.c (faxrec): make baud rate switching dynamic (new argument "switchbd") * mgetty.h: change faxrec() prototype * mgetty.c (main): change "portspeed" to contain numerical speed * mgetty.c (main): call faxrec() with FAX_RECV_SWITCHBD param * policy.h: change all occurences of B19200 or B38400 to 19200 and 38400, respectively. Change some comments. FAX_RECEIVE_USE_B19200 dropped, and FAX_RECV_SWITCHBD introduced. * tio.c (tio_set_speed): changed to expect numeric port speed, lookup symbolic constants here Sat Nov 19 01:21:07 1994 Gert Doering (gert@greenie) * logfile.c: check for (M_XENIX && !M_UNIX) (SCO Unix defines both) Wed Nov 16 19:46:42 1994 Gert Doering (gert@greenie) * sendfax.c (fax_open_device): use three digits as device id, not two Sun Nov 13 23:05:41 1994 Gert Doering (gert@greenie) * faxlib.c (fax_wait_for): accept CONNECT\r and CONNECT \r -- there are so many broken modems out in the word ("FURY") Sun Nov 13 13:30:41 1994 Gert Doering (gert@greenie) * release version 0.22 Sun Nov 13 14:46:30 1994 Gert Doering (gert@greenie) * samples/coverpg.*: add "-m " functionality * doc/coverpg.1in: document "-m" Wed Nov 9 17:46:30 1994 Gert Doering (gert@greenie) * doc/mgetty.texi-in (MultiTech): add some hype about that modem Fri Nov 4 14:21:52 1994 Gert Doering (gert@greenie) * login.c (login): substitute \I -> Connect ("CONNECT xxx") * policy.h: remove FAX_SPOOL and FAX_SPOOL_IN definitions from policy.h, use definitions from Makefile instead Thu Nov 3 19:08:58 1994 Gert Doering (gert@greenie) * gettydefs.c (parsetermio): accept ^? as (0x7f) Wed Nov 2 10:03:49 1994 Gert Doering (gert@greenie) * mgetty.c (main): on direct lines, set Connect to "DIRECT" * logname.c (getlogname): clean up timeout handling: all output is now done outside signal handler (Martin) * fax/faxspool.in (finalpg): if no pages created (and not polling), remove spool dir, do not create empty JOB (spooldir): recognize ".t" and ".txt" for ASCII * utmp.c (make_utmp_wtmp): add proper UT_USER handling for FreeBSD * mgetty.c (main): handle DEFAULT_MODEMTYPE "data" properly * logname.c (getlogname): move sleep(3) from getlog_timeout() to getlogname() [problems with signal handler] Tue Nov 1 20:56:37 1994 Gert Doering (gert@greenie) * mgetty.c (make_pid_file): chown() to 644 * utmp.c: repair Martins get_current_users() function Mon Oct 31 11:17:45 1994 Gert Doering (gert@greenie) * mg_m_init.c (mg_init_data): additional argument, chat_seq[] * mgetty.c (main): add "-m " option (via conf_get_chat()) * config.c (conf_get_chat): remove surplus L_JUNK logging * mgetty.c (main): call getlogname( do_timeout = !blocking_open ) (main): change "-m" option to "-k" * logname.c (getlogname): add boolean "do_timeout" parameter Mon Oct 31 10:53:56 1994 Martin Husemann (martin@euterpe.owl.de) * g3cat.c, g3topbm.c: cast for "off_t" (BSD 4.4 uses 64 bit!) * mgetty.h: on *BSD include , will define the exact BSD type (4_3, 4_4) * utmp.c: get_current_users() for BSD added Thu Oct 27 00:53:56 1994 Gert Doering (gert@greenie) * add "make install-bin" and "make install-doc" targets * faxlib.c (fax_set_flowcontrol): typo in prototype Wed Oct 26 11:29:52 1994 Gert Doering (gert@greenie) * fax/faxspool.in(fax_cvt_ascii): add hp2pbm and pbmtext variants (options): add "-h" option to set private fax page header file (fax_cvt_dvi): add "dvips -P dfaxlow" (optional) * fax/faxspool.in: do not call every fax_cvt_xxx() function separately, just call fax_cvt_$format(). * fax/faxspool.in: add normal resolution conversions * samples/coverpg.*: check "$normal_res" env variable Tue Oct 25 23:11:20 1994 Gert Doering (gert@greenie) * faxlib.c (fax_wait_for): *stupid* bug in +FHS: handling Sat Oct 22 15:37:45 1994 Gert Doering (gert@greenie) * mgetty.c (gettermio): drop "tio_get()" call, unneccessary and causing problems * logfile.c (lprintf): fix core dump if logfile can't be opened * tio.h, tio.c: move declaration of speedtab[] to tio.c * mgetty.c, mg_m_init.c: use "int" for portspeed, not short, so it will work on FreeBSD's B115200 * mg_m_init.c (mg_get_line): new function, will call mg_open_line() and mg_init_line(). If mg_init_line() fails, will try a second time (problem on SunOS / Linux where every port access after hangup will fail). * mgetty.c (main): call mg_get_line() instead of open/init_line() Fri Oct 21 14:58:05 1994 Gert Doering (gert@greenie) * logname.c (getlogname): change / printing a bit * tio.c (tio_mode_cbreak): disable ISIG * fax/faxrunq.in (jobs): add support for "normal_res" -> "sendfax -n" Fri Oct 14 00:09:05 1994 Gert Doering (gert@greenie) * faxrec.c (fax_get_pages): if page is bad, request retransmission Thu Oct 13 14:00:59 1994 Gert Doering (gert@greenie) * faxlib.c (fax_wait_for): evaluate +FHS:x,lc,blc,... code * login.c (login): rename login() to login_dispatch() * mgetty.c (St_wait_for_RING): implemented "-R" ringback (St_get_login): rename login() to login_dispatch() [BSD conflict] Sun Oct 9 17:19:12 1994 Gert Doering (gert@greenie) * fax/faxrunq.in (jobs): check send time (jobs): clean bug in "trap" unsetting * fax/faxspool.in (PGM): fix test sequence -- didn't work on some non-standard /bin/test programs Sat Oct 8 22:30:00 1994 Gert Doering (gert@greenie) * fax/faxspool, Makefile: use cour25.pbm instead of cour24i.pbm (better suited for header files) Thu Oct 6 14:17:21 1994 Gert Doering (gert@greenie) * mgetty.c: use tio_check_speed() * tio.c: make struct speedtab static, create tio_check_speed() Tue Oct 4 10:05:06 1994 Gert Doering (gert@greenie) * sendfax.c (fax_open_device): make "locked, give up!" look nicer. * tools/pbmtog3.c (main): fix '-r'-Switch Mon Oct 3 10:17:33 1994 Gert Doering (gert@greenie) * mgetty.c (St_wait_for_RINGs): if A_CONN is found, get ctty! Sun Oct 2 18:07:56 1994 Gert Doering (gert@greenie) * fax/faxspool.in (Options): make "usage" output better readable : implement "-t" option * fax/faxq.in (jobs): add printing of "time" flag (for "-v") Thu Sep 29 15:09:22 1994 Gert Doering (gert@greenie) * sendfax.c (main): add L_AUDIT logging of call status (+FHS:xx) and connection time (time=iiis) in seconds. Wed Sep 28 12:11:47 1994 Gert Doering (gert@greenie) * tio.c: NeXT has no OXTAB or TAB3 * syslibs.h: NeXT has no malloc.h * goodies.c: dummy putenv() for NeXT * logfile.c: NeXT (stdargs stuff) * getdisk.c: NeXT (vfs.h) * fax/faxspool.in (PGM): allow "-C" switch to set coverpage program with arguments (for "faxmemo") (PGM): give progress messages Thu Sep 22 00:03:39 1994 Gert Doering (gert@greenie) * fax/faxspool.in (options): add "-C" option to set coverpg pgm Wed Sep 21 14:06:06 1994 Gert Doering (gert@greenie) * fax/faxspool.in (WARNING): print warning of faxrunq hasn't been run in the last 24 hrs. * fax/faxrunq.in (end): touch $FAX_SPOOL_OUT/.last_run (to make faxspool happy) * fax/faxspool.in (finalpg): add message "spooling finished. wait for faxrunq" * faxsend.c (fax_send_page): remove the "drain output" stuff, it's really not much use anymore (and won't work either) : set SIGALRM handler in class 2.0 (BUG) (fax_send_ppm): set alarm(120) before handling end-of-page (the remaining 20-30 seconds from fax_send_page() may be too short) * sendfax.c (main): output "dial failed (BUSY)" to stdout, not stderr Tue Sep 20 16:39:45 1994 Gert Doering (gert@greenie) * sendfax.c (fax_open_device): try locking three times, with 5 seconds delay in between, in case lock is temporary Mon Sep 19 22:18:01 1994 Gert Doering (gert@greenie) * tio.c (tio_flush_queue): add queue flushing for BSD_SGTTY (tio_flow): add starting/stopping output for BSD_SGTTY * Makefile: append proper "chmod" after each "mkdir" introduce $(FAX_SPOOL_OUT) Sun Sep 18 00:28:01 1994 Gert Doering (gert@greenie) * tio.c (tio_flush_queue): stupid typo (TEMIO instead of TERMIO) * moved new_fax sample scripts from contrib/ to samples/ * mgetty.c (main): system( EXEC_FUSER ) * policy.h: add EXEC_FUSER * mgetty.c (st_dialout): clean up utmp writing / logging in case some other process is already active upon mgetty startup * fax/faxspool.in (finalpg): substitute @ID@ in page header add "-F full-name" switch update manpage * mksed.c: add @FAX_STATION_ID@ * fax/faxspool.in: use @LIBDIR@/make.coverpg to generate cover pages Sat Sep 17 16:56:51 1994 Gert Doering (gert@greenie) * manpages: use "mksed" * policy.h (FAX_MODEM_HANDSHAKE): prefix AT to samples Fri Sep 16 15:28:21 1994 Gert Doering (gert@greenie) * mgetty.c (St_waiting): fix "virtual RING"s, jumped into St_check_modem instead. Tue Sep 13 11:18:53 1994 Gert Doering (gert@greenie) * logfile.c (lprintf): call atexit(logmail) only once, even if there are more than one L_FATAL errors Sun Sep 11 12:52:48 1994 Gert Doering (gert@greenie) * tools/g3topbm.c: fixed emitpbm return code Sat Sep 10 22:13:11 1994 Gert Doering (gert@greenie) * sendfax.c (main): move FAX_MODEM_HANDSHAKE to its own initialization (using mdm_command(), not fax_...) : add FAX_DIAL_PREFIX * policy.h (FAX_DIAL_PREFIX): added (with comments, "ATx0DT0wP") Wed Sep 7 22:25:29 1994 Gert Doering (gert@greenie) * tools/g3cat.c (main): omit that stupid "EOF!" message Tue Aug 30 23:11:40 1994 Gert Doering (gert@greenie) * fax/faxspool.in: add ``@N@ -> full user name'' substitution * io.c: AIX -> _AIX * mgetty.c (St_wait_for_RINGs): if "-r" is set, get a controlling tty before entering St_get_login (bugfix) * mksed.c (main): new substitution: @LOGIN@ (DEFAULT_LOGIN_PROGRAM) * Makefile (login.config): sedscript from login.cfg.in (@LOGIN@) Wed Aug 24 11:21:22 1994 Gert Doering (gert@greenie) * fax/faxrm.in (suspeded): stupid bug, checking for $JOB not JOB Mon Aug 22 01:21:50 1994 Gert Doering (gert@greenie) * mg_m_init.c (mg_init_fax): remove warning about class 2.0 (it's well enough tested, not more or less "preliminary" than the rest) * goodies.c (get_ps_args): stupid typos Sun Aug 21 16:46:01 1994 Gert Doering (gert@greenie) * locks.c: make lock[] (lock file name) globally visible * mgetty.h: add proto for makelock_file() Fri Aug 19 13:55:47 1994 Gert Doering (gert@greenie) * mg_m_init.c (mg_get_ctty): log errors in setsid() only if not EPERM (Linux) * faxlib.c (fax_wait_for): make timeout cover complete invocation of fax_wait_for(), not restarted for every line read Sun Aug 14 16:15:30 1994 Gert Doering (gert@greenie) * faxrec.c: remove chmod() prototype altogether * fax/faxspool.in (gs): replace all "-dSAVER" by "-dSAFER" Sat Aug 13 22:59:05 1994 Gert Doering (gert@greenie) * tio.h: make POSIX_TERMIOS the default on SVR4 and Solaris2 * tio.c (tio_set_flow_control): log flow control type * faxrec.c: include for chmod() on SVR4 * logfile.c (atexit): on SunOS4, use on_exit() Fri Aug 12 22:59:05 1994 Gert Doering (gert@greenie) * faxsend.c (fax_send_page): return result code of fax_send_ppm() Thu Aug 11 16:41:16 1994 Gert Doering (gert@greenie) * faxrec.c (fax_get_page_data): filter out "()/\&<>" characters from the remote id when building fax file name * tio.c: add unusual baud rates (from gettydefs.c) * fax/faxspool.in (spooldir): abort if file format unknown Wed Aug 10 12:06:35 1994 Gert Doering (gert@greenie) * mgetty.c (St_dialout): put process command line into ut_host field * tio.c (tio_set_flow_control): TC[GS]ETX don't work on Solaris * mgetty.h: add get_ps_args() prototype * mgetty.c (main): use new checklock() return type * locks.c (checklock): return int PID (or NO_LOCK) if lock file exists / does not exist, instead of boolean TRUE / FALSE * mgetty.h (NO_LOCK): change checklock prototype, define NO_LOCK Tue Aug 9 11:32:19 1994 Gert Doering (gert@greenie) * mgetty.c (St_wait_for_RINGs): repair DISTINCTIVE RING stuff : fix some typos Mon Aug 8 13:53:12 1994 Gert Doering (gert@greenie) * mgetty.c (main): make_utmp_wtmp(): add ut_host (=NULL) param * login.c (login): put Connect string into utmp(x).ut_host field * logfile.c: don't define syslog() prototypes on solaris2 * all: remove lines consisting solely of ";" - "make noident" can do it (with sed \1) Sun Aug 7 11:05:11 1994 Gert Doering (gert@greenie) * do_chat.c (clean_line): log only first 500 bytes (clean_line): if more than 10000 bytes read, assume something seriously wrong, log a FATAL message, and go ahead (do_chat will quite likely fail, thus restarting mgetty) Thu Aug 4 16:59:44 1994 Gert Doering (gert@greenie) * io.c (wait_for_input): use L_JUNK instead of L_NOISE * do_chat.c (clean_line): on systems with broken termio(s), that is, where VMIN=0 VTIME>0 does not work, use a select()/flush loop * mgetty.c (main): multiply MODEM_CHECK_TIME by 1000 * io.c (wait_for_input): change second argument from seconds to milliseconds /* msec! */ Wed Aug 3 11:10:41 1994 Gert Doering (gert@greenie) * mg_m_init.c (mg_init_data): if do_chat() fails, log with L_FATAL. Set errno to EINTR / EINVAL, depending on what_action. * do_chat.c (do_chat): don't log timeouts with L_ERROR, could be harmless (in case of RING or so), let caller decide Tue Aug 2 12:46:18 1994 Gert Doering (gert@greenie) * doc/mgetty.8: created, list all options * mgetty.c (main): call wait_for_input with timeout, iff it does time out, check whether the modem is still alive (main): shuffle the ctty stuff somewhat around, make sure that there is never the need to get rid of a controlling tty * policy.h: add MODEM_CHECK_TIME * mgetty.h: change prototype for wait_for_input() * io.c (wait_for_input): add second parameter, specifying a timeout time, in seconds. Clean up USE_READ stuff. * mgetty.c (main): add autobauding (via "-a" switch) (main): log mgetty_version * Makefile (version.h): dynamically create version.h, each time a tar/shar archive is made Sun Jul 31 22:54:46 1994 Gert Doering (gert@greenie) * fax/faxspool.in (echo): use @ECHO@ for all $echo statements * fax/faxq.in (echo): use @ECHO@ * fax/faxrm.in (echo): use @ECHO@ * fax/faxrunq.in (echo): use @ECHO@ * Makefile (ECHO): add ECHO definition + comment * mksed.c (main): add ECHO substitution Wed Jul 27 11:00:45 1994 Gert Doering (gert@greenie) * mg_m_init.c (mg_get_ctty): log errors of setsid() and TIOCSCTTY separately (make error locating easier) * policy.h (SYSLOG_FC): make syslog facility configurable * logfile.c (lprintf): use SYSLOG_FC instead of LOG_DAEMON Fri Jul 22 10:50:17 1994 Gert Doering (gert@greenie) * mgetty.c (main): introduce DevID, containing the device name with all '/' converted to '-'. : use DevID for log file, pid file, nologin file name (make_pid_file): use global variable for the file name, unlink() the pid file before calling login() * mgetty.h: added prototype for mydup() Thu Jul 21 19:05:01 1994 Gert Doering (gert@greenie) * faxrec.c (faxrec): #ifdef FAX_USRobotics, wait for the OK *before* changing the baud rate * faxlib.c (fax_set_dcc): #ifdef FAX_USRobotics, don't set max speed, USR have broken the AT+FCC command in their modems * policy.h: add FAX_USRobotics and MGETTY_PID_FILE * fax_lib.h: add prototype for fax_set_flowcontrol * faxlib.c (fax_set_flowcontrol): in class 2.0 mode, send AT+FLO command corresponding to the value of hw_flow; in every other mode, do nothing. * sendfax.c (main): send class 2.0 flow control cmd * faxrec.c (faxrec): send proper class 2.0 flow control cmd to modem Mon Jul 18 21:21:16 1994 Gert Doering (gert@greenie) * mg_m_init.c (mg_drop_ctty): new function, try to get rid of the damn thing * mgetty.c (main): after locking for dialin, get the line as ctty * mg_m_init.c (mg_open_device): open() with O_NOCTTY (mg_get_ctty): new function, acquire controlling tty Tue Jul 12 14:29:53 1994 Gert Doering (gert@greenie) * mgetty.h (SVR42): #ifdef solaris2 -> #define SVR42 : change basename() to get_basename() * mgetty.c (main): swap chown() and chmod() -> security issue * sendfax.c (main): don't barf on absolute device names, just barf if the device name is absolute and not under /dev (fax_open_device): strip leading /dev/ if present. * faxrec.c (fax_get_page_data): if the first character of the device id used in the fax name is a "/", use the third-to-last character of the device name. If that's a "/" too, use "-". * tio.c: #include * locks.c: #ifdef SVR4 *after* #include "mgetty.h" * logname.c (getlogname): change putc() to fputc() [ISC stupidity] Sat Jul 9 16:43:58 1994 Gert Doering (gert@greenie) * fax/*.in: changed #!/bin/sh to #!@SHELL@ * mksed.c (main): add @SHELL@ substitution * Makefile: comments about SunOS 4, Solaris 2 * various: change all "#ifdef sun" to "#ifdef sunos4" * mgetty.h: make sure that on "sun" always one of "sun4/solaris2/solaris86" is defined Fri Jul 8 00:32:34 1994 Gert Doering (gert@greenie) * cnd.c (cndfind): ugly workin of Rockwell's multi-line CONNECT messages. Has to know to much about Modem. Not good. * mgetty.c (main): if blocking_open == TRUE, don't wait for a character on the line; output /etc/issue immediately. Wed Jul 6 00:32:34 1994 Gert Doering (gert@greenie) * mgetty.c (main): implement "-b" flag (and argv[0] == "getty" magic) for opening a port non-blocking * logname.c (ln_escape_prompt): if memory is low, return input ptr instead of NULL Sat Jul 2 23:44:12 1994 Gert Doering (gert@greenie) * fax/faxrm.in ($JOB.suspended): forgot the $jobid/ prefix Tue Jun 28 22:05:05 1994 Gert Doering (gert@greenie) * sendfax.c (main): don't terminate the AT that is sent befor the extra_modem_init with a "\r"... Thu Jun 16 02:36:38 1994 Gert Doering (gert@greenie) * fax/faxspool.in (phone): allow ,; in the phone number (delay!) Fri Jun 3 08:10:35 1994 Gert Doering (gert@greenie) * faxhng.c: added result codes newly introduced by class 2.0 Sun May 29 22:01:53 1994 Gert Doering (vishy@madrad.radiology.wisc.edu) * getdisk.c: adaption for ULTRIXSTATFS Wed May 25 13:01:53 1994 Gert Doering (gert@greenie) * mgetty.c (main): remove lock file after fax reception (main): sysV86 changes (prototypes / make_utmp_wtmp) Tue May 24 13:35:52 1994 Gert Doering (gert@greenie) * logname.c (getlogname): ignore leading '-' Thu May 19 08:56:55 1994 Gert Doering (gert@greenie) * mgetty.c (main): -I option added * sendfax.c (main): -I option added Wed May 18 23:52:07 1994 Gert Doering (gert@greenie) * mgetty.c (main): in state St_waiting, set SIGHUP to SIG_IGN (remember, on some systems, on setting B0, every process gets a SIGHUP! So this can happen if something else out-dials!) * locks.c (rmlocks): remove lock only if it's ours Sat May 14 15:04:31 1994 Gert Doering (gert@greenie) * logname.c: + -> "syslibs.h" * (various others): or -> "syslibs.h" * faxsend.c (fax_send_page): use fax_send_swaptable[] (fax_send_ppm): scan + evaluate +FHS: response (ugly) * faxlib.c (fax_set_bor): init swap tables (fax_wait_for): recognize +FPI: and +FCIG: responses * faxlib.c (swap_bits): delete Thu May 12 23:20:43 1994 Gert Doering (gert@greenie) * sendfax.c (main): move the AT+FET stuff to faxsend.c * faxsend.c (fax_send_page): call fax_send_ppm() at the end, do not send DLE ETX yourself * faxsend.c (fax_send_ppm): depending on modem_type, send DLE ETX + AT+FET or DLE * mg_m_init.c (mg_init_device): acquire new controlling tty (TIOCSCTTY) Tue May 10 21:38:13 1994 Gert Doering (gert@greenie) * faxlib.c (fax_get_line): created (fax_command): use fax_send() (fax_send): attach MODEM_CMD_SUFFIX to string (mdm_command): created (fax_get_modem_type): created * faxrec.c (fax_get_pages): remove \r\n from fax_send() command * mgetty.c (main): add "modem_type" + "-C " switch * policy.h (DEFAULT_MCLASS): introduced Sat May 7 20:02:30 1994 Gert Doering (gert@greenie) * faxlib.c (fax_wait_for): recognize +FHS:xx code * faxrec.c (fax_get_page_data): handle (2.0) * fax_lib.h (SUB): add "SUB" (for ) * do_chat.c: add #include * faxlib.c (fax_read_byte): remove ``extern int errno'' : remove no-longer used lprintf() statement * login.c: remove explicit declaration of ``int errno'' * logfile.c: remove explicit declaration of ``int errno'' Sun May 1 01:24:07 1994 Gert Doering (gert@greenie) * tio.c (tio_map_uclc): bracked with "#ifndef OLCUC" * logfile.c: do not declare sys_errlist[] on __FreeBSD__ * getdisk.c: shuffle around some #ifdefs for FreeBSD and BSDI Fri Apr 29 01:15:31 1994 Gert Doering (gert@greenie) * mgetty.c (main): detail changes in St_nologin * io.c: don't define poll() prototype on AIX * tio.c (tio_map_uclc): not available on BSDI * mgetty.c (main): convert to state machine * mg_utmp.h: add #include before , for BSD Thu Apr 28 13:18:16 1994 Gert Doering (gert@greenie) * tools/g3topbm.c (main): if the page is longer than MAX_ROWS, realloc() bitmap, don't dump core! Wed Apr 27 00:07:55 1994 Gert Doering (gert@greenie) * mg_m_init.c: created. Do all the MGetty-Modem-INITializations here. Functions: mg_init_data(), mg_init_fax(). * faxrec.c: move faxpoll_server_init() to mg_m_init.c, make faxpoll_server_file global (mg_m_init.c sets it) * mgetty.c (main): don't do modem initialization here, call functions in mg_m_init.c (main): add -D (data-only) switch * mgetty.h: add prototypes for mg_init functions, change prototype for faxpoll_server_init Tue Apr 26 22:00:26 1994 Gert Doering (gert@greenie) * mgetty.c: removed #include (not needed anymore) Mon Apr 25 11:59:35 1994 Gert Doering (gert@greenie) * mgetty.c (main): on a system with a two-user-limit, don't make a "dialout" utmp entry * released 0.20 Sun Apr 24 11:35:08 1994 Gert Doering (gert@greenie) * logname.c (logname): kludge **EMSI_INQC816 packet handling around D'Bridge bug (no CR at end of packet) Sat Apr 23 21:32:16 1994 Gert Doering (gert@greenie) * faxsend.c (fax_send_page): timeout-protect sending of the page data (just in case some *&!$%&* modem locks up and leaves the host in ``stopped'' state). * faxsend.c (fax_send_panic_exit): do everything that's possible to hangup + reset modem (everything heavily alarm() protected) * tio.h: add prototypes for tio_flush_queue() and tio_flow() * tio.c (tio_flush_queue): created [flush in/output queue(s)] * tio.c (tio_flow): created [stop/restart tty output] Thu Apr 21 10:04:03 1994 Gert Doering (gert@greenie) * mgetty.c: added AT\\OA answer string for the ELINK * utmp.c (make_utmp_wtmp): remove check for success again, at least linux' pututline() returns ``void'', no diagnostics :-( Wed Apr 20 14:57:30 1994 Gert Doering (gert@greenie) * login.c (login): cleanup all the login dispatcher stuff, properly implement utmp entries and "@" -> user substitution, use of strtok() instead of homegrown code, and, most important, syntax error checking (login): be paranoid about ownership / file mode of LOGIN_CFG_FILE * logname.c (ln_all_upper): if a \377 is found, assume **EMSI_INQ, return "not all uppercase" (getlogname): fix logging of **EMSI_... packets * utmp.c (make_utmp_wtmp): check return code of pututline(), allow changing of LOGIN_PROCESS records Tue Apr 19 00:01:31 1994 Gert Doering (gert@greenie) * cnd.c (cndfind): for the ELINK modem, accept any line that starts with a digit as CallerId. * login.c (login): more checks for validity of LOGIN_CFG_FILE * policy.h: changed LOGIN_CFG_FILE to "login.config", added big bright neon warning message (that noone will read) about changes Mon Apr 18 00:39:10 1994 Gert Doering (gert@greenie) * login.c (login): implement new syntax, with utmp entries and substituting '@' -> user name * logname.c (getlogname): implemente uppercase/lowercase mapping * tio.c (tio_map_uclc): implemented * do_chat.c (do_chat): initialize errno before lprintf( L_ERROR, ..) * mgetty.c (main): if waiting for RING times out, and we've read zero RINGs so far, exit(): most likely the modem ``forgot'' its baud rate and needs a reinitialization Sun Apr 17 14:47:46 1994 Gert Doering (gert@greenie) * doc/mgetty.texi (Receiving): add note about faxv * Makefile: add dialog/faxv and dialog/playback.sh to distribution Sat Apr 16 20:39:36 1994 Gert Doering (gert@greenie) * locks.c (do_makelock): if write()ing the PID to the temp file fails, issue L_FATAL message and fail. Wed Apr 13 12:52:24 1994 Gert Doering (gert@greenie) * sendfax.c (main): too many tries: page shown was wrong (main, fax_open, fax_open_device): implement "-S" * tools/g3cat.c (main): clean up argument handling (long due) (puteol/main): add padding (-p switch) Tue Apr 12 18:43:43 1994 Gert Doering (gert@greenie) * sendfax.c (main): correct the "Failure transmitting (null)" buglet * logfile.c (log_init_paths): strip leading file path components Mon Apr 11 11:39:46 1994 Gert Doering (gert@greenie) * sendfax.c (fax_open_device): set log_infix (via log_init_paths()) to the last two characters of the device name * sendfax.c (main): use log_init_paths, log_set_llevel * mgetty.c (main): use log_init_paths, log_set_llevel * contrib/faxin.c (main): use log_init_paths, log_set_llevel * logfile.c (log_init_paths,log_set_llevel): created API functions to hide internal data structures (log_path, log_level, ...) Sat Apr 9 13:56:49 1994 Gert Doering (gert@greenie) * faxrec.c (fax_get_page_data): first chmod(), then chown() fax file (was the other way round) * fax/faxspool.in (permissions): create FAX_SPOOL_OUT if it doesn't exist yet (or something removed it) (finalpg): substitute @DATE@ with the output of `date` * mgetty.c (main): escape tokens in "/etc/issue" (\U, \D, ...) * fax/faxq.in (jobs): change "PAGES" display (in -v mode) Sat Apr 9 13:47:30 1994 Chris Lewis (gert@greenie) * fax/faxrunq.in (jobs): add "sent successfully after unsuccessful tries" message to success mail Tue Apr 5 21:37:42 1994 Gert Doering (gert@greenie) * mgetty.c (main): unset O_NDELAY /before/ dup()ing the filedescriptor to stdout/stderr. * login.c (login): add DEFAULT_LOGIN_PROGRAM instead of hardcoded "/bin/login" - on FreeBSD, login is located in "/usr/bin". (uh?!) Thu Mar 24 10:16:28 1994 Uwe Fuerst (gert@greenie) * faxrec.c (fax_get_page_data): change "/" in remote fax id to "-" in fax file names. Mon Mar 14 12:16:15 1994 Gert Doering (gert@greenie) * logname.c (getlogname): when receiving **EMSI_CLI packet, do not start ifcico, instead, re-read login name Sun Mar 13 00:19:02 1994 Gert Doering (gert@greenie) * tio.c (tio_toggle_dtr): on SVR4, use TIOCMBI* to toggle DTR (tio_toggle_dtr): on HPUX, use TCGETA/SETAF to toggle DTR change strings used for "tio_compilation_type" * mgetty.c (main): call tio_default_cc() for initialization of the TIO->c_cc[] array (so it will be used even if not -DUSE_GETTYDEFS) * gettydefs.c: use tio_default_cc to initialize c_cc[] array (ccchars): add SVR4.2 flags Sat Mar 12 01:10:40 1994 Gert Doering (gert@greenie) * tio.c (tio_default_cc): new function, initialize the c_cc array for POSIX_TERMIOS and SYSV_TERMIO to default values, initialize the (few) sgtty control characters properly. (tio_set_flow_control): on SVR4.2 systems, do *not* use termiox * tio.h: add lots of defines (CDSUSP, CLNEXT, ...) used in SVR4.2 and a few others * Makefile (DISTRIB): sample FAX_NOTIFY_PROGRAMs in contrib/ Fri Mar 11 01:45:55 1994 Gert Doering (gert@greenie) * tools/g3topbm.c (main): fix argument parsing ( i < argc check ) Wed Mar 9 10:59:29 1994 Gert Doering (gert@greenie) * tools/g3cat.c (main): output warning if no input file was specified * tools/g3topbm.c (main): fix bug in writing of PBM header when "-stretch" is used Wed Mar 9 10:45:00 1994 Steven Work (steve@work.bellingham.wa.us) * tools/g3topbm.c: implement "-stretch" option to double each row in the g3 file (make image whith "fine" aspect ratio from "normal" resolution fax). Tue Mar 8 15:34:43 1994 Gert Doering (gert@greenie) * mgetty.c: change make_utmp_wtmp() calls to new argument type, make "dialout" utmp/wtmp entry (so "who" shows dialouts) * mgetty.h: remove prototypes for utmp functions (->mg_utmp.h) Mon Mar 7 12:02:50 1994 Gert Doering (gert@greenie) * logname.c (getlogname): if FIDO is defined, accept not only **EMSI_INQ but all **EMSI...\r packets. (FrontDoor tends to sending **EMSI_DAT instead of **EMSI_INQ) * login.c (login): fixed bug in handling of empty lines * fax/faxspool.in (phone): change alias handling, accept a comment (->verbose_to) as third field in the alias file; further, accept multiple whitespace between alias name and phone number (use $AWK instead of grep | cut). * tools/g3cat.c (main): implement "-h " option * fax/faxrunq.in (jobs): implement locking (JOB <-> JOB.locked), including 'trap'ing all necessary signals * mgetty.c (main): put tio_carrier( TRUE ) before delay(prompt_waittime) - there was a (small) time window where the modem could hangup without the host noticing it. (sig_goodbye): add "dev=" to audit message Fri Mar 4 00:40:47 1994 Gert Doering (gert@greenie) * fax/faxrunq.in: command line parsing, "-q" option Thu Mar 3 12:30:02 1994 Gert Doering (gert@greenie) * fax/faxspool.in: output note if reading from stdin : implement command line argument parsing, implement "-f", "-u", "-D", "-p" and "-q" options. : substitute @D@ in the fax header with "verbose_to" (phone): if alias used, and verbose_to is empty, set it to the alias name * fax/faxrunq.in (jobs): implement "mail" field (jobs): put double quotes around all "$MAIL_TO" occurences * fax/faxq.in (jobs): implement "mail" field (jobs): remove "for" loop for "pages" Wed Mar 2 14:19:50 1994 Gert Doering (gert@greenie) * fax/faxspool.in (FAX_ALLOW): ignore anything after first blank in .../fax.allow (so Harald Milz can put his user names there) * fax/faxrunq.in (jobs): if "poll" flag found, call "sendfax -p" * fax/faxspool.in (maxnr): repair page numbering, broken by last change (stdin): if "-" is specified as a file type, use stdin (Matz) * fax/faxq.in (jobs): add "verbose_to" token (only for faxq -v) * fax/faxspool.in (finalpg): repair `ls -rt` bug (page order was not always correct), using string concatenation instead Tue Mar 1 01:08:19 1994 Gert Doering (gert@greenie) * sendfax.c (main): #ifdef FAX_SEND_SWITCHBD, change to the given baud rate immediately after sending +FCLASS=2 and receiving OK. (main): call siginterrupt() on systems that have it * policy.h: introduce FAXSEND_NO_XON, write comment for it introduce FAX_SEND_SWITCHBD, write comment for it * faxsend.c (fax_send_page): make waiting for Xon optional * faxrec.c (fax_get_page_data): skip leading junk before receiving page data, but logging it (have seen some error messages here...) * tools/pbmtog3.c (convert_pbm_raw): reading from pipes may return less bytes than requested -> fix it. * mgetty.c (main): handle device nodes in subdirectories (use strrchr(...,'/')+1 for log_path and /etc/nologin.$tty) * locks.c (get_lock_name): handle file names with and without leading /dev/ (or even /dev/term/...) prefixes * tools/Makefile: add pbmtog3, use $(INSTALL) * fax/Makefile: use $(INSTALL) : use $(FAX_SCRIPTS) instead of a list of single files each time * fax/faxrunq.in (FAX_SENDER): use SBINDIR, not BINDIR * Makefile: add + use SBINDIR and INSTALL * mksed.c (main): add SBINDIR * config.c: do not include termio.h * logfile.c: do not include openlog()/syslog() prototypes on BSD systems * tio.h: on BSD systems, make POSIX_TERMIOS the default * mgetty.h: if __FreeBSD__ is defined, do define BSD. If BSD is defined, don't compile getopt() prototype Tue Mar 1 00:58:04 1994 Gunther Shadow (gert@greenie) * mgetty.c (main): not all systems default to interruptible system calls, for those that don't, use siginterrupt( ..., TRUE ). Make this the default if BSD is defined. Mon Feb 28 22:26:15 1994 Gert Doering (gert@greenie) * tio.c: bracked EXTA / EXTB defines in speedtab[] with #ifdef EXTA / #ifdef EXTB Mon Feb 21 21:22:22 1994 Gert Doering (gert@greenie) * fax/faxspool.in (spooldir): clean up format detection (via "dd bs=1 count=...") and format conversion (fax_cvt_$format). Sun Feb 20 11:31:42 1994 Gert Doering (gert@greenie) * mgetty.h (MAXLINE): change MAXLINE to 1024 (may be necessary for **EMSI_DAT packet in getlogname()) Sun Feb 20 09:54:06 1994 Eugene Crosser (crosser@pccross.msk.su) * logname.c (getlogname): output XON character after **EMSI_REQ Sat Feb 19 00:31:22 1994 Gert Doering (gert@greenie) * do_chat.c (do_chat): do a str*n*cmp on "RING", to make sure "RING\r" is matched, too (virtual rings) Thu Feb 17 18:55:50 1994 Jens Hektor * tio.h: #ifdef CNSWTCH should be if*n*def CNSWTCH. changed. Tue Feb 15 15:48:19 1994 Gert Doering (gert@greenie) * doc/mgetty.texi (Zyxel): add paragraph about S18 register * tio.h: add prototype for dumpgettydefs() Mon Feb 14 01:24:00 1994 Gert Doering (gert@greenie) * sendfax.c (main): broke polling when introduced "FHNG:-4" code, repaired Sat Feb 12 00:45:36 1994 Gert Doering (gert@greenie) * ugly.h: created from all the K&R / ANSI macros in mgetty.h * tools/*.c: replaced mgetty.h by ugly.h * fax/faxspool.in: add support for gif, tiff, xwd file types * fax/faxspool.in: $echo all error messages to stderr, not stdout Fri Feb 11 14:49:35 1994 Gert Doering (gert@greenie) * doc/mgetty.texi (ISC): update notes about ISC * fax/faxq.in (AWK): use @AWK@ for awk programs * fax/faxspool.in (AWK): ditto * fax/faxrunq.in (AWK): ditto * mksed.c (main): add AWK substitution * Makefile (AWK): create a definition for awk, pass it to mksed Thu Feb 10 22:29:48 1994 Gert Doering (gert@greenie) * mgetty.c (main): if /etc/nologin prevents answering the phone, do not exit(), instead, go to waiting - thus, one can always have the modem pick up the phone manually (DATA/VOICE) without mgettys modem initialiations interfering. * faxlib.c (fax_wait_for): accept \r and \n as line separator Tue Feb 8 23:00:23 1994 Gert Doering (gert@greenie) * logfile.c (lprintf): if opening the log file doesn't work, try to log to console, if that doesn't work either, do not log at all (a lot better than exiting!) Tue Feb 8 21:22:15 1994 chris@cj.in-berlin.de (Christof Junge) * mgetty.c (main): reverse meaning of NO_SYSVINIT (was wrong) Fri Feb 4 21:50:48 1994 Gert Doering (gert@greenie) * release 0.18 * documentation changes for some modems Fri Feb 4 20:00:48 1994 Klaus Weidner (klaus@snarc) * documentation changes for vgetty part Fri Feb 4 15:53:33 1994 caz@psq.mei.co.jp (Caz Yokoyama) * faxrec.c: ifdef MEIBE -> no chmod() prototype * do_chat.c (clean_line): make empty on MEI BE machines Fri Feb 4 15:53:33 1994 Gert Doering (gert@greenie) * fax/faxrm.in: created, first draft, "-i" not yet working Thu Feb 3 19:08:34 1994 Gert Doering (gert@greenie) * fax/faxrunq.in (jobs): changed ``requeue'' text, add ``verbose_to'' keyword Sun Jan 30 00:54:33 1994 Gert Doering (gert@greenie) * mksed.c (main): capsulate MAILER with double qoutes (blanks!) * faxsend.c (fax_send_page): check fax_hangup, not fax_hangup_code * fax/faxspool.in: avoid race condition by first creating JOB.q, then ``mv''ing it to JOB * faxlib.c: initialize fax_hangup_code with FHUP_UNKNOWN * fax_lib.h: add FHUP_UNKNOWN * faxhng.c: add text for FHUP_UNKNOWN Sat Jan 29 22:48:53 1994 Gert Doering (gert@greenie) * sendfax.c (main): if FAX_SEND_IGNORE_CARRIER is defined, do not clear CLOCAL flag before starting page send (main): if FAX_SEND_MAX_TRIES <= 0, then do not resend page (but print lots of warnings - and you're on your own!) * policy.h: add FAX_SEND_IGNORE_CARRIER, add comment about FAX_SEND_MAX_TRIES 0 Thu Jan 27 21:12:39 1994 Earl Hartwig (earl@fozzi.ocunic.on.ca) * faxrec.c: #ifndef sun the chmod() prototype * policy.h: #ifdef SVR4 || sun the /var/spool/locks path Sun Jan 23 13:12:39 1994 Klaus Weidner (klaus@snarc.greenie.muc.de) * mgetty.c: send "VOICE_ATA" define instead of "\dATA" - better configuration * mgetty.c: call voice_initpaths() Sun Jan 23 13:12:39 1994 Gert Doering (gert@greenie.muc.de) * locks.c (makelock): create makelock_file() function, rename old makelock() function to do_makelock() (no arguments, use global variable "lock"), create new makelock() function that will have "classic" behaviour. * policy.h: changed / clarified comments * io.c (bzero): add #define bzero() -> memset() (defined only if NEED_BZERO is set - some systems, e.g. SCO 3.2.2, do not have bzero()) Sun Jan 23 11:49:50 1994 Carsten Paeth (calle@calle.in-berlin.de) * logfile.c: add #ifndef linux around syslog prototypes Fri Jan 21 00:34:02 1994 Gert Doering (gert@greenie.muc.de) * Makefile: "move" stuff into subdirectory mgetty-0.$(VN) (faked) Thu Jan 20 18:10:02 1994 Gert Doering (gert@greenie.muc.de) * mgetty.c: rmlocks() before return to state waiting Wed Jan 19 22:45:02 1994 Gert Doering (gert@greenie.muc.de) * doc/faxspool.1: updated * fax/faxspol.in: use $LIBDIR/faxheader as fax page header text Wed Jan 19 10:25:02 1994 Gert Doering (gert@greenie.muc.de) * faxrec.c,policy.c: chmod( fax_file, FAX_FILE_MODE ); Tue Jan 18 23:15:02 1994 Gert Doering (gert@greenie.muc.de) * io.c, utmp.c: ISC dependencies Mon Jan 17 12:15:02 1994 Gert Doering (gert@greenie.muc.de) * faxrunq.c: add "-l @FAX_MODEM_TTYS@" to sendfax' argument list * mksed.c: add FAX_MODEM_TTYS to sedscript substitutions * logfile.c: append '\n' to L_AUDIT messages into the logfile (better readability) * faxrec.c (fax_get_page_data) - set call_start if it is not initialized yet. * contrib/faxin.c: CallerId, CallName variables added * contrib/Makefile: link new modules to faxin * mgetty.c: removed log_level++/log_level-- debug stuff * mgetty.texi: caller-ID section added * fax/faxspool.in: configurable * fax/Makefile: check for /etc/magic <-> PBM signature * fax/etc-magic: the most important "/etc/magic"s Sun Jan 16 19:15:02 1994 Gert Doering (gert@greenie.muc.de) * dialin.config: provide sample version with comments * Makefile: some changes for sedscript / DISTRIB * getdisk.c: fixed includes / defines for SCO Unix (M_UNIX->SVR3) * faxrec.c: junk faxrec_s_time, use call_start everywhere Sun Jan 16 19:15:02 1994 Chris Lewis (clewis@ferret.ocunix.on.ca) * mgetty.c: initialize call_start * faxrec.c: L_AUDIT log call_done - call_start Fri Jan 14 18:30:02 1994 Chris Lewis (clewis@ferret.ocunix.on.ca) * mgetty.c: L_AUDIT message extended * do_chat.c: extend comments * do_chat.c: build full lines, feed into cndfind(), cnd.c * mgetty.h: add external / type declarations for cnd.c and getdisk.c * logname.c: connect message token (\I), blank after prompt removed * sendfax.c: uglify, add pid to L_AUDIT/fail message * doc/mgetty.texi: clarifications for 3B1, spelling errors * doc/*.1: "-" -> "\-" in title line * config.c: some pointer conversions cleaned * login.c: added getpwnam() prototype, extend L_AUDIT logging * gettydefs.c: #include * Makefile: cng.o getdisk.o linked * getdisk.c: created * cng.c: created Fri Jan 14 18:30:02 1994 Gert Doering (gert@greenie) * various: Chris Lewis' latest (CND, disk space, logging) Thu Jan 13 18:41:02 1994 Gert Doering (gert@greenie) * fax/faxrunq, fax/faxq: changed to ".in" files, manipulated by ``sedscript'', generated by ``mksed.c'' * doc/faxq.1: created * Makefile, fax/Makefile, tools/Makefile: cleaner hierarchy * mgetty.texi: added "reset" part to mgetty.texi Wed Jan 12 21:41:02 1994 Gert Doering (gert@greenie) * do_chat.c: introduce A_TIMOUT for timeout, distinguishable from A_FAIL (BUSY, ERROR, NO CARRIER, ...) * mgetty.c: if phone stopps ringing before we get the desired number of rings, do not exit, go to "waiting..." instead Wed Jan 5 03:41:02 1994 Gert Doering (gert@greenie) * faxrec.c (fax_send_pages): leave page-receive loop if fax_poll_req == TRUE (faxrec): implement very simple fax poll server (1 page) (fax_notify_mail): include polling notification in mail * sendfax.c (main): change fax_poll_req to fax_poll_wanted, to avoid confusions with fax_poll_req used in faxlib.c (for remote fax poll requests) * faxsend.c: create, with fax_send_page() in here (slightly modified: pass the fax TIO descriptor here, no fax_close() call) * sendfax.c: move fax_send_page() to faxsend.c * fax_lib.h: add fax_send_page() prototype * tio.h: add #define __TIO_H__ (for fax_lib.h) Tue Jan 4 17:34:23 1994 Gert Doering (gert@greenie) * mgetty.c (main): add "-S" switch, add call to faxpoll_server_init() * mgetty.h: add prototype for faxpoll_server_init() Mon Jan 3 02:35:41 1994 Gert Doering (gert@greenie) * tio.c: move speedtab[] from mgetty.c to tio.h/tio.c * logname.c (ln_escape_prompt): add '\S' token (port speed) * tio.h: add prototype for tio_get_speed() * tio.c: new function, tio_get_speed() * logname.c (getlogname): log character before checking for tsync/yoohoo caller and stripping to 7 bit * faxlib.c (fax_wait_for): understand +FDTC -> fax_poll_req = TRUE * faxlib.c (fax_send): send MODEM_CMD_SUFFIX instead of "\r\n" Sun Jan 2 18:05:13 1994 Gert Doering (gert@greenie) * do_chat.c (do_chat): send MODEM_CMD_SUFFIX instead of hardcoded "\r\n" (and log what is sent) * mgetty.c (main): use NOLOGIN_FILE instead of hardcoded "/etc/nologin.%s" * policy.h: added NOLOGIN_FILE and MODEM_CMD_SUFFIX * mgetty.c (main): move signal() calls to before answering phone * locks.c (get_lock_name): use lowercase device names for locking purposes if LOCKS_LOWERCASE is set (SCO convention) (MaM) (readlock): after guessing the lock file type, check whether it fits the setting of LOCKS_BINARY, if not, write a warning into the log file. * policy.h: add LOCKS_LOWERCASE + comment * gettydefs.c (mydup): make mydup() global * mgetty.c (sig_goodbye): added signal handler for signals INT, QUIT, HUP and TERM that will remove locks and log the signal number Tue Dec 28 01:22:48 1993 Gert Doering (gert@greenie) * logfile.c (lprintf): move test whether log level is high enough before test whether log file should be opened (avoid noisy printing of "--" to otherwise empty log files) Mon Dec 27 21:45:28 1993 Gert Doering (gert@greenie) * mgetty.c: added "V1" to first init string (MaM) * do_chat.c: added "policy.h" (for DO_CHAT_SEND_DELAY) Thu Dec 23 12:35:07 1993 Gert Doering (gert@greenie) * utmp.c: ifdef ISC -> typedef short pid_t Sun Dec 19 23:20:55 1993 Gert Doering (gert@greenie) * mgetty.h: getopt() prototype only if M_UNIX not defined * mgetty.c: change order of policy.h and tio.h (USE_GETTYDEFS) Sat Dec 18 18:50:55 1993 Gert Doering (gert@greenie) * faxrec.c (fax_get_page_data): i = sprintf() -> strlen() * logname.c (ln_escape_prompt): SunOS changes - do not use int return code of sprintf() anymore * sendfax.c: SunOS changes - FLOW_HARD off while DCD is low * mgetty.c: SunOS changes - FLOW_HARD off while DCD is low * tio.c (tio_toggle_dtr): SunOS changes - manually enable RTS and DTR lines after hangup Fri Dec 17 17:50:55 1993 Gert Doering (gert@greenie) * policy.h: add comment about [11] [13] in sendfax log Wed Dec 15 10:20:01 1993 Gert Doering (gert@greenie) * logfile.c: SYSLOG -> logging to syslogd * policy.h: add SYSLOG + comments * mgetty.login: comments extended * login.c: stupid bug with "*a" and "a*" matching fixed * Makefile: link config.o, login.o * login.c: nasty bug in parsing of command line fixed * mgetty.c: call login( username ) instead of exec( "/bin/login"...) * mgetty.c: remove UGLY_TAYLOR_UUCP_HACK and FIDO * mgetty.h: add prototype for login() * policy.h: add LOGIN_CFG_FILE definition + comments Mon Dec 13 17:00:01 1993 Gert Doering (gert@greenie) * Makefile: LIBDIR=/usr/local/lib/mgetty+sendfax, install cour24i.pbm font * fax/faxspool: use new libdir path * logname.c (getlogname): ignore leading blanks (E.Crosser) Fri Dec 10 15:30:01 1993 Gert Doering (gert@greenie) * mgetty.texi: update BSD section, add text about /etc/ttytab * tio.c: move #include up before "tio.h" (for AIX) Mon Dec 6 12:46:57 1993 Gert Doering (gert@greenie) * faxrec.c: add include of Fri Dec 3 00:14:12 1993 Gert Doering (gert@greenie) * sendfax.c (main): setup signal handler to remove locks and close fax device on SIGINT / SIGQUIT (fax_close): add "+FCLASS=0" to reset modem to known state Wed Dec 1 20:07:05 1993 Gert Doering (gert@greenie) * faxrec.c (faxrec): add L_AUDIT with most important informations about received fax * mgetty.c (main): change login log message to level L_AUDIT remove "fax receiver finished" message * mgetty.h (L_AUDIT): added L_AUDIT * mgetty.c (main): remove #ifdef VOICE around check for ( action == A_VCON ) in ring_counter loop. Mon Nov 29 22:30:43 1993 Gert Doering (gert@greenie) * mgetty.c: added Klaus Weidner's VOICE conditionals * Makefile: added handling / installing of mgetty.login Fri Nov 26 22:19:41 1993 Gert Doering (gert@greenie) * mgetty.c (main): support for FIDO. If getlogname() returns a string starting with \377, a fido mailer is called. * logname.c (getlogname): support for FIDO handshake (TSYNC, YOOHOO and "**EMSI_IMQ" are recognized, **EMSI_REQ is sent). If a fido call comes in, the returned "login name" starts with \377. Thu Nov 25 19:05:55 1993 Gert Doering (gert@greenie) * mgetty.c (main): creeping featurism - added "-i /etc/issue" switch to mgetty * policy.h: added MAILER definition for _AIX * Makefile: change shar1 to include Archive-Name: header (Comments): don't use -DUSE_POLL on AIX * released mgetty+sendfax 0.16 (0.15 were beta versions) Wed Nov 24 12:38:36 1993 Gert Doering (gert@greenie) * do_chat.c: remove "volatile" in virtual_ring declaration Tue Nov 23 17:47:31 1993 Gert Doering (gert@greenie) * logname.c (ln_escape_prompt): add \L "Line" (device name) Sun Nov 21 18:03:42 1993 Gert Doering (gert@greenie) * mgetty.c (main): switch on carrier detection before printing /etc/issue (in case a caller hangs up immediately) Sat Nov 20 10:20:00 1993 Gert Doering (gert@greenie) * do_chat.c (do_chat()): if read() fails, return FAIL (hm) * mgetty.texi: updated documentation for SVR4 and SAS * mgetty.h: add #ifndef ___386BSD___ around getopt() prototype * faxrec.c (fax_get_pages()): set fax_hangup_code, if fax_get_page_data() fails. Sat Nov 13 11:42:10 1993 Gert Doering (gert@greenie) * contrib/faxin.c: make "char * tty" global and call it "* Device" - so faxrec() can use it for its file names. * faxrec.c (fax_notify_mail): change notification mail, make the output better understandable. Include reception time. (fax_get_page_data): change algorithm for creating file names - base on time() and Device id. * faxrec.c (fax_get_page_data): change DLE ETX logic (once again) * tio.c (set_flow_control): use "type", not "flag"... * do_chat.c (do_chat): DO_CHAT_SEND_DELAY - before sending "send" * policy.h: DO_CHAT_SEND_DELAY added * Makefile (noident): changed "if" to "case" (cl) Fri Nov 12 21:38:22 1993 Gert Doering (gert@greenie) * logfile.c (lprintf): use "errnr" instead of "errno" * tio.c (tio_set_flow_control): added _AIX style for enabling RTS/CTS flow control (c.l.) * tio.c (tio_set_flow_control): added SVR4 RTS/CTS flow control (m.h.), change interface. * mgetty.c,sendfax.c,faxrec.c: change call(s) to tio_set_flow_control() accordingly. * tio.h: added all the V* and C* defines for termio(s) * logname.c: added \N and \C escape. Remove surplus blank in TTYPROMPT. Removed all the C* defines (-> tio.h) Sun Nov 7 01:15:07 1993 Gert Doering (gert@greenie) * tio.h (FLOW_SOFT): changed definitions of FLOW_BOTH and FLOW_NONE * policy.h: introduced *_FLOW defines (plus longish comment) * changed calls to tio_set_flow_control() accordingly Sat Nov 6 00:03:30 1993 Gert Doering (gert@greenie) * logname.c (getlogname): #ifdef ENV_TTYPROMPT, do not read input line, but set buf to "" and return immediately (return NOERROR) * logname.c (set_env_var): created function * mgetty.c (main): shuffled around gettermio stuff - works now (main): if getlogname() returns empty string, don't pass it to /bin/login Fri Nov 5 20:23:26 1993 Gert Doering (gert@greenie) * tio.c: IUCLC and TAB3 are not available on BSD * tio.c: do not initialize c_line for POSIX systems * sendfax.c (main): new parameter, "-m", specify extra modem initialization string (modem has to answer "OK") * mgetty.h (and others): sig_t -> RETSIGTYPE (name clash on BSD) * faxrec.c (fax_notify_program): added setpgrp() / TIOCNOTTY for BSD Thu Nov 4 22:01:26 1993 Gert Doering (gert@greenie) * fax/faxq: created Wed Nov 3 19:22:40 1993 Gert Doering (gert@greenie) * mgetty.h (BSD): if __386BSD__ et.al., #define BSD * utmp.h: extend #ifdef sun to #if defined(sun) || defined(BSD) Mon Nov 1 14:03:08 1993 Gert Doering (gert@greenie) * faxrec.c (fax_get_pages): initialize *fax_file_names * faxrec.c (fax_notify_mail): check ( fax_file_names == NULL )? * mgetty.c (main): stripping of "/dev/" was bogus * mgetty.c / gettydefs.c: Chris Lewis' latest changes Fri Oct 29 10:53:25 1993 Gert Doering (gert@greenie) * policy.h: added comment about USE_GETTYDEFS Thu Oct 28 11:08:39 1993 Gert Doering (gert@greenie) * fax/faxspool: added - limited - access control * Makefile (install): backup faxspool / faxrunq Wed Oct 27 01:28:05 1993 Gert Doering (gert@greenie) * Makefile: invocate doc/Makefile for "install:" * doc: create man pages, create doc/Makefile * mgetty.c (main): move first call to gettermio() after opening the port * fax/faxspool: check first line of a file for PBM "magic" * mgetty.c (main): added missing "*" in pointer cast Wed Oct 27 01:19:07 1993 Chris Lewis (clewis@ferret.ocunix.on.ca) * mgetty.h, mgetty.c, gettydefs.c: re-worked gettydefs support * tio.c, tio.h: clean up "#elif" - do not work everywhere Tue Oct 26 22:09:52 1993 Gert Doering (gert@greenie) * tools/g3topbm.c (main): changed write: to do_write: (collision) * tools/g3cat.c (main): changed write: to do_write: (collision) * various changes for MEIBE machines (mostly #include in various modules, plus typedefs for uid_t and pid_t) * policy.h: add LOCK definition for sgi irix * io.c: added #ifdef for sgi machine Fri Oct 22 11:12:00 1993 Gert Doering (gert@greenie) * io.c: added #ifdef for MEIBE machine * logfile.c: added #ifdef for MEIBE and _SEQUENT_ machines Wed Oct 20 11:39:39 1993 Gert Doering (gert@greenie) * mgetty.c (main): ring counter * do_chat.c (do_chat): use external variable for "virtual rings", making it possible to pick up phone after a "real" RING * do_chat.c (do_chat): removed "locks" stuff * logfile.c (lprintf): increase line buffer size * faxrec.c: restrict length when logging "notify" command line Tue Oct 19 02:50:54 1993 Gert Doering (gert@greenie) * various: moved from direct termio manipulation to call of TIO routines Mon Oct 18 21:41:00 1993 Gert Doering (gert@greenie) * mgetty.texi (Queuing): added syntax of faxspool and aliases * fax/faxspool: added simple fax directory handling, if a phone number is non-numeric, it's searched in GLOBAL/PRIVATE_PHONE_DIR Fri Oct 15 11:25:28 1993 Doering (y0000075@rzab2) * tools/g3.c: removed print_g3_tree() * tools/g3topbm.c (main): use real page width for pbm file * Makefile: use "tar"+"gzip" instead of "gtar" * tio.c: add "set" flag to various set_*mode() calls * sendfax.c (main): split AT+FCLASS=2;+FLID=... into two commands * policy.h: MAIL_TO "faxadmin" * faxrec.c (fax_get_page): use six 'X's for template, not five Mon Oct 11 16:23:40 1993 Doering (y0000075@rznb15) * Makefile: changed invocation of sub-dir makefiles * tools/*.c: changed to use _P prototype macros * mgetty.texi (Linux): add note about mktemp() Thu Oct 7 02:33:59 1993 Gert Doering (gert@greenie) * faxrunq: quotes around $FAX_SENDER * sendfax.c (main): make fax_device_string[] static * mgetty.texi (ZyXEL): added note about broken 6.10 firmware Wed Oct 6 00:02:44 1993 Gert Doering (gert@greenie) * tools/g3cat, tools/g3topbm -> moved g3 tree stuff into g3.h / g3.h, changed g3cat to work not bit-wise but codeword-wise, thus eliminating the 0-bit problem * tools/g3cat.c (main): added "-a" switch * logname.c (getlog_timeout): void -> sig_t Tue Oct 5 15:32:13 1993 Gert Doering (gert@greenie) * faxlib.c (fax_command): delay(FAX_COMMAND_DELAY) before write() * policy.h: added FAX_COMMAND_DELAY + comment * faxrec.c (fax_notify_program): make I put the files up for anonymous ftp at ftp.pdc.kth.se in home/erikw/Public/sco. If you want to you can tell people to get it from there. My home directory is in AFS so it can also be reached in /afs/nada.kth.se/home/ass/erikw/Public. /Erik ------------------------------ From: Francois Vrana if you are still looking for a site to store your fax s/w i would be willing to do this. the site would be rcorco.rco.qc.ca (/pub) ------------------------------ mgetty-1.2.1/Makefile000066400000000000000000000605551334553713100145040ustar00rootroot00000000000000# Makefile for the mgetty fax package # # SCCS-ID: $Id: Makefile,v 4.83 2018/03/06 12:45:16 gert Exp $ (c) Gert Doering # # this is the C compiler to use (on SunOS, the standard "cc" does not # grok my code, so please use gcc there. On ISC 4.0, use "icc".). # # if you are cross-compiling, this is the C compiler for the target platform CC=cc #CC=gcc # # if you are cross-compiling, *this* needs to be the C compiler that # is able to produce binaries that run on the local system (if not # cross-compiling, just leave the line as is) HOSTCC=$(CC) # #### C Compiler Flags #### # # For SCO Unix 3.2v4, it may be necessary to define -D__STDC__=0 # If you have problems with dial-in / dial-out on the same line (e.g. # 'cu' telling you "CAN'T ACCESS DEVICE"), you should try -DBROKEN_SCO_324 # If the compiler barfs about my getopt() prototype, change it (mgetty.h) # If the linker cannot find "syslog()" (compiled with SYSLOG defined), # link "-lsocket". # # On SCO Unix 3.2.2, select(S) refuses to sleep less than a second, # so use poll(S) instead. Define -DUSE_POLL # # For Systems with a "login uid" (man setluid()), define -DSECUREWARE # (All SCO Systems have this). Maybe you've to link some special library # for it, on SCO it's "-lprot_s". # # # Add "-DSVR4" to compile on System V Release 4 unix # For SVR4.2, add "-DSVR4 -DSVR42" to the CFLAGS line. # # For Linux, you don't have to define anything # # For SunOS 4.x, please define -Dsunos4. # (We can't use "#ifdef sun" because that's defined on solaris as well) # If you use gcc, add -Wno-missing-prototypes, our code is OK, but # the Sun4 header files lack a lot standard definitions... # Be warned, Hardware handshake (and serial operations in general) # work a lot more reliably with patch 100513-05 (jumbo tty patch)! # # For Solaris 2.x, please define -Dsolaris2, which will automatically # #define SVR4. # # Add "-DISC" to compile on Interactive Unix. For posixized ISC 4.0 you # may have to add -D_POSIX_SOURCE # # For IBM AIX 4.x, no changes should be necessary. For AIX 3.x, it might # be necessary to add -D_ALL_SOURCE and -DUSE_POLL to the CFLAGS line. # [If you experience "strange" problems with AIX, report to me...!] # # Add "-D_3B1_ -DUSE_READ -D_NOSTDLIB_H -DSHORT_FILENAMES" to compile # on the AT&T 3b1 machine -g.t. # # Add "-DMEIBE" to compile on the Panasonic (Matsushita Electric # industry) BE workstation # # When compiling on HP/UX, make sure that the compiler defines _HPUX_SOURCE, # if it doesn't, add "-D_HPUX_SOURCE" to the CFLAGS line. # # On NeXTStep, add "-DNEXTSGTTY -DBSD". To compile vgetty or if you are # brave, you have to use "-posix -DBSD". # # On the MIPS RiscOS, add "-DMIPS -DSVR4 -systype svr4" (the other # subsystems are too broken. Watch out that *all* programs honour # the SVR4 locking convention, "standard" UUCP and CU do not!) # # For (otherwise not mentioned) systems with BSD utmp handling, define -DBSD # # Add "-D_NOSTDLIB_H" if you don't have # # Add "-DPOSIX_TERMIOS" to use POSIX termios.h, "-DSYSV_TERMIO" to use # the System 5 termio.h style. (Default set in tio.h) # # For machines without the select() call: # Add "-DUSE_POLL" if you don't have select, but do have poll # Add "-DUSE_READ" if you don't have select or poll (ugly) # # For older SVR systems (with a filename length restriction to 14 # characters), define -DSHORT_FILENAMES # # For Systems that default to non-interruptible system calls (symptom: # timeouts in do_chat() don't work reliably) but do have siginterrupt(), # define -DHAVE_SIGINTERRUPT. This is the default if BSD is defined. # # For Systems with broken termios / VMIN/VTIME mechanism (symptom: mgetty # hangs in "waiting for line to clear"), define -DBROKEN_VTIME. Notably # this hits FreeBSD 0.9 and some SVR4.2 users... # # If you don't have *both* GNU CC and GNU AS, remove "-pipe" # # Disk statistics: # # The following macros select one of 5 different variants of partition # information grabbing. AIX, Linux, 3b1 and SVR4 systems will figure # this out themselves. You can test whether you got this right by # running "make testdisk". If it fails, consult getdisk.c for # further instructions. # # BSDSTATFS - BSD/hp-ux/SunOS/Dynix/vrios # 2-parameter statfs() # ULTRIXSTATFS - Ultrix wacko statfs # SVR4 - SVR4 statvfs() # SVR3 - SVR3/88k/Apollo/SCO 4-parameter statfs() # USTAT - ustat(), no statfs etc. # #CFLAGS=-Wall -O2 -pipe -DSECUREWARE -DUSE_POLL CFLAGS=-Wall -O2 -pipe #CFLAGS=-O -DSVR4 #CFLAGS=-O -DSVR4 -DSVR42 #CFLAGS=-O -DUSE_POLL #CFLAGS=-Wall -g -O2 -pipe # 3B1: You can remove _NOSTDLIB_H and USE_READ if you have the # networking library and gcc. #CFLAGS=-D_3B1_ -D_NOSTDLIB_H -DUSE_READ -DSHORT_FILENAMES #CFLAGS=-std -DPOSIX_TERMIOS -O2 -D_BSD -DBSD # for OSF/1 (w/ /bin/cc) #CFLAGS=-DNEXTSGTTY -DBSD -O2 # for NeXT with sgtty (better!) #CFLAGS=-posix -DUSE_VARARGS -DBSD -O2 # for NeXT with POSIX #CFLAGS=-D_HPUX_SOURCE -Aa -DBSDSTATFS # for HP-UX 9.x #CFLAGS=-cckr -D__STDC__ -O -DUSE_READ # for IRIX 5.2 and up # # LDFLAGS specify flags to pass to the linker. You could specify # special link modes, binary formats, whatever... # # For the 3B1, add "-s -shlib". For other systems, nothing is needed. # # LIBS specify extra libraries to link to the programs # (do not specify the libraries in the LDFLAGS statement) # # To use the "setluid()" function on SCO, link "-lprot", and to use # the "syslog()" function, link "-lsocket". # # For SVR4(.2) and Solaris 2, you may need "-lsocket -lnsl" for syslog(). # # For ISC, add "-linet -lpt" (and -lcposix, if necessary) # # For Sequent Dynix/ptx, you have to add "-lsocket" # # For OSF/1, add "-lbsd". # # On SCO Xenix, add -ldir -lx # # For FreeBSD and NetBSD, add "-lutil" if the linker complains about # "utmp.o: unresolved symbol _login" # For Linux, add "-lutil" if the linker complains about "updwtmp". # LDFLAGS= #LIBS= #LIBS=-lprot -lsocket # SCO Unix #LIBS=-lsocket #LIBS=-lbsd # OSF/1 LIBS=-lutil # FreeBSD or Linux/GNU libc2 #LDFLAGS=-posix # NeXT with POSIX #LDFLAGS=-s -shlib # 3B1 # # # the following things are mainly used for ``make install'' # # # program to use for installing files # # "-o " sets the username that will own the binaries after installing. # "-g " sets the group # "-c" means "copy" (as opposed to "move") # # if your systems doesn't have one, use the shell script that I provide # in "inst.sh" (taken from X11R5). Needed on IRIX5.2 INSTALL=install -c -o bin -g bin #INSTALL=install -c -o root -g wheel # NeXT/BSD #INSTALL=/usr/ucb/install -c -o bin -g bin # AIX, Solaris 2.x #INSTALL=installbsd -c -o bin -g bin # OSF/1, AIX 4.1, 4.2 #INSTALL=/usr/bin/X11/bsdinst -c -o bin # IRIX # # prefix, where most (all?) of the stuff lives, usually /usr/local or /usr # prefix=/usr/local # # prefix for all the spool directories (usually /usr/spool or /var/spool) # spool=/var/spool # # where the mgetty + sendfax binaries live (used for "make install") # SBINDIR=$(prefix)/sbin # # where the user executable binaries live # BINDIR=$(prefix)/bin # # where the font+coverpage files go # LIBDIR=$(prefix)/lib/mgetty+sendfax # # where the configuration files (*.config, aliases, fax.allow/deny) go to # CONFDIR=$(prefix)/etc/mgetty+sendfax #CONFDIR=/etc/default/ # # # where mgetty PID files (mgetty.pid) go to # (the faxrunqd PID file lives in FAX_SPOOL_OUT/ due to permission reasons) # VARRUNDIR=/var/run # # the fax spool directory # FAX_SPOOL=$(spool)/fax FAX_SPOOL_IN=$(FAX_SPOOL)/incoming FAX_SPOOL_OUT=$(FAX_SPOOL)/outgoing # # the user that owns the "outgoing fax queue" (FAX_SPOOL_OUT) # this user must exist in the system, otherwise faxspool will not work! # # faxrunq and faxrunqd should run under this user ID, and nothing else. # This user needs access to the modems of course. # # (it's possible to run faxrunq(d) as root, but the FAX_OUT_USER # MUST NOT BE root or any other privileged account). # FAX_OUT_USER=fax # # # Where section 1 manual pages should be placed MAN1DIR=$(prefix)/man/man1 # # Where section 4 manual pages (mgettydefs.4) should be placed MAN4DIR=$(prefix)/man/man4 # # Section 5 man pages (faxqueue.5) MAN5DIR=$(prefix)/man/man5 # # Section 8 man pages (sendfax.8) MAN8DIR=$(prefix)/man/man8 # # Where the GNU Info-Files are located # INFODIR=$(prefix)/info # # # A shell that understands bourne-shell syntax # Usually this will be /bin/sh or /usr/bin/sh, but bash or ksh are fine. # (on some ultrix systems, you may need /bin/sh5 here) # SHELL=/bin/sh # # If your shell requires pre-posix syntax to disable traps ('trap 0' # instead of 'trap - 0'), set this to "0" (very rarely needed) # SHELL_TRAP_POSIX=1 # # If you have problems with the awk-programs in the fax/ shell scripts, # try using "nawk" or "gawk" (or whatever works...) here # needed on most SunOS/Solaris/ISC/NeXTStep versions. # AWK=awk # # A few (very few) programs want Perl, preferably Perl5. This define # tells them where to find it. You can use everything except "faxrunqd" # and the "tkperl" frontends without PERL, so don't worry if you don't # have it. # If you specify command line arguments (-w), don't forget the quotes! PERL="/usr/bin/perl -w" # # If you have Perl with TK extentions, define it here. This may be the # same as PERL=... above, or different, if you have TkPerl statically # linked. TKPERL=/usr/bin/tkperl # # # An echo program that understands escapes like "\n" for newline or # "\c" for "no-newline-at-end". On SunOS, this is /usr/5bin/echo, in the # bash, it's "echo -e" # (don't forget the quotes, otherwise compiling mksed will break!!) # # If you do not have *any* echo program at all that will understand "\c", # please use the "mg.echo" program provided in the compat/ subdirectory. # Set ECHO="mg.echo" and INSTALL_MECHO to mg.echo # ECHO="echo -e" # # INSTALL_MECHO=mg.echo # # for mgetty, that's it. If you want to use the voice # extentions, go ahead (don't forget to read the manual!) # To maintain security, I recommend creating a new group for # users who are allowed to manipulate the recorded voice messages. PHONE_GROUP=phone PHONE_PERMS=770 # Add -DNO_STRSTR to CFLAGS if you don't have strstr(). # create hard/soft links (-s will be added by vgetty Makefile) LN=ln #LN=/usr/5bin/ln RM=rm MV=mv # # Nothing to change below this line ---------------------------------! # MR=1.2 SR=1 DIFFR=1.2.0 # # OBJS=mgetty.o logfile.o do_chat.o locks.o utmp.o logname.o login.o \ mg_m_init.o modem.o faxrec.o ring.o \ faxlib.o faxsend.o faxrecp.o class1.o class1lib.o faxhng.o hyla_nsf.o \ g3file.o io.o gettydefs.o tio.o cnd.o getdisk.o goodies.o \ config.o conf_mg.o do_stat.o sms.o clean_line.o SFAXOBJ=sendfax.o logfile.o locks.o modem.o \ faxlib.o faxsend.o faxrecp.o class1.o class1lib.o faxhng.o hyla_nsf.o \ g3file.o io.o tio.o getdisk.o config.o conf_sf.o goodies.o socket.o \ clean_line.o all: bin-all doc-man-only bin-all: mgetty sendfax newslock sedscript subdirs call-back # a few C files need extra compiler arguments mgetty.o : mgetty.c syslibs.h mgetty.h ugly.h policy.h tio.h fax_lib.h \ config.h mg_utmp.h Makefile $(CC) $(CFLAGS) -DVARRUNDIR=\"$(VARRUNDIR)\" -c mgetty.c conf_mg.o : conf_mg.c mgetty.h ugly.h policy.h syslibs.h \ config.h conf_mg.h Makefile $(CC) $(CFLAGS) -DFAX_SPOOL_IN=\"$(FAX_SPOOL_IN)\" \ -DCONFDIR=\"$(CONFDIR)\" -c conf_mg.c conf_sf.o : conf_sf.c mgetty.h ugly.h policy.h syslibs.h \ config.h conf_sf.h Makefile $(CC) $(CFLAGS) -DCONFDIR=\"$(CONFDIR)\" -c conf_sf.c login.o : login.c mgetty.h ugly.h config.h policy.h mg_utmp.h Makefile $(CC) $(CFLAGS) -DCONFDIR=\"$(CONFDIR)\" -c login.c cnd.o : cnd.c syslibs.h policy.h mgetty.h ugly.h config.h Makefile $(CC) $(CFLAGS) -DCONFDIR=\"$(CONFDIR)\" -c cnd.c logname.o : logname.c syslibs.h mgetty.h policy.h tio.h mg_utmp.h Makefile mgetty-launchd.o: mgetty-launchd.c $(CC) $(CFLAGS) -DSBINDIR=\"$(SBINDIR)\" -c mgetty-launchd.c # here are the binaries... mgetty: $(OBJS) $(CC) -o mgetty $(OBJS) $(LDFLAGS) $(LIBS) sendfax: $(SFAXOBJ) $(CC) -o sendfax $(SFAXOBJ) $(LDFLAGS) $(LIBS) mgetty-launchd: mgetty-launchd.o io.o utmp.o logfile.o $(CC) -o mgetty-launchd mgetty-launchd.o io.o utmp.o logfile.o # subdirectories... subdirs: cd g3 && $(MAKE) "CC=$(CC)" "CFLAGS=$(CFLAGS) -I.." "LDFLAGS=$(LDFLAGS)" "LIBS=$(LIBS)" all cd tools && $(MAKE) "CC=$(CC)" "CFLAGS=$(CFLAGS) -I.." "LDFLAGS=$(LDFLAGS)" "LIBS=$(LIBS)" all cd fax && $(MAKE) "CC=$(CC)" "CFLAGS=$(CFLAGS) -I.." "LDFLAGS=$(LDFLAGS)" "LIBS=$(LIBS)" "FAX_SPOOL_OUT=$(FAX_SPOOL_OUT)" "FAX_OUT_USER=$(FAX_OUT_USER)" "CONFDIR=$(CONFDIR)" all call-back: @$(MAKE) mgetty cd callback && $(MAKE) "CC=$(CC)" "CFLAGS=$(CFLAGS) -I.." "LDFLAGS=$(LDFLAGS)" "CONFDIR=$(CONFDIR)" "VARRUNDIR=$(VARRUNDIR)" "LIBS=$(LIBS)" all contrib-all: cd contrib ; $(MAKE) "CC=$(CC)" "CFLAGS=$(CFLAGS) -I.." "LDFLAGS=$(LDFLAGS)" "LIBS=$(LIBS)" all doc-all: cd doc ; $(MAKE) "CC=$(CC)" "CFLAGS=$(CFLAGS) -I.." "LDFLAGS=$(LDFLAGS)" "LIBS=$(LIBS)" doc-all doc-man-only: cd doc ; $(MAKE) "CC=$(CC)" "CFLAGS=$(CFLAGS) -I.." "LDFLAGS=$(LDFLAGS)" "LIBS=$(LIBS)" all # things... getdisk: getdisk.c $(CC) $(CFLAGS) -DTESTDISK getdisk.c -o getdisk testdisk: getdisk ./getdisk / . # README PROBLEMS DISTRIB=README.1st THANKS TODO BUGS FTP COPYING Recommend \ inittab.aix inst.sh version.h \ Makefile ChangeLog policy.h-dist ftp.sh mkidirs \ login.cfg.in mgetty.cfg.in sendfax.cfg.in \ dialin.config faxrunq.config \ mgetty.c mgetty.h ugly.h do_chat.c logfile.c logname.c locks.c \ mg_m_init.c modem.c ring.c \ class1.h class1.c class1lib.c hyla_nsf.c \ faxrec.c faxrecp.c faxsend.c faxlib.c fax_lib.h sendfax.c \ g3file.c \ io.c tio.c tio.h gettydefs.c login.c do_stat.c faxhng.c \ config.h config.c conf_sf.h conf_sf.c conf_mg.h conf_mg.c \ cnd.c getdisk.c mksed.c utmp.c mg_utmp.h syslibs.h goodies.c \ sms.c socket.c clean_line.c noident: policy.h for file in `find . -type f -name "*.[ch]" -print` ; do \ echo "$$file..."; \ case $$file in \ *.c) \ mv -f $$file tmp-noident; \ sed -e "s/^#ident\(.*\)$$/static char sccsid[] =\1;/" $$file; \ ;; \ *.h) \ mv -f $$file tmp-noident; \ f=`basename $$file .h`; \ sed -e "s/^#ident\(.*\)$$/static char sccs_$$f[] =\1;/" $$file; \ ;; \ esac; \ done $(MAKE) "CC=$(CC)" "CFLAGS=$(CFLAGS)" all sedscript: mksed ./mksed >sedscript chmod +x sedscript mksed: mksed.c policy.h Makefile $(HOSTCC) $(CFLAGS) -DBINDIR=\"$(BINDIR)\" -DSBINDIR=\"$(SBINDIR)\" \ -DLIBDIR=\"$(LIBDIR)\" \ -DCONFDIR=\"$(CONFDIR)\" \ -DFAX_SPOOL=\"$(FAX_SPOOL)\" \ -DFAX_SPOOL_IN=\"$(FAX_SPOOL_IN)\" \ -DFAX_SPOOL_OUT=\"$(FAX_SPOOL_OUT)\" \ -DFAX_OUT_USER=\"$(FAX_OUT_USER)\" \ -DVARRUNDIR=\"$(VARRUNDIR)\" \ -DAWK=\"$(AWK)\" \ -DPERL=\"$(PERL)\" -DTKPERL=\"$(TKPERL)\" \ -DECHO=\"$(ECHO)\" \ -DSHELL=\"$(SHELL)\" \ -DSHELL_TRAP_POSIX=$(SHELL_TRAP_POSIX) \ -o mksed mksed.c policy.h-dist: policy.h @rm -f policy.h-dist cp policy.h policy.h-dist @chmod u+w policy.h-dist version.h: $(DISTRIB) rm -f version.h if expr "$(MR)" : "[0-9].[13579]" >/dev/null ; then \ date=`date "+%Y%b%d"` ;\ echo "#define VERSION_LONG \"interim release $(MR).$(SR)-$$date\";" >version.h ;\ else \ echo "#define VERSION_LONG \"stable release $(MR).$(SR)\";" >version.h ;\ fi echo "#define VERSION_SHORT \"$(MR).$(SR)\"" >>version.h echo "extern char * mgetty_version;" >>version.h chmod 444 version.h mgetty-$(MR).$(SR).tar.gz: $(DISTRIB) rm -f mgetty-$(MR).$(SR) ln -sf . mgetty-$(MR).$(SR) find . -name core -print | xargs rm -f cd voice ; $(MAKE) clean ( echo "$(DISTRIB)" | tr " " "\\012" ; \ for i in `find . -name .files -print | sed -e 's;^./;;'` ; do \ cat $$i | sed -e '/^\.files/d' -e 's;^;'`dirname $$i`'/;' ; \ done ; \ find voice -type f -print | grep -v CVS ; \ ) \ | sed -e 's;^;mgetty-$(MR).$(SR)/;g' \ | gtar cvvfT mgetty-$(MR).$(SR).tar - gzip -f -9 -v mgetty-$(MR).$(SR).tar tar: mgetty-$(MR).$(SR).tar.gz diff: mgetty-$(DIFFR)-$(MR).$(SR).diff.gz sign: tar gpg -sab mgetty-$(MR).$(SR).tar.gz chmod +r mgetty-$(MR).$(SR).tar.gz.asc mgetty-$(DIFFR)-$(MR).$(SR).diff.gz: \ mgetty-$(DIFFR).tar.gz mgetty-$(MR).$(SR).tar.gz -rm -rf /tmp/mgd mkdir /tmp/mgd gtar xvCfz /tmp/mgd mgetty-$(DIFFR).tar.gz gtar xvCfz /tmp/mgd mgetty-$(MR).$(SR).tar.gz ( cd /tmp/mgd ; \ diff -u3 --ignore-space-change --recursive --new-file -I "^#ident" \ mgetty-$(DIFFR) mgetty-$(MR).$(SR) ; \ exit 0 ) >mgetty-$(DIFFR)-$(MR).$(SR).diff rm -rf /tmp/mgd gzip -f -9 -v mgetty-$(DIFFR)-$(MR).$(SR).diff mg.uue: mgetty-$(MR).$(SR).tar.gz uuencode mgetty-$(MR).$(SR).tar.gz mg.uue uu: mg.uue uu2: mg.uue split -3600 mg.uue mg.uu. # this is for automatic uploading to the beta site. # DO NOT USE IT if you're not ME! Please! # beta: tar diff sign test `hostname -s` = chekov || exit 1 # local cp mgetty-$(MR).$(SR).tar.gz /pub/mgetty-archive/ cp mgetty-$(DIFFR)-$(MR).$(SR).diff.gz /pub/mgetty-archive/ -cvs commit -m 'new version released' version.h # master ftp/www site ./ftp.sh $(MR).$(SR) delta2.greenie.net \ '/home/ftp/pub/mgetty/source/$(MR)' ./beta $(MR) $(SR) $(DIFFR) delta2.greenie.net \ '/home/httpd/mgetty.greenie.net/doc' #shar1: $(DISTRIB) # shar -M -c -l 40 -n mgetty+sendfax-$(MR).$(SR) -a -o mgetty.sh $(DISTRIB) # #shar: $(DISTRIB) # shar -M $(DISTRIB) >mgetty$(MR).$(SR).sh doc-tar: cd doc ; $(MAKE) "VS=$(MR).$(SR)" doc-tar policy.h: @echo @echo "You have to create your local policy.h first." @echo "Copy policy.h-dist and edit it." @echo @exit 1 clean: rm -f *.o compat/*.o mgetty sendfax rm -f testgetty getdisk mksed sedscript newslock *~ rm -f sendfax.config mgetty.config login.config cd g3 && $(MAKE) clean cd fax && $(MAKE) clean cd tools && $(MAKE) clean cd callback && $(MAKE) clean cd contrib && $(MAKE) clean cd doc && $(MAKE) clean cd voice && $(MAKE) clean cd t && $(MAKE) clean fullclean: clean distclean: clean login.config: login.cfg.in sedscript ./sedscript login.config mgetty.config: mgetty.cfg.in sedscript ./sedscript mgetty.config sendfax.config: sendfax.cfg.in sedscript ./sedscript sendfax.config newslock: compat/newslock.c $(CC) $(CFLAGS) -o newslock compat/newslock.c # internal: use this to create a "clean" mgetty+sendfax tree bindist: all doc-all sedscript -rm -rf bindist ./mkidirs bindist$(prefix) bindist$(spool) bd=`pwd`/bindist; PATH=`pwd`:"$$PATH" $(MAKE) prefix=$$bd$(prefix) \ BINDIR=$$bd$(BINDIR) SBINDIR=$$bd$(SBINDIR) \ LIBDIR=$$bd$(LIBDIR) CONFDIR=$$bd$(CONFDIR) \ spool=$$bd$(spool) FAX_SPOOL=$$bd$(FAX_SPOOL) \ FAX_SPOOL_IN=$$bd$(FAX_SPOOL_IN) \ FAX_SPOOL_OUT=$$bd$(FAX_SPOOL_OUT) \ MAN1DIR=$$bd$(MAN1DIR) MAN4DIR=$$bd$(MAN4DIR) \ MAN5DIR=$$bd$(MAN5DIR) MAN8DIR=$$bd$(MAN8DIR) \ INFODIR=$$bd$(INFODIR) install cd bindist; gtar cvvfz mgetty$(MR).$(SR)-bin.tgz * install: install.bin install.doc install.bin: mgetty sendfax newslock \ login.config mgetty.config sendfax.config # # binaries # -test -d $(BINDIR) || ( ./mkidirs $(BINDIR) ; chmod 755 $(BINDIR) ) $(INSTALL) -m 755 newslock $(BINDIR) -test -d $(SBINDIR) || ( ./mkidirs $(SBINDIR) ; chmod 755 $(SBINDIR) ) if [ -f $(SBINDIR)/mgetty ] ; then \ mv -f $(SBINDIR)/mgetty $(SBINDIR)/mgetty.old ; fi if [ -f $(SBINDIR)/sendfax ] ; then \ mv -f $(SBINDIR)/sendfax $(SBINDIR)/sendfax.old ; fi $(INSTALL) -s -m 700 mgetty $(SBINDIR) $(INSTALL) -s -m 755 sendfax $(SBINDIR) # # data files + directories # test -d $(LIBDIR) || \ ( ./mkidirs $(LIBDIR) && chmod 755 $(LIBDIR) ) test -d $(CONFDIR) || \ ( ./mkidirs $(CONFDIR) && chmod 755 $(CONFDIR)) test -f $(CONFDIR)/login.config || \ $(INSTALL) -o root -m 600 login.config $(CONFDIR)/ test -f $(CONFDIR)/mgetty.config || \ $(INSTALL) -o root -m 600 mgetty.config $(CONFDIR)/ test -f $(CONFDIR)/sendfax.config || \ $(INSTALL) -o root -m 644 sendfax.config $(CONFDIR)/ test -f $(CONFDIR)/dialin.config || \ $(INSTALL) -o root -m 600 dialin.config $(CONFDIR)/ test -f $(CONFDIR)/faxrunq.config || \ $(INSTALL) -o root -m 644 faxrunq.config $(CONFDIR)/ # # test for outdated stuff # -@if test -f $(LIBDIR)/mgetty.login ; \ then \ echo "WARNING: the format of $(LIBDIR)/mgetty.login has " ;\ echo "been changed. Because of this, to avoid confusions, it's called " ;\ echo "$(CONFDIR)/login.config now." ;\ echo "" ;\ fi # # fax spool directories # test -d $(spool) || \ ( mkdir $(spool) && chmod 755 $(spool) ) test -d $(FAX_SPOOL) || \ ( mkdir $(FAX_SPOOL) && \ chown $(FAX_OUT_USER) $(FAX_SPOOL) && \ chmod 755 $(FAX_SPOOL) ) test -d $(FAX_SPOOL_IN) || \ ( mkdir $(FAX_SPOOL_IN) && chmod 755 $(FAX_SPOOL_IN) ) test -d $(FAX_SPOOL_OUT) || \ mkdir $(FAX_SPOOL_OUT) chown $(FAX_OUT_USER) $(FAX_SPOOL_OUT) chmod 755 $(FAX_SPOOL_OUT) # # g3 tool programs # cd g3 && $(MAKE) install INSTALL="$(INSTALL)" \ BINDIR=$(BINDIR) \ LIBDIR=$(LIBDIR) CONFDIR=$(CONFDIR) # # fax programs / scripts / font file # cd fax && $(MAKE) install INSTALL="$(INSTALL)" \ FAX_OUT_USER=$(FAX_OUT_USER) \ BINDIR=$(BINDIR) SBINDIR=$(SBINDIR) \ LIBDIR=$(LIBDIR) CONFDIR=$(CONFDIR) # # compatibility # if [ ! -z "$(INSTALL_MECHO)" ] ; then \ cd compat ; \ $(CC) $(CFLAGS) -o mg.echo mg.echo.c && \ $(INSTALL) -s -m 755 mg.echo $(BINDIR) ; \ fi # # documentation # install.doc: cd doc ; $(MAKE) install INSTALL="$(INSTALL)" \ MAN1DIR=$(MAN1DIR) \ MAN4DIR=$(MAN4DIR) \ MAN5DIR=$(MAN5DIR) \ MAN8DIR=$(MAN8DIR) \ INFODIR=$(INFODIR) # # WWW frontend stuff # install.www: cd frontends/www ; $(MAKE) install.www INSTALL="$(INSTALL)" \ BINDIR=$(BINDIR) \ LIBDIR=$(LIBDIR) CONFDIR=$(CONFDIR) # # voice extensions, consult the `voice' chapter in the documentation # vgetty: @$(MAKE) mgetty cd voice; $(MAKE) CFLAGS="$(CFLAGS)" CC="$(CC)" LDFLAGS="$(LDFLAGS)" \ LN="$(LN)" MV="$(MV)" RM="$(RM)" \ LIBS="$(LIBS)" \ FAX_SPOOL_IN="$(FAX_SPOOL_IN)" CONFDIR="$(CONFDIR)" \ VARRUNDIR="$(VARRUNDIR)" \ SHELL="$(SHELL)" vgetty-all vgetty-install: sedscript cd voice; $(MAKE) CFLAGS="$(CFLAGS)" CC="$(CC)" LDFLAGS="$(LDFLAGS)" \ BINDIR="$(BINDIR)" SBINDIR="$(SBINDIR)" LIBDIR="$(LIBDIR)" \ CONFDIR="$(CONFDIR)" MAN1DIR="$(MAN1DIR)" MAN8DIR="$(MAN8DIR)" INSTALL="$(INSTALL)" \ PHONE_GROUP="$(PHONE_GROUP)" PHONE_PERMS="$(PHONE_PERMS)" \ LN="$(LN)" MV="$(MV)" RM="$(RM)" \ LIBS="$(LIBS)" vgetty-install install-vgetty: vgetty-install ## test suite test: bin-all for D in g3 t ; do \ ( cd $$D ; $(MAKE) CFLAGS="$(CFLAGS) -I.." test ); \ done check: test ## misc dump: logfile.o config.o conf_mg.o goodies.o getdisk.o tio.o gettydefs.o io.o $(CC) -o dump -g dump.c logfile.o config.o conf_mg.o goodies.o getdisk.o tio.o gettydefs.o io.o $(LDFLAGS) ######## anything below this line was generated by gcc -MM *.c cnd.o : cnd.c syslibs.h policy.h mgetty.h ugly.h config.h conf_mg.o : conf_mg.c mgetty.h ugly.h policy.h syslibs.h tio.h config.h conf_mg.h conf_sf.o : conf_sf.c mgetty.h ugly.h policy.h syslibs.h config.h conf_sf.h config.o : config.c syslibs.h mgetty.h ugly.h config.h do_chat.o : do_chat.c syslibs.h mgetty.h ugly.h policy.h tio.h ring.o: ring.c syslibs.h mgetty.h ugly.h policy.h tio.h do_stat.o : do_stat.c syslibs.h mgetty.h ugly.h policy.h tio.h dump.o : dump.c syslibs.h mgetty.h ugly.h policy.h tio.h fax_lib.h mg_utmp.h \ config.h conf_mg.h faxhng.o : faxhng.c mgetty.h ugly.h faxlib.o : faxlib.c mgetty.h ugly.h policy.h fax_lib.h faxrec.o : faxrec.c syslibs.h mgetty.h ugly.h tio.h policy.h fax_lib.h faxsend.o : faxsend.c syslibs.h mgetty.h ugly.h tio.h policy.h fax_lib.h files.o : files.c mgetty.h ugly.h policy.h getdisk.o : getdisk.c policy.h mgetty.h ugly.h gettydefs.o : gettydefs.c syslibs.h mgetty.h ugly.h policy.h goodies.o : goodies.c syslibs.h mgetty.h ugly.h config.h io.o : io.c syslibs.h mgetty.h ugly.h locks.o : locks.c mgetty.h ugly.h policy.h logfile.o : logfile.c mgetty.h ugly.h policy.h login.o : login.c mgetty.h ugly.h config.h policy.h mg_utmp.h logname.o : logname.c syslibs.h mgetty.h ugly.h policy.h tio.h mg_utmp.h mg_m_init.o : mg_m_init.c syslibs.h mgetty.h ugly.h tio.h policy.h fax_lib.h mgetty.o : mgetty.c syslibs.h mgetty.h ugly.h policy.h tio.h fax_lib.h mg_utmp.h \ config.h conf_mg.h sendfax.o : sendfax.c syslibs.h mgetty.h ugly.h tio.h policy.h fax_lib.h config.h \ conf_sf.h tio.o : tio.c mgetty.h ugly.h tio.h utmp.o : utmp.c mgetty.h ugly.h mg_utmp.h class1.o: class1.c mgetty.h ugly.h fax_lib.h tio.h class1.h class1lib.o: class1lib.c mgetty.h ugly.h fax_lib.h tio.h class1.h hyla_nsf.o: hyla_nsf.c mgetty.h ugly.h policy.h mgetty-1.2.1/README.1st000066400000000000000000000073011334553713100144200ustar00rootroot00000000000000Hi, this is the mgetty+sendfax distribution. It contains programs to send and receive faxes in a unix environment using a class 2 faxmodem. For detailed informations how everything works and how to build and use it, see the file "mgetty.texi" (in doc/, see below) If you can access the WWW, you might try looking at http://alpha.greenie.net/mgetty/index.html, or http://www.leo.org/~doering/mgetty/index.html. You'll find all the documentation and the FAQ nicely formatted there. For voice stuff, look into voice/doc/readme.Beginners. Brief installation instructions can be found below. My license policy boils down to this: -------------------------------------------------------------------------- Mgetty+Sendfax was written by Gert Doering, with many contributions from the Internet. Vgetty was written by Klaus Weidner, Marc Eberhard, Marc Schaefer and also many contributions from the Internet community. The whole package, starting with version 1.1.22, is distributed under the GNU GPL license, found in the accompanying file 'COPYING'. If you want to redistribute mgetty under a different license (like in "selling it to your customers"), contact me, and we will work something out. -------------------------------------------------------------------------- To make the programs, copy "policy.h-dist" to "policy.h", edit it according to your needs. The defaults are reasonable, though. Then edit "Makefile" to set CC=, CCFLAGS=, INSTALL= and the various xxxDIR= (LIB/MAN/BIN/SBINDIR/CONFDIR) to fit your system. After that, running "make" should do. "Make" will also create the "mgetty.texi"-File in "doc/" if you have the "texinfo" package installed. If the user name that you have specified as FAX_OUT_USER=... in the Makefile ("fax" or similar) does not exist in your system, you have to create it now. Don't forget to set a good password. If you want to run faxrun or faxrunqd under this user ID (which is recommended), it must have access to your modem devices (/dev/tty...). Most of the options set in "policy.h" can be changed at run-time from the "mgetty.config" configuration file. CONFDIR= (in Makefile) plus the file name specified in policy.h controls where that will be. With C-Compilers that do not understand the "#ident" directive, give the "make noident" command before using the "make" command for the first time. Run "make testdisk" to see if the disk statistics grabber works (it should report the correct block free count for the partitions containing "/" and ".". If not, consult getdisk.c, taking special note of the "v*" defines for hints as to which settings you use. If your system is one of the "v*", try defining that "v*" macro in the Makefile CCFLAGS. Please let us know what works, and what your C compiler uses to identify your computer. Run "make test" to run some test scripts - this will mainly check the G3 tools and some shell functions. It can't test "all" of the package yet. Finally, "make install". If you have any problems, suggestions or bug reports, please contact gert@greenie.muc.de or gert@space.net (greenie preferred!) - but make sure you have read the documentation first! I get quite annoyed when I have to answer the same questions for the 99th time! Read "BUGS"! Generic questions ("it doesn't work") should go to the mgetty mailing list (mgetty@muc.de), because I just don't have time to explain it all again and again. (Un-)Subscription is done via mgetty-request@muc.de. And... please do not forget that I'm doing this kind of support entirely in my spare time - sometimes my answers will be very short, or it may take a long time for me to answer - since sometimes I need my time to make a living... Now... have fun & fax! gert mgetty-1.2.1/Recommend000066400000000000000000000015751334553713100146750ustar00rootroot00000000000000MODEM Recommendations for use with mgetty/vgetty ------------------------------------------------ What modem to recommend depends on your needs. There are very few modems that handle fax + data + voice perfectly, but quite a number that are well suited for two of the categories, and less good (or sometimes not at all) for the third. For Fax+Data: * USR Courier V.34/X.2 (no voice) For FAX+Voice: * ZyXEL 1496 (data only up to 19200, but best fax implementation) For Data+Voice: * USR Sportster VI series (fax implementation is VERY bad) For FAX+DATA+Voice * ZyXEL 2864 * MultiTech MT2834ZDXv [watch out - recent firmware versions are weird, I have been told that 0316D firmware is OK, but make sure that you can return the modem if it doesn't work] * ELSA MicroLink TQV/Office series (fax is not perfect, but works ok) Last updated: March 1999 mgetty-1.2.1/THANKS000066400000000000000000000027231334553713100137500ustar00rootroot00000000000000Many thanks to: Peter Bechtold, peter@fns.greenie.muc.de, for sending me dozens of faxes to test mgetty, for calling me back numerous times after failed attempts to send him a fax with sendfax, ... Klaus Weidner, klaus@greenie.muc.de, for the original linux port, and for testing dozens of pre-releases Lawrence 'dreamer' Chen, lawrence@combdyn.com, for the initial ISC port, and for testing the package with a SupraFAX-Modem. Kay, kschulz@gold.t-informatik.ba-stuttgart.de, for testing on ISC - and telling me that it's possible to ask dozens of questions without having ever read the README file... Georg Edelmann, georg@alpha.saar.de, for testing on Linux, and finding some stupid bugs Uwe S. Obst, sysop@ganymed.phiger.com, for testing on SCO 3.2.4 and finding the only working way to set the hardware flow control flags (Other combinations seem to always prevent parallel dial-outs) Bodo Bauer, bodo@hal.nbg.sub.org, for porting mgetty to SVR4 (though he did quite confuse me by insisting that the fax receiver does not work...) Christoph Adomeit, for bugging me long enough to implement XON / XOFF flow control in fax sending / receiving, and buffered reads in fax receiving; and for borrowing me one of his GVC modems long enough to make faxing work with it. Christopher M. Ward, for testing on SCO with another GVC modem. ... and to all others who tested release after release. (The list here is incomplete, a more complete list can be found in mgetty.texi) mgetty-1.2.1/TODO000066400000000000000000000417131334553713100135270ustar00rootroot000000000000001) make sendfax recognize "-h " option to set page headers started 20.3.93, GD new idea: send "AT+FDT", then (optional) page header, then page data. (does not work) new idea: customized pbmtog3, without EOP. "first cut" done, 21.9.93, use "g3cat" Suggestion: use "-h ", g3cat output of that program with the data page (-> headers with real send time) see 119 2) make external configuration possible mostly done (1.1.95) 3) #include bad idea, not really useful 6) faxmail - gatway program for mail -> fax (started) 7) when (before) receiving a fax, check if there's enough space left (amount configurably) -> clewis generic "get spool file name", check multiple directories (multiple dirs done, code is ugly, clean up) 8) function for creating spool file names (->dir, prefix; <- name, fd) with (optional) sequence numbers 14) make mgetty (and g3cat) add an digifax header to incoming faxes (optionally). 16) tiffg3 -> raw g3 / digifax converter 17) library functions for opening / reading g3 files 18) Makefile. / AutoConf? 20) tio - increase abstraction layer even more, make TIO an opaque pointer, so that the upper layers do not have to know *anything* about the data structure used by tio.c/.h (with old/new settings, to avoid surplus system calls) 21) additional flag: skip modem initialization and all, go directly to reading of login name (for callback) (would also help Hylafax) 24) fax_notify_mail: include "realname" (from fax phone book) in Subject: 31) VSI*FAX 34) ungetty mechanism 35) utmp writing / process arguments on SunOS 45) make fax poll server more flexible 51) faxspool.c (sgid fax) -> $LIBDIR/faxspool.sh -> on TODO since at least June 1994 -> 18.11.2002: *done* via "faxq-helper" 51a) have it start faxrunq immediately (configurably) 55) vhangup()? (->Linux) (security issues) 57) SIGUSR1 *after* answering -> hangup 59) mgetty/faxrec(): valiate incoming fax data, request retransmission partially done, if +FP(T)S:... returns valid values. 60) faxspool - multiple targets in one fax call: faxspool tgt file(s) faxspool -m tgt1 tgt2 tgt3 -- file(s) faxspool -M tgt-file file(s) 62) session parameter mismatch (width / length / resolution) -> correct "on-the-fly" (integrate "smart" g3cat into sendfax.c). If the page is too long, cut after 2050 (letter) or 2156 (A4) lines. 63) ZyXEL callback (description, "hack" in mgetty.c - ZYXEL_CALLBACK) (integrate in state machine) 63b) real callback 66) faxcleanup 73) locks.c: only "guess" that it's a binary lock if it doesn't consist entirely of " 0-9\n". 75) dialcode translations in faxspool 90) support ct 91) g3split 96) number of RINGs changeable without /etc/inittab change (done). Changeable without restart? 97) BREAK -> mgetty exits (does it?) 98) fax_wait_for: accept " +FHNG:..." 107) create own fax file header, with sender ID (if known), resolution, and *magic byte*! 108) faxreq (re-queue, remove Status junk from JOB) done with "faxq -r" - really delete "Status" lines? 112) sendfax: return +FHNG in exit() code 114) callback: other lines (if available), random delay 116) use more detailed access privileges in faxspool (long distance, local) 118) modem auto-detect not only for voice but for modem type (e.g. MultiTech, ZyXEL, ...) in general 12.12.97: basic work done 119) dynamically generate page headers in faxrunq 12.12.97: integrate with class 1 work - we have to "g3cat" the page data anyway (for padding) 120) with 119, multicasting is easy 121) check disk space before spooling faxes 123) -DNO_MODEM? 124) if write/read in fax_send_page() fails, exit loop (kkeyte) 125) cleanup script that will rollover logs 126) if sendfax is killed, faxrunq assumes "ok" for some strange reason. (caused by the way exec() / wait() handle return code / signals) 10.12.97: resolved for faxrunqd. Still open for faxrunq??? 127) step-by-step installation guide 128) g3topbm: use same decoder as g3view (speed/space tradeoff?) 129) g3topbm: speed up decoding by reading the file as a whole 135) for modems where AT+FAA=1 doesn't work: use SIGUSR2 to toggle fax/data (for people knowing what type of call comes in) 136) keep modem in data mode, switch to fax mode (+FAA=1 or 0, depending on -D/-F) if desired before sending ATA. Reason: dialout processes can safely assume "+FCLASS=0" with this setup. 136a) add signal to switch reception mode for dumb no-adaptive-answering modems, see 135) 137) call "new_fax" program for each page during reception (for those people that have a fast machine and a slow printer and want to see the results immediately. Hi Harald!) 139) RING during initialization -> wait for it to stop, init modem again 141) make lock/log/spool paths configurable 144) if first line in logfile is written *after* setuid() in login.c, no opening of LOG_PATH is possible. open log sooner? mode 666? 145) include Device/Hostname in "notify mail" [Device done. Do we really want the hostname?] 79) g3cat: fix line width (that is, "repair" broken T.4 files on-the-fly) 147) make "g3cat" fix line width! (done, but doesn't seem to work for all receivers) 151) SCHED option? 152) get bit order for class 2 / class 2 ok / 2.0 for receiving and polling right 153) testing: add some signal that will cause a fax reception to "fail" (RTN) 154) add some way to change runtime configuration 155) fax receiver: ignore signals (USR1, USR2) more completely, only barf about "interrupted system call" if SIGARLM 156) if login name contains spaces, split into several arguments (*optionally*). Use : "login username ENV1=foo ENV2=bar". 157) add a "what to try if modem init fails" routine (try 19200 bps, try sending to get modem back from voice mode, ...) (Julian Assange, proff@suburbia.net; ard@cstmel.hobby.nl) 09.07.96: done, +++ATH moved to that part as well. Baud rate switching still open. 160) make "dialin.config" path configurable (and all other paths except "login.config" as well). [not sure whether I want this] 161) make path to "mgetty.config" configurable via command line switch 163) SIGUSR2: harden all "byte-receive" functions against EINTR 168) accept error messages while sending a page 169) "faxspool -t" must be smarter: "send at 2:00 tonight" isn't possible now 170) make "waiting for lock file to disappear" smarter: wait for *PID* to disappear *or* mtime change [->no need to read() the file every time if mtime didn't change and PID still exists] (-f =remco) 171) callback: password! 174) on Dr.Neuhaus: stay in +fclass=2 mode, don't go to +fclass=0 same for the Hayes Optima (+FAA=1 doesn't work in +fclass=0 mode) 175) man page documentation for "login.config" 177) AIX, native SCO: DTR toggle needs re-open() on device 178) Linux: #ifdef PARANOID -> lock HUPCL (and CLOCAL?) flag in termios and do vhangup() stuff 180) switch from policy.h-dist to policy.h with "reasonable defaults" 240) do away with policy.h, make everything run-time configurable 184) make sendfax choose fax device in a "random" fashion (avoid problems when the first modem in a "hunt group" dies (NO DIALTONE)) (if faxrunqd is used, it will take care of this) 186) make "distinguished ring" run-time-option: dist-ring "RING 1" fax dist-ring "RING B" fax/data dist-ring "RING 3" voice (dynamically growing list, appended to "action" list) 187) clean up tio handling / gettydefs stuff in mgetty.c 188) init / DCD drop / I/O error: can we catch it with CLOCAL? 189) sendfax: log "hint" if "ignore-carrier" is not set but "should be" 191) watchit.pl: make "remail" smarter 193) makelock: check for existance of lock file *directory*, complain (loudly, L_FATAL!) if it doesn't exist. 194) faxspool: add switch to suppress e-mail 195) make "logging *only* to syslog" conditional compile 197) +FAP (Sub-Adressing frames) support? 199) selectively reject fax reception (on sender ID)? http://www.vix.com/hylafax/setup-advanced.html#QualifyTSI 200) build kind of "libiberty" with auxiliary functions [split up goodies.c] 201) make "open() on TCP/IP" socket possible in sendfax (for things like portmasters, that have special IP ports to access their modem cards) 203) fix ATD/ERROR problem with USR vs. ERROR response in fax_send_ppm 205) vgetty on AIX: make sure VTIME is not set != 0 while waiting with select() or poll() -- drivers are dumb and use VTIME for timeout, not the value passed to select()... *sigh* 206) if "Dr.Neuhaus SMARTY" is detected, set some flag to prevent switching back to +fclass=0 ("modem_quirks |= NEED_2"?) 207) if "Telejet SaferFAX" set "cls2ok" ("modem_quirks |= PROPER_BOR"); 209) faxrm - fix "call with no arguments" 210) fix cnd.c / mgetty.c: clearing of CallerID if call was rejected (Frank Piwarski, fpiwarsk@MyMy.com) 211) fix CLOCAL handling in mgetty (->Ted T'so) 212) faxrm: generic "removeit" subroutine, not multiple "rmdir $jobid" 213) add support for Mark Himsley (mark@mdsh.com)'s weird 2400/fax modem, requiring multiple baud rate switches 215) implement e-mail to fax gateway using fax addressing as in IETF draft "draft-ietf-fax-addressing-02.txt" (or similar) 218) check whether "ATI1" always returns version number info on the *first* line on ZyXEL 2864I models, instead of "checksum first" (like all other models) --> faxlib.c, "case 28642:" 222) fix "g3cat"'s line width correction algorithm - include black dot. 224) faxspool: permit "*" as part of the phone number --> faxrunq(d): make sure that "*" in $phone is never expanded as wildcard! 225) use a non-root user-id (nobody?) for "cnd-program" 225a) change "system" to "build a proper argv[], then fork/setuid/exec/wait" 226) call cnd-program after "min-rings" RINGs, and before waiting for the remaining number of RINGs. (Also, that way vgetty can control the number of RINGs depending on the distinctive RING number / ISDN MSN) 226a) have the cnd-program decide whether to "answer NOW", or "ask me again later". 2018-03-05: sort-of done (226+226a) with cid-program / return-value (cid-program can set rings_wanted to "1" [now!] or "some high number", after which cnd-program will be run - still not fully flexible, but maybe that's not a real use-case anyway) 227) mgetty: add config option to call external program in the case of "L_AUDIT / failed" exit's? Might be helpful for an external management system... (Robert Canary) 227a) external scoreboard (shared memory, etc) too keep track of things? 228) find a way to limit the number of "faxrunq"'s that can run in parallel (on systems with a very large fax queue, it might happen that faxrunq is ran often enough to overflow file/process tables, causing everything to break) - Graham Leggett WORKAROUND: use faxrunqd if you have many modems and high fax througput. 229) weird idea: use NSFs to communicate version number "proceeding", mgetty's own NSF vendor code assigned 2006/06/07 230) add "frontends" section to the documentation (mgetty.texi) 231) pass dist_ring and called_id as env variables to login/new_fax 232) have cndfind() signal back to ring.c if the string found was a "caller ID" (for speedups, Caller ID is counted as "RING", to avoid waiting for the next real RING which might delay answering by a number of seconds) 233) have different login: prompts for callback/non-callback logins 234) make new_fax path configurable 235) build "faxspool-d" daemon that listens to network requests, plus "r-faxspool" client. 236) make Windows client use faxspool-d, not lpd 237) use r-faxspool/faxspool-d locally as well, to avoid world-writeable /var/spool/fax directory 238) show vgetty version in "vgetty -V", not only mgetty version 239) make utmp entry (CallerId/Connect) configurable from mgetty.config 241) cnd-program rework (more return codes, call after first RING) 242) document callback and login.conf v2 243) fix page lengths while sending (integrate in "send G3 file with byte padding" that's necessary for class 1 anyway) 244) faxrunqd / write combining: if some pages of a "combined" job (everything but the first) have already been renamed to f.g3.done, sendfax will refuse cooperation ("command line error"). BUG. 245) open anon CVS for mgetty 248) include script to rotate/move log files on a regular basis (base on contrib/mvlog, move to tools/, run through sedscript for location and naming for the log files) 250) move prototype for time() to mgetty.h, remove everywhere else 252) implement backend code for mgetty/sendfax.config "*-flow" directives 253) rewrite modem ID code (base on ATI9, fall back to ATI if ATI9 doesn't work) 254) in vgetty, "voice_log_level" overrides "-x" - cli args should have precedence! Tricky problem (voice/libutil/config.c). 255) if faxrunq(d) can't read config file due to permission problems, don't ignore error but print some informative message 256) add easy way to create/remove $FAX_SPOOL_OUT/stop (fax-helper?) done: faxq stop / faxq start 257) generalize calling $(MAKE) in subdirs - put all $(MAKE) arguments in one common variable 261) faxrunqd: don't count "modem locked" as "failure" for a given job (but *do* delay by a certain time) (hmmm - maybe not. If all modems are locked for a long period of time, it might be useful to flag the fax as "failed" to get people to notice. Combine with 259 - should resolve problem) 262) faxrunqd: smarter algorithm for "modem is broken" (locked = doesn't count, can't init = +1, NO CARRIER = +0.2) 263) faxspool.rules: add sample mappings for PDF (via acroread, xpdf, recent ghostscript versions) 264) faxrunqd: timeout on "hanging" sendfax processes (timeout > 15 min + 5 minutes * number of pages, or something like that) 265) faxrunqd: write tty to acct.log (format change / WEB gui) 260) faxrunqd: bump up priority of "exit 12" jobs 266) faxunrqd: if a job fails half-way through (12), increase priority to re-send missing parts quickly 267) faxrunqd: sort per-modem statistics numerically (watchout: "total") 268) faxrunq+faxrunqd: have configurable counters for "send-a-warning after tries, fail after " have separate counter for "modem-locked" costing-failures tries-except-modem-locked total-tries warning - 10 10 failure 5 30 100 269) faxrunqd: have configurable threshold for "everything is broken" -> if that threshold is reached, generate STOP file, warning e-mail, and suspend itself (like "the local in-house PABX is broken") 270) Makefile: have all paths depend on $(root)/ (->Debian) use $(root)/ for "make bindist" 271) rethink whole concept of "blocking yes" - when is this supposed to be used ("getty" replacement) - how is it supposed to work and then fix logging in mgetty.c ("waiting..." is not appropriate) 272) have a configurable delay after each "sendfax" call in faxrunq(d) (reason: long but not timing-critical out queue, don't starve incoming calls. Wouter van Marle, wouter@squirrel-systems.com) 273) update "ZyXEL" modem section in mgetty.texi-in - it's mainly specific to the 1496s. More recent ZyXELs need mentioning. ksadil@bigpond.com reports that the U90e works well with vgetty. 274) g32sff (based on g3cat routines) 275) sff2g3: duplicate previous line on 0xff/0x00 tag 276) fix "make beta" process (no gcc on target machine anymore) [26.11.05: moved to new target machine] 276a) add freshmeat net reminder 277) mg_m_init.c/mg_get_ctty() - if setsid() fails, and getppid() != 1, mgetty might be run from the command line. Should we try fork()ing, then setsid()'ing, and then getting a new controlling tty? (Things are likely to fail anyway due to missing utmp slots...) 280a) implement BREAK and dual-tilde sending in tools/microcom.c 282) add test code for ring.c, faxlib.c, and other low-level modules (overload mdm_read_byte() -> feed various RING strings to ring.c etc) t_ring.c: test "action" strings (CONNECT, ERROR, etc.) 283) mvlog: gzip 284) test function for faxq-helper? 286) faxrunqd: add hard (long) timeout to "wait for child processes" so that faxrunqd can recover in case something seriously gets stuck 287) run "cvs tag" automatically after "make beta" 288) change all #idents to contain @(#) prefix 289) re-do all the bitmap conversion stuff in faxspool (with recent netpbm versions, pgmtopbm doesn't properly work anymore, instead you need to use pamditherbw | pamtopnm) 290) (re-)organize fax class 1 "state" - e.g. always use fax_param_d 291) implement T.37 on-ramp and off-ramp gateways 292) implement T.38 on-ramp and off-ramp gateways 293) implement -o 'myoption arguments' flags to mgetty and sendfax, get rid of all these flag letters mgetty-1.2.1/beta000066400000000000000000000033111334553713100136650ustar00rootroot00000000000000#!/bin/sh # # Aufruf z.B.: 1.1 14 1.1.13 fuer "1.1.14 neu, diff zu 1.1.13". # # $Log: beta,v $ # Revision 4.4 2018/03/06 13:26:16 gert # change from texi2html to texi2any for HTML manual # # Revision 4.3 2007/06/15 07:11:57 gert # change "make fullclean" to "make clean" # # Revision 4.2 2006/02/25 12:49:17 gert # add freshmeat.net reminder # # Revision 4.1 2005/11/26 13:26:48 gert # Documentation-Preparation script for mgetty releases # # MR=$1 SR=$2 DIFFR=$3 HOST=$4 DOC=$5 # # well defined environment... # PATH=/usr/bin:/bin:/usr/local/bin:/usr/X11R6/bin:/home/gert/bin VS=$MR.$SR if expr "$VS" : '[0-9].[13579]' >/dev/null ; then DST=mgetty$VS-`date +%b%d`.tar.gz else DST=mgetty+sendfax-$VS.tar.gz fi latest="$DST" diff="mgetty$DIFFR-$MR.$SR.diff.gz" echo "latest beta: $latest / $diff" # build index.html page echo "TODO: HTML-Page bauen!" #cd $html #sed -e "s/@@BETA@@/$latest/" -e "s/@@MR@@/$MR/g" -e "s/@@SR@@/$SR/" -e "s/@@DATE@@/`date +%Y-%m-%d`/" index.html if [ "$4" = "stop" ] ; then exit 1 ; fi cd doc make clean doc-all || exit 1 rm -f work-html/* gzip -9 work-html/mgetty.dvi.gz gzip -9 work-html/mgetty.ps.gz col -b work-html/mgetty.txt.gz cp *.man work-html/ for i in *.man ; do echo "$i..." rman -f HTML -r "%s.man.html" -l "mgetty+sendfax manual: $i" $i >work-html/$i.html done scp *.texi $HOST:$DOC/ #texi2html -split_node -menu -verbose mgetty.texi texi2any --split=node --verbose --html --force -o work-html mgetty.texi cd work-html/ scp -r . $HOST:$DOC/ cd .. rm -f work-html/* #./cvm #tar cvfz ../doc/mgetty.html.tar.gz mgetty_*.html echo "update freshmeat.net releases" |mail -s TODO gert@greenie.muc.de mgetty-1.2.1/callback/000077500000000000000000000000001334553713100145655ustar00rootroot00000000000000mgetty-1.2.1/callback/.files000066400000000000000000000001221334553713100156630ustar00rootroot00000000000000README Makefile callback.c conf_cb.c conf_cb.h ct.c callback.config login.cfg.doc mgetty-1.2.1/callback/Makefile000066400000000000000000000017501334553713100162300ustar00rootroot00000000000000# Makefile for the "callback" subtree # of mgetty+sendfax # # SCCS: %W% %E% Copyright (c) Gert Doering # CC=gcc CFLAGS=-O2 -I.. -g zigzag: cd .. ; $(MAKE) call-back all: callback ct CBOBJS=callback.o conf_cb.o ../config.o ../logfile.o ../do_chat.o \ ../modem.o ../locks.o ../tio.o ../io.o ../goodies.o CTOBJS=ct.o callback: $(CBOBJS) $(CC) $(CFLAGS) $(LDFLAGS) -o callback $(CBOBJS) $(LIBS) ct: $(CTOBJS) $(CC) $(CFLAGS) $(LDFLAGS) -o ct $(CTOBJS) $(LIBS) conf_cb.o : conf_cb.c conf_cb.h ../mgetty.h ../ugly.h ../policy.h \ ../syslibs.h ../config.h ../Makefile $(CC) $(CFLAGS) -DCONFDIR=\"$(CONFDIR)\" -c conf_cb.c callback.o: callback.c ../syslibs.h ../mgetty.h ../ugly.h ../policy.h \ ../tio.h ../mg_utmp.h ../version.h ../config.h conf_cb.h $(CC) $(CFLAGS) -DVARRUNDIR=\"$(VARRUNDIR)\" -c callback.c clean: rm -f callback ct *.o # # install programs # install: all $(INSTALL) -s -m 700 -o root callback $(SBINDIR) $(INSTALL) -s -m 4711 -o root ct $(BINDIR) # source modules mgetty-1.2.1/callback/README000066400000000000000000000012561334553713100154510ustar00rootroot00000000000000This is a first cut of my callback tool. Highly BETA, many rough edges. You call it from "login.config" like this: # # callback experiments # cback-gert - - /usr/local/sbin/callback -S 11223344 to call you back on "11223344" upon entering of a login name of "cback-gert". If you don't specify a number on the command line, the program will ask. If you don't specify a username but "*", things will break: callback will loop forever, calling you again and again (skipping login.config upon the second connect doesn't work yet), because it will *always* call callback... Use it for your own fun, and on your own risk. NEW: there is a callback man page ("man 8 callback") now. gert mgetty-1.2.1/callback/callback.c000066400000000000000000000407021334553713100164700ustar00rootroot00000000000000#ident "%W% %E% Copyright (c) Gert Doering" /* callback.c * * main module of the mgetty based callback / connect terminal (ct) system * * Operation: * - detach from terminal and controlling process * - find free tty line *which is controlled by mgetty* * (won't work if no mgetty there) * - init modem * - dial out, try different numbers if desired * - upon CONNECT, send mgetty on that line a SIGUSR1 (via MGETTY_PID_FILE) * [if compiled w/o MG_PID_FILE, read utmp and try to find mgetty pid] * + mgetty is in state St_dialout (because a lock file exists) * + in this state, SIGUSR1 means "take the line back from me" * + mgetty reopens the line, sends a SIGUSR1 back (pid of callback * program taken from lock file) * + mgetty overwrites lock file with its own [attention! RACE!] * - wait 5 seconds * - exit * + mgetty sends "Welcome... login:"-prompt * + mgetty calls /bin/login (bypass login.config!!) * * Use: * - call "callback" from login.config for automatic dial-back * - call "ct" (connect terminal) from the shell */ #include #include #include "syslibs.h" #include #include #include #include #include #ifndef sunos4 #include #endif #ifdef NeXT #include #endif #include "mgetty.h" #include "policy.h" #include "tio.h" #include "mg_utmp.h" #include "version.h" #include "config.h" #include "conf_cb.h" #if (defined(M_XENIX) && !defined(M_UNIX)) || defined(NEXTSGTTY) #define O_NOCTTY 0 #endif /* what kind of "surprising" things are recognized */ chat_action_t dial_chat_actions[] = { { "NO CARRIER", A_FAIL }, { "NO DIALTONE",A_FAIL }, { "BUSY", A_FAIL }, { "ERROR", A_FAIL }, { "RING\r", A_FAIL }, { NULL, A_FAIL } }; /* prototypes for system functions (that are missing in some * system header files) */ #if !defined(__NetBSD__) && !defined(__OpenBSD__) time_t time _PROTO(( time_t * tloc )); #endif /* conf_cb.c */ void exit_usage _PROTO((int num)); char * Device; /* device to use */ char * DevID; /* device name withouth '/'s */ extern time_t call_start; /* time when we sent ATA */ /* defined in faxrec.c */ boolean mgetty_ACK = FALSE; /* mgetty has ACKed the "take over" */ static RETSIGTYPE sig_mgetty_ack(SIG_HDLR_ARGS) { signal( SIGUSR1, sig_mgetty_ack ); lprintf( L_NOISE, "got ACK signal from mgetty" ); mgetty_ACK = TRUE; } boolean timeout = FALSE; static RETSIGTYPE sig_timer(SIG_HDLR_ARGS) { signal( SIGALRM, sig_timer ); lprintf( L_NOISE, "got alarm signal -> huh?" ); timeout = TRUE; } static RETSIGTYPE sig_goodbye _P1 ( (signo), int signo ) { lprintf( L_AUDIT, "failed dev=%s, pid=%d, got signal %d, exiting", Device, getpid(), signo ); rmlocks(); exit(10); } /* find the process ID of the mgetty process monitoring a given line */ int find_mgetty _P1( (device), char * device ) { int pid; /* look in mgetty's PID file (this is the easy way out) */ char pid_file_name[ MAXPATH ]; FILE * fp; char *DevID, *p; /* name mangling for SVR4 systems ("/dev/term/a" -> "term-a") */ DevID = p = strdup( Device ); if ( !DevID ) { perror( "callback: can't malloc" ); exit(99); } while( *p ) { if ( *p == '/' ) *p = '-'; p++; } sprintf( pid_file_name, "%s/mgetty.pid.%s", VARRUNDIR, DevID ); lprintf( L_NOISE, "find_mgetty: look in PID file %s", pid_file_name); fp = fopen( pid_file_name, "r" ); if ( fp == NULL ) { lprintf( L_ERROR, "can't read mgetty pid file %s", pid_file_name ); return -1; } if ( fscanf( fp, "%d", &pid ) != 1 ) { lprintf( L_ERROR, "can't read mgetty pid from %s", pid_file_name ); pid = -1; } fclose( fp ); lprintf( L_MESG, "PID for mgetty on line %s: %d", device, pid ); return pid; } void detach_tty _P0( void ) { int r; /* detach from controlling tty (close all FD's, get rid of c.tty, ...) */ lprintf( L_MESG, "detaching from ctty..." ); printf( "\nDialing continues in the background, all further messages will\nbe written to the logfile '" ); printf( LOG_PATH, "callback" ); printf( "'.\nPlease look there for errors / diagnostics.\n\n" ); fflush(stdout); tio_drain_output(1); /* make sure data is sent to modem */ sleep(1); /* and modem has sent it out */ switch( fork() ) { case 0: /* child */ /* close old tty */ close(0); close(1); close(2); #ifndef M_UNIX /* detach from controlling tty (we need to get a new one :)) */ if ( ( r = open( "/dev/tty", O_RDWR ) ) >= 0 ) { ioctl( r, TIOCNOTTY, NULL ); close( r ); } #endif /* get a new process group */ #if defined(BSD) || defined(sunos4) setpgrp( 0, getpid() ); #else setpgrp(); #endif break; case -1: /* error */ perror( "fork failed, can't detach myself" ); fprintf( stderr, "giving up.\n" ); exit(4); default: /* parent */ exit(0); } } /* make file descriptor stdin/stdout/stderr [only] */ int fd_make_stddev _P1( (fd), int fd ) { if ( fd > 0 ) { (void) close(0); if ( dup(fd) != 0 ) { lprintf( L_ERROR, "can't dup(fd=%d) to stdin", fd ); return ERROR; } close(fd); } (void) close(1); (void) close(2); if ( dup(0) != 1 ) { lprintf( L_ERROR, "can't dup(0) to stdout" ); return ERROR; } if ( dup(0) != 2 ) { lprintf( L_ERROR, "can't dup(0) to stderr" ); return ERROR; } return NOERROR; } /* open device, and set up all terminal parameters properly */ int callback_init_device _P1( (dev), char * dev ) { int fd; TIO tio; fd = open( dev, O_RDWR | O_NDELAY | O_NOCTTY ); if ( fd == -1 ) { lprintf( L_ERROR, "can't open %s", dev ); return -1; } /* set back to non-blocking */ fcntl( fd, F_SETFL, O_RDWR ); if ( tio_get( fd, &tio ) == ERROR ) { close(fd); return -1; } tio_mode_sane( &tio, TRUE ); tio_set_speed( &tio, c_int(speed) ); tio_default_cc( &tio ); tio_mode_raw( &tio ); #ifdef sun tio_set_flow_control( fd, &tio, (DATA_FLOW) & (FLOW_SOFT) ); #else tio_set_flow_control( fd, &tio, DATA_FLOW ); #endif if ( tio_set( fd, &tio ) == ERROR ) { close(fd); return -1; } return fd; } /* loop through all devices in "ttys" (separated with ":"), * try to lock and open() them, check if mgetty running, * return file descriptor or -1 * * if all ttys are locked, try every "rtime" seconds until "end_time" * seconds are reached (unix time), then give up. * * the device opened is stored in "device", the process id of the mgetty * process monitoring the line in "*mgetty_pid". */ int callback_find_device _P5( (ttys, device, mgetty_pid, rtime, end_time), char * ttys, char * device, int * mgetty_pid, int rtime, int end_time ) { char * p, *p_help; int fd; char tty[MAXLINE]; boolean found_locked; /* found some tty locked */ lprintf( L_NOISE, "cbfd: search ttys '%s'", ttys ); do { found_locked = FALSE; p = ttys; while( *p != 0 ) { p_help = memccpy( tty, p, ':', strlen(p)+1 ); if ( p_help != NULL ) { p_help--; *p_help = 0; p++; } p+=strlen(tty); if ( strncmp( tty, "/dev/", 5 ) == 0 ) { strcpy( device, tty ); } else { if ( tty[0] == '/' ) { lprintf( L_WARN, "%s: absolute paths must start with /dev, skipping", tty ); continue; } sprintf( device, "/dev/%s", tty ); } Device = device+5; /* device name without "/dev/" */ lprintf( L_NOISE, "cbfd: device: '%s'", device ); /* try locking */ if ( makelock( Device ) != SUCCESS ) { lprintf( L_MESG, "%s: locked", Device ); found_locked = TRUE; continue; } /* mgetty there? */ if ( (*mgetty_pid = find_mgetty( Device )) == -1 ) { lprintf( L_MESG, "no mgetty on %s, can't use this line", Device ); rmlocks(); continue; } /* try open/setup device */ if ( ( fd = callback_init_device( device )) == -1 ) { lprintf( L_MESG, "can't init %s, skipping", Device ); rmlocks(); continue; } /* got 'em */ return fd; } /* end while( process all ttys ) */ /* if some locked ttys were seen, we try again later. If none * were found, retrying would be quite useless, so we don't. */ if ( found_locked ) { lprintf( L_NOISE, "delaying %d seconds before next try", rtime ); sleep(rtime); } } while( found_locked && time(NULL) < end_time ); return -1; } int dialup _P4((fd, phone, count, end_time), int fd, char ** phone, int count, int end_time ) { int n; char dialbuf[MAXLINE]; char * r; /* set up timeout watchdog, in case modem dies and does not send * anything back to us in the maximum time-to-connect */ signal( SIGALRM, sig_timer ); n=0; do { alarm(180); /* 3 minute timeout */ lprintf( L_MESG, "dialing %s...", phone[n] ); sprintf( dialbuf, "%s%s", c_string(dial_prefix), phone[n] ); mdm_send( dialbuf, fd ); while( 1 ) { r = mdm_get_line( fd ); if ( r == NULL ) break; lprintf( L_MESG, "dialup: got '%s'", r ); if ( strncmp( r, "CONNECT", 7 ) == 0 ) { alarm(0); lprintf( L_MESG, "got CONNECT, success!" ); return NOERROR; } if ( strncmp( r, "ERROR", 5 ) == 0 || strncmp( r, "OK", 2 ) == 0 || strncmp( r, "BUSY", 4 ) == 0 || strncmp( r, "NO DIALTONE", 11 ) == 0 || strncmp( r, "NO CARRIER", 10 ) == 0 || strncmp( r, "NO ANSWER", 10 ) == 0 ) { lprintf( L_MESG, "dialup attempt failed, try next number"); break; } } alarm(0); if ( ++n >= count ) n=0; /* next phone number */ sleep( c_int(retry_time) ); } while( time(NULL) < end_time && ! timeout ); lprintf( L_MESG, "time ran out, giving up" ); return ERROR; } /* provide some "dummy" things for do_chat(), otherwise callback won't link */ /*!!! FIXME - we don't really want this */ int virtual_ring = FALSE; void cndfind _P1( (p), char * p ) { /* DUMMY */ } int main _P2((argc, argv), int argc, char ** argv) { char devname[MAXLINE+1]; /* full device name (with /dev/) */ int mgetty_pid = -1; /* pid of mgetty on that device */ char ** t_numbers; /* telephone numbers */ int t_count; /* number of numbers */ char * t_help; char phonebuf[40]; /* telephone number entered */ char buf[MAXLINE+1]; TIO tio; int fd; int i; time_t end_time; action_t action; /* startup */ /* catch all nasty signals, clean up behind, and log... */ (void) signal(SIGHUP, SIG_IGN); (void) signal(SIGINT, sig_goodbye); (void) signal(SIGQUIT, sig_goodbye); (void) signal(SIGTERM, sig_goodbye); /* some systems, notable BSD 4.3, have to be told that system * calls are not to be automatically restarted after those signals. */ #ifdef HAVE_SIGINTERRUPT siginterrupt( SIGINT, TRUE ); siginterrupt( SIGALRM, TRUE ); siginterrupt( SIGHUP, TRUE ); siginterrupt( SIGUSR1, TRUE ); siginterrupt( SIGUSR2, TRUE ); #endif Device = "unknown"; /* we *must* run as root to signal mgetty */ if ( geteuid() != 0 ) { fprintf( stderr, "\nSorry, callback must be run as userid \"root\", otherwise it won't work.\n\n" ); lprintf( L_AUDIT, "fail: non-root user id %d", getuid() ); exit(2); } /* process the command line */ callback_parse_args( argc, argv ); /* remaining command line arguments is/are telephone number(s) */ if (optind < argc) /* phone number given on the command line */ { t_count = argc - optind; t_numbers = &argv[optind]; } else /* read telephone number from stdin */ { lprintf( L_MESG, "reading telephone number from stdin" ); printf( "Telephone number for callback: " ); /*!!! FIXME: accept only proper telephone numbers */ fgets( phonebuf, 30, stdin ); t_count = 1; t_numbers = &t_help; t_numbers[0] = phonebuf; i = strlen(phonebuf); while (i>0 && !isprint( (unsigned char)phonebuf[i-1] )) phonebuf[--i] = 0; } /* Initialize Logging */ sprintf( buf, LOG_PATH, "callback" ); log_init_paths( argv[0], buf, NULL ); lprintf( L_NOISE, "callback: %s", mgetty_version ); lprintf( L_JUNK, "%d telephone numbers given:", t_count ); for( i=0; i0) ? rand()%c_int(delay_rand) : rand()%5 ); if (i<4) i=4; lprintf( L_NOISE, "delaying %d seconds", i ); sleep(i); /* try each device in turn until we find one that is not locked, * can be open()ed, and has an mgetty process monitoring it */ fd = callback_find_device( c_string(ttys), devname, &mgetty_pid, c_int(retry_time), end_time ); if ( fd == -1 ) { lprintf( L_ERROR, "can't get dialout device, exiting" ); exit(2); } /*!!! do we really need this? */ if ( fd_make_stddev( fd ) == ERROR ) { lprintf( L_ERROR, "can't make stdin/stdout/sterr, exiting" ); exit(2); } fd=0; /* use stdin from now on */ /* switch off stdio buffering */ setbuf( stdin, (char *) NULL ); setbuf( stdout, (char *) NULL ); setbuf( stderr, (char *) NULL ); /* set log "infix" according to device name */ log_init_paths( NULL, NULL, &Device[strlen(Device)-3] ); /* read device specific configuration file */ callback_get_config( Device ); /* make a short (+randomized!) pause, giving mgetty enough time * to initialize modem, and making "spoofing" harder */ /* init modem */ lprintf( L_MESG, "initializing modem..." ); if ( do_chat( fd, c_chat(modem_init), dial_chat_actions, &action, 10, TRUE ) != SUCCESS ) { if ( action == A_TIMOUT ) { lprintf( L_ERROR, "Error: modem does not answer, giving up!" ); return ERROR; } lprintf( L_WARN, "modem init failed: expect problems." ); } /* dial all numbers, in turn, until CONNECT is established * if no connection is made on first turn, sleep 60 seconds, and try again */ if ( dialup( fd, t_numbers, t_count, end_time ) == ERROR ) { lprintf( L_ERROR, "can't dial any of the given numbers, exiting" ); exit(10); } /* connection is made */ #if 0 /* drain input - make sure there are no leftover "NO CARRIER"s * or "ERROR"s lying around from some previous dial-out */ clean_line( STDIN, 1); /* wait .3s for line to clear (some modems send a \n after "OK", this may confuse the "call-chat"-routines) */ clean_line( STDIN, 3); /* sleep... waiting for activity */ /* wait for line to clear (after "CONNECT" a baud rate may be sent by the modem, on a non-MNP-Modem the MNP-request string sent by a calling MNP-Modem is discarded here, too) */ clean_line( STDIN, 3); #endif /* honor carrier now: terminate if modem hangs up prematurely */ tio_get( STDIN, &tio ); tio_carrier( &tio, TRUE ); tio_set( STDIN, &tio ); /* wait a little bit, then print "pre-welcome" message */ delay( c_int(prompt_waittime) ); printf( "Connection established, please wait...\r\n" ); /* wait for data to be sent to modem before charging ahead... */ tio_drain_output( STDIN ); delay( 300 ); /* signal mgetty, wait for answer, die peacefully. */ signal( SIGUSR1, sig_mgetty_ack ); if ( kill( mgetty_pid, SIGUSR1 ) < 0 ) { lprintf( L_ERROR, "can't signal mgetty process %d, giving up", mgetty_pid); printf( "Fatal error: can't pass control, hanging up.\r\n" ); sleep(5); exit(5); } signal( SIGALRM, sig_timer ); alarm(30); pause(); /* just sleep until SIGALRM or SIGUSR1 arrives */ alarm(0); if ( timeout || !mgetty_ACK ) { lprintf( L_FATAL, "wait_ack: something went wrong, didn't get ACK in time" ); printf( "Fatal error: can't pass control, hanging up.\r\n" ); sleep(5); exit(5); } lprintf( L_AUDIT, "callback: success, device=%s, mgetty=%d", devname, mgetty_pid ); return 0; } mgetty-1.2.1/callback/callback.config000066400000000000000000000003431334553713100175100ustar00rootroot00000000000000# # this is a very much undocumented sample file for "callback.config". # # it's only good to show what options exist. See the source for docs! # dialout-devices tty5a:tty5d retry-time 30 max-time 90 debug 9 dial-prefix ATX3D mgetty-1.2.1/callback/conf_cb.c000066400000000000000000000112121334553713100163170ustar00rootroot00000000000000#ident "%W% %E% Copyright (c) Gert Doering" /* conf_cb.c * * configuration defaults / configuration reading code for callback tool */ #include #include #include #include "mgetty.h" #include "policy.h" #include "syslibs.h" #include "tio.h" #include "config.h" #include "conf_cb.h" #include "version.h" char * mgetty_version = VERSION_LONG; /* version.h */ /* initialize the modem - MODEM_INIT_STRING defined in policy.h */ static char * def_init_chat_seq[] = { "", "ATQ0V1H0", "OK", "AT+FCLASS=0", "OK", NULL }; /* this is the default configuration... */ struct conf_data_mgetty c = { { "dialout-devices", {(p_int)FAX_MODEM_TTYS}, CT_STRING, C_PRESET }, { "dialout-devices", {0}, CT_STRING, C_IGNORE }, { "delay", {20}, CT_INT, C_PRESET }, { "delay-randomize", {10}, CT_INT, C_PRESET }, { "retry-time", {30}, CT_INT, C_PRESET }, { "max-time", {600}, CT_INT, C_PRESET }, { "modem-init", {0}, CT_CHAT, C_PRESET }, { "speed", {DEFAULT_PORTSPEED}, CT_INT, C_PRESET }, { "dial-prefix", {(p_int) FAX_DIAL_PREFIX}, CT_STRING, C_PRESET }, { "autobauding", {FALSE}, CT_BOOL, C_PRESET }, { "prompt-waittime", {300}, CT_INT, C_PRESET }, { "", {FALSE}, CT_BOOL, C_PRESET }, /* nodetach */ { "debug", {LOG_LEVEL}, CT_INT, C_PRESET }, { NULL, {0}, CT_STRING, C_EMPTY }}; /* * exit_usage() - exit with usage display */ void exit_usage _P1((code), int code ) { fprintf( stderr, "Usage: callback [-x ] [-V] [-l ] [-m ]\n [-s ] [-d] [-S] [phone number(s)...]\n"); exit(code); } int callback_parse_args _P2( (argc,argv), int argc, char ** argv ) { int opt; /* sanity check: * make sure that structs-in-struct can be handled exactly as if * packed in array (get_config relies on it!) */ conf_data c_a[2]; if ( ( (char *)&c_a[1] - (char *)&c_a[0] ) != ( (char *)&c.ttys_0 - (char *)&c.ttys ) ) { fprintf( stderr, "ERROR: config table size mixup. contact author\n" ); exit(99); } /* initialize a few things that can't be done statically */ c.modem_init.d.p = (void *) def_init_chat_seq; c.modem_init.flags = C_PRESET; #if 0 c.answer_chat.d.p = (void *) def_answer_chat_seq; c.answer_chat.flags = C_PRESET; #endif /* get command line arguments */ while ((opt = getopt(argc, argv, "x:s:am:l:SdV")) != EOF) { switch (opt) { case 'x': /* log level */ conf_set_int( &c.debug, atoi(optarg) ); log_set_llevel( c_int(debug) ); break; case 's': /* port speed */ conf_set_int( &c.speed, atoi(optarg) ); break; case 'a': /* autobauding */ /*!!! FIXME: not implemented */ conf_set_bool( &c.autobauding, TRUE ); break; case 'm': /* modem init sequence */ c.modem_init.flags = C_OVERRIDE; c.modem_init.d.p = conf_get_chat( optarg ); break; case 'l': /* set device(s) to use */ if ( optarg[0] == '/' && strncmp( optarg, "/dev/", 5 ) != 0 ) { fprintf( stderr, "%s: -l: device must be located in /dev!\n", argv[0]); exit(1); } conf_set_string( &c.ttys, optarg ); break; case 'S': /* unconditionally use *this* line for call back */ conf_set_string( &c.ttys, ttyname(0) ); lprintf( L_MESG, "using stdin for dial out, tty=%s", c_string(ttys)); break; case 'd': /* debug mode: don't detach from tty */ conf_set_bool( &c.nodetach, TRUE ); lprintf( L_MESG, "debug mode active" ); break; case 'V': /* show version number */ printf("\nmgetty+sendfax by Gert Doering\n%s\n\n", mgetty_version); printf("log file written to '"); printf(LOG_PATH, "callback" ); printf("'\n\n"); exit(0); case '?': exit_usage(2); break; } } return NOERROR; } /* get callback configuration from file (defaults are used if it doesn't exist) */ void callback_get_config _P1( (port), char * port ) { #ifdef CALLBACK_CONFIG if ( port == NULL ) { lprintf( L_NOISE, "reading default configuration" ); get_config( makepath( CALLBACK_CONFIG, CONFDIR ), (conf_data *)&c, "port", NULL ); } else { lprintf( L_NOISE, "reading specific data for port '%s'", port ); get_config( makepath( CALLBACK_CONFIG, CONFDIR ), ((conf_data *)&c)+1, "port", port ); } #else lprintf( L_NOISE, "not reading config file, not configured" ); #endif /* tell log subsystem about new log level */ log_set_llevel( c_int(debug) ); /* sanity checks */ if ( tio_check_speed( c_int(speed) ) < 0 ) { lprintf( L_FATAL, "invalid port speed: %d", c_int(speed)); exit_usage(2); } /*!!! further checks required? */ } mgetty-1.2.1/callback/conf_cb.h000066400000000000000000000017321334553713100163320ustar00rootroot00000000000000#ident "%W% %E% Copyright (c) 1994 Gert Doering" /* all (dynamic) callback configuration is contained in this structure. * It is initialized and loaded in conf_cb.c and accessed from callback.c */ extern struct conf_data_mgetty { struct conf_data ttys, /* ttys */ ttys_0, /* for second pass, "ignore" */ delay, /* min. delay before first call */ delay_rand, /* add random time 0...dr to delay */ retry_time, /* time between two dialup attempts */ max_retry_time, /* how long to try altogether */ modem_init, /* modem initialization */ speed, /* port speed */ dial_prefix, /* ATDT0WP... */ autobauding, /* change baud rate to CONNECT "xxx" */ prompt_waittime, /* pause [in ms] after CONNECT */ nodetach, /* don't fork() */ debug, /* debugging */ end_of_config; } c; int callback_parse_args _PROTO(( int argc, char ** argv )); void callback_get_config _PROTO(( char * port )); mgetty-1.2.1/callback/ct.c000066400000000000000000000002441334553713100153370ustar00rootroot00000000000000#include #include "mgetty.h" int main _P2((argc, argv), int argc, char ** argv ) { fprintf( stderr, "ct: not yet implemented\n" ); return 1; } mgetty-1.2.1/callback/login.cfg.doc000066400000000000000000000031051334553713100171210ustar00rootroot00000000000000Date: Mon, 22 Feb 1999 08:35:40 +0100 From: Gert Doering To: Pang Wai Man Raymond , mgetty@muc.de Subject: Re: Restrict login through callback, not dial-in by mgetty? X-mgetty-docs: http://alpha.greenie.net/mgetty/ Hi, On Mon, Feb 22, 1999 at 10:53:24AM +0800, Pang Wai Man Raymond wrote: > Requirement > =========== > Without using the dialback modem, > 1. a dummy account with password, can initiate the callback > 2. users can only login through callback, but not dial-in. > > I can implement step 1 but not 2. Does anybody have alternative? Set up login.config like this: ------- login.config sample, file version 2 ---------- # login.config # # use version-2 format !version 2 # # # this is the dummy user name, it's allowed to login only if this # is not already an ongoing callback callback N - - /bin/login @ # # these are the real users: only allowed if it's a callback ("Y") * Y - - /bin/login @ # # if some other user name was entered, and it's not a callback, # throw them out * - - - /bin/false ------- login.config sample, file version 2 ---------- I admit that the "version 2" stuff isn't documented anywhere yet (except the source) and it hasn't been fully tested either. So please get mgetty 1.1.20, test it, and report back to us :) gert -- USENET is *not* the non-clickable part of WWW! //www.muc.de/~gert/ Gert Doering - Munich, Germany gert@greenie.muc.de fax: +49-89-35655025 gert.doering@physik.tu-muenchen.de mgetty-1.2.1/class1.c000066400000000000000000000557421334553713100144000ustar00rootroot00000000000000#ident "$Id: class1.c,v 4.21 2014/04/03 09:04:13 gert Exp $ Copyright (c) Gert Doering" /* class1.c * * High-level functions to handle class 1 fax -- * state machines for fax phase A, B, C, D. Error recovery. * * Uses library functions in class1lib.c, faxlib.c and modem.c * * $Log: class1.c,v $ * Revision 4.21 2014/04/03 09:04:13 gert * rename FRAMESIZE to C1_FRAMESIZE, collision with AIX header file (grrr) * * Revision 4.20 2009/03/19 15:51:17 gert * bugfix: new NSF sending code was introducing extra "AT+FTH=3" commands * (due to confusion about internal requirements of fax1_send_frame()) * * Revision 4.19 2009/03/19 15:33:59 gert * send NSF frames on reception (if modem quirk 0x40, for now) * handle different modem behaviour regarding AT+FTS=8;+FTH=3 gracefully * * Revision 4.18 2006/10/27 09:07:12 gert * add file name of page currently sent to log message * * Revision 4.17 2006/10/25 10:55:01 gert * class 1 receive: log current try #, send DIS only if CSI went without error * * Revision 4.16 2006/09/29 19:30:26 gert * properly calculate scan line time -> padding bytes * implement FTT -> retraining, with baud rate reduction * * Revision 4.15 2006/09/26 15:36:07 gert * - handle modems that don't get AT+FTS=8;+FTM=nn right * (re-do AT+FTM if the first command yields "OK") * - switch on and off Xon/Xoff flow control before/after sending page data * * Revision 4.14 2006/09/25 22:26:54 gert * fax1_send_page(): move all the G3 file handling to g3file.c functions * (-> cleanup code, build common infrastructure for class 1 + class 2) * * Revision 4.13 2006/03/22 14:13:12 gert * when sending, hand over received NSF to NSF decoder (faxlib.c/hyla_nsf.c) * * Revision 4.12 2006/03/07 21:31:50 gert * class 1 sending implementation: * - handle end-of-page (return to phase B or phase C, or send DCN/hangup) * - move sending of TSI and DCS inside fax1_send_page(), to be able to * handle RTN/RTP transparently - somewhat sloppy "phase B" definition, * but much cleaner this way * - fix reading of G3 files - skip digifax header, also send last chunk * - fix bit swapping (fax_send_swaptable) * -> class 1 sending now works, if the receiver doesn't need EOL padding * * Revision 4.11 2006/03/07 14:16:56 gert * fax1_dial_and_phase_AB(): add torture test code, refusing incoming CSI/DIS * 2 times before going on (mainly for testing receiver robustness) * fax1_send_page(): add log message to point out unimplemented stuff * * Revision 4.10 2006/01/04 21:07:12 gert * remove "speed" argument from fax1_send_dcs() (use fax1_max global) * * Revision 4.9 2006/01/03 09:12:20 gert * initialize "tries" in fax1_receive_page() * * Revision 4.8 2006/01/01 17:07:43 gert * change all fax1_send_dcn() to already set appropriate hangup code * add prototypes for local functions * add timeout handling and re-try logic to fax1_highlevel_receive(), * fax1_receive_tcf() and fax1_receive_page() * add handling of incoming DCNs (give up) * add calculation of "how long should TCF be?" + checking to fax1_receive_tcf() * * Revision 4.7 2005/12/31 17:47:10 gert * use fax1_send_dis() instead of doing it here * * Revision 4.6 2005/12/31 15:52:08 gert * more comments * fax 1 receiver: * * use global variable fax1_receive_have_connect to * communicate answering status ("have we seen CONNECT?") from mgetty.c * * prepare full T.30 receive state machine, including EOM->phase B * and RTP/RTN->TCF (not complete) * * set fax_hangup/fax_hangup_code correctly upon some error situations * * Revision 4.5 2005/12/30 23:05:05 gert * rework fax1_send_frame(): leading 0xff is now implicit * (symmetric to fax1_receive_frame()) * change all callers to use new "frame" layout without 0xff * change lots of occurences of "3" to use "T30_CAR_V21" * rename fax1_receive() to fax1_highlevel_receive() * use "fd" and not "STDIN" everywhere * hand DCS frame to class1lib/fax1_parse_dcs() * -> use proper carrier values for TCF and page reception (partially untested) * change "simple" frame sending to use fax1_send_simf_final() * add more comments about individual fax phases * * Revision 4.4 2005/12/28 21:53:08 gert * fix some compiler warnings and typos * adapt to changed fax1_send_idframe() * add CVS header * add (very rough and incomplete) fax class 1 implementation, consisting * - fax1_receive() (to be called from faxrec.c) * - fax1_receive_tcf() (handle TCF training frame + responses) * - fax1_receive_page() (setup page reception, hand to fax_get_page_data()) * */ #ifdef CLASS1 #include #include #include #include #include #include #include "mgetty.h" #include "fax_lib.h" #include "tio.h" #include "class1.h" #include "policy.h" enum T30_phases { Phase_A, Phase_B, Phase_C, Phase_D, Phase_E } fax1_phase; /* maping of "st" codes to actual time (for normal res.) */ static int fax_scan_times[8] = { 0, 5, 10, 10, 20, 20, 40, 40 }; int fax1_dial_and_phase_AB _P2( (dial_cmd,fd), char * dial_cmd, int fd ) { char * p; /* modem response */ uch framebuf[C1_FRAMESIZE]; int first; int len; #ifdef TORTURE_TEST int t_tries=0; #endif /* send dial command */ if ( fax_send( dial_cmd, fd ) == ERROR ) { fax_hangup = TRUE; fax_hangup_code = FHUP_ERROR; return ERROR; } /* wait for ERROR/NO CARRIER/CONNECT */ signal( SIGALRM, fax1_sig_alarm ); alarm(FAX_RESPONSE_TIMEOUT); while( !fax_hangup ) { p = mdm_get_line ( fd ); if ( p == NULL ) { lprintf( L_ERROR, "fax1_dial: hard error dialing out" ); fax_hangup = TRUE; fax_hangup_code = FHUP_ERROR; break; } lprintf( L_NOISE, "fax1_dial: string '%s'", p ); if ( strcmp( p, "ERROR" ) == 0 || strcmp( p, "NO CARRIER" ) == 0 ) { fax_hangup = TRUE; fax_hangup_code = FHUP_ERROR; break; } if ( strcmp( p, "NO DIALTONE" ) == 0 || strcmp( p, "NO DIAL TONE" ) == 0 ) { fax_hangup = TRUE; fax_hangup_code = FHUP_NODIAL; break; } if ( strcmp( p, "BUSY" ) == 0 ) { fax_hangup = TRUE; fax_hangup_code = FHUP_BUSY; break; } if ( strcmp( p, "CONNECT" ) == 0 ) /* gotcha! */ { break; } } alarm(0); if ( fax_hangup ) return ERROR; /* now start fax negotiation (receive CSI, DIS, send DCS) * read all incoming frames until FINAL bit is set */ first=TRUE; again: do { if ( (len = fax1_receive_frame( fd, first? 0:3, 30, framebuf ) ) == ERROR ) { /*!!!! try 3 times! (flow diagram from T.30 / T30_T1 timeout) */ fax_hangup = TRUE; fax_hangup_code = 11; return ERROR; } switch ( framebuf[1] ) /* FCF */ { case T30_CSI: fax1_copy_id( framebuf ); break; case T30_NSF: fax1_incoming_nsf( framebuf+2, len-2 ); break; case T30_DIS: fax1_parse_dis( framebuf ); break; case T30_DCN: fax1_send_dcn( fd, 20 ); return ERROR; default: lprintf( L_WARN, "unexpected frame type 0x%02x", framebuf[1] ); } first=FALSE; } while( ( framebuf[0] & T30_FINAL ) == 0 ); #ifdef TORTURE_TEST while( ++t_tries < 3 ) { mdm_command( "AT+FRS=200", fd ); goto again; } #endif fax1_phase = Phase_B; /* Phase A done */ return NOERROR; } /* fax1_send_page * * send a page of G3 data * - if phase is "B", include sending of DCS, TCF and possibly * baud rate stepdown and repeated transmission of DCS. * - if phase is "C", directly send page data */ int fax1_send_page _P5( (g3_file, bytes_sent, tio, ppm, fd), char * g3_file, int * bytes_sent, TIO * tio, Post_page_messages ppm, int fd ) { uch framebuf[C1_FRAMESIZE]; char * line; char cmd[40]; char dleetx[] = { DLE, ETX }; char rtc[] = { 0x00, 0x08, 0x80, 0x00, 0x08, 0x80, 0x00, 0x08 }; int pad_bytes, s_time; /* if we're in T.30 phase B, send DCS + training frame (TCF) now... * don't forget delay (75ms +/- 20ms)! * * NOTE: this is not strictly "phase B" - in T.30, phase B begins * after sending the DCS, and before sending TCF. But since RTN/RTP * return to sending DCS (bullet "D" in T.30 chart 5-2a), grouping it * this way is much more logical to implement */ /* calculate scan line time * in fine mode, some of the values get divided by 2 */ s_time = fax_scan_times[ remote_cap.st & 0x7 ]; if ( remote_cap.vr == 1 && (remote_cap.st & 0x1) == 0 ) s_time /= 2; if ( fax1_phase == Phase_B ) { char train[150]; int i, num; int tries=0; retrain: /* "(D)" in T.30/Figure 5-2a */ /* send local id frame (TSI) */ fax1_send_idframe( fd, T30_TSI|0x01, T30_CAR_V21 ); /* send DCS */ if ( fax1_send_dcs( fd, s_time ) == ERROR ) { fax_hangup = TRUE; fax_hangup_code = 10; return ERROR; } sprintf( cmd, "AT+FTS=8;+FTM=%d", dcs_btp->c_long ); fax_send( cmd, fd ); line = mdm_get_line( fd ); if ( line != NULL && strcmp( line, cmd ) == 0 ) line = mdm_get_line( fd ); if ( strcmp( line, "OK" ) == 0 ) { lprintf( L_MESG, "fax1_send_page: unexpected OK, re-do AT+FTM" ); sprintf( cmd, "AT+FTM=%d", dcs_btp->c_long ); fax_send( cmd, fd ); line = mdm_get_line( fd ); if ( line != NULL && strcmp( line, cmd ) == 0 ) line = mdm_get_line( fd ); } if ( line == NULL || strcmp( line, "CONNECT" ) != 0 ) { lprintf( L_ERROR, "fax1_send_page: unexpected response 1: '%s'", line ); fax_hangup = TRUE; fax_hangup_code = 20; return ERROR; } /* send data for training (1.5s worth) */ num = (dcs_btp->speed/8)*1.5; lprintf( L_NOISE, "fax1_send_page: send %d bytes training (TCF)", num ); memset( train, 0, sizeof(train)); for( i=0; i 1 ) fax1_reduce_max(); if ( tries < 3 ) goto retrain; /* give up */ fax1_send_dcn( fd, 27 ); return ERROR; } /* phase B done, go to phase C */ fax1_phase = Phase_C; } if ( fax1_phase != Phase_C ) { lprintf( L_ERROR, "fax1_send_page: internal error: not Phase C" ); fax_hangup = TRUE; fax_hangup_code = FHUP_ERROR; return ERROR; } /* open G3 file, read first chunk, potentially skipping digifax header */ if ( g3_open_read( g3_file ) < 0 ) { /*!!! do something smart here...? */ fax1_send_dcn( fd, FHUP_ERROR ); return ERROR; } /* number of bytes to pad depend on scan time */ pad_bytes = ((dcs_btp->speed/8) * s_time + 999) / 1000; lprintf( L_MESG, "scan line time: %d ms -> %d bytes/line at %d bps", s_time, pad_bytes, dcs_btp->speed ); /* Phase C: send page data with high-speed carrier */ sprintf( cmd, "AT+FTM=%d", dcs_btp->c_short ); fax_send( cmd, fd ); line = mdm_get_line( fd ); if ( line != NULL && strcmp( line, cmd ) == 0 ) line = mdm_get_line( fd ); if ( line == NULL || strcmp( line, "CONNECT" ) != 0 ) { lprintf( L_ERROR, "fax1_send_page: unexpected response 3: '%s'", line ); fax_hangup = TRUE; fax_hangup_code = 40; return ERROR; } lprintf( L_NOISE, "send page data (\"%s\")...", g3_file ); /* turn on xon/xoff flow control now, for page data sending */ if ( (FAXSEND_FLOW) & FLOW_SOFT ) { tio_set_flow_control( fd, tio, (FAXSEND_FLOW) & (FLOW_HARD|FLOW_XON_OUT)); tio_set( fd, tio ); } /* read page data from file, invert byte order, * insert padding bits (if scan line time > 0), * at end-of-file, add RTC */ if ( g3_send_file( g3_rf_chunk, fd, TRUE, TRUE, pad_bytes, 0 /*TODO!*/) < 0 ) { lprintf( L_ERROR, "error in g3_send_file()" ); return ERROR; } /*!!! ERROR HANDLING!! */ /*!!! PARANOIA: alarm()!! */ /* end of page: RTC */ write( fd, rtc, sizeof(rtc) ); /* end of data: DLE ETX */ write( fd, dleetx, 2 ); line = mdm_get_line( fd ); if ( line == NULL || strcmp( line, "OK" ) != 0 ) { lprintf( L_ERROR, "fax1_send_page: unexpected response 3a: '%s'", line ); fax_hangup = TRUE; fax_hangup_code = 40; return ERROR; } /* turn off xon/xoff flow control (will interfere with received frames) */ if ( (FAXSEND_FLOW) & FLOW_SOFT ) { tio_set_flow_control( fd, tio, (FAXSEND_FLOW) & FLOW_HARD ); tio_set( fd, tio ); } /* now send end-of-page frame (MPS/EOM/EOP) and get pps */ fax1_phase = Phase_D; lprintf( L_MESG, "page data sent, sending end-of-page frame (C->D)" ); sprintf( cmd, "AT+FTS=8;+FTH=3" ); fax_send( cmd, fd ); line = mdm_get_line( fd ); if ( line != NULL && strcmp( line, cmd ) == 0 ) line = mdm_get_line( fd ); if ( line == NULL || strcmp( line, "CONNECT" ) != 0 ) { if ( strcmp( line, "OK" ) == 0 ) goto tryanyway; lprintf( L_ERROR, "fax1_send_page: unexpected response 4: '%s'", line ); fax_hangup = TRUE; fax_hangup_code = 50; return ERROR; } /* some modems seemingly can't handle AT+FTS=8;+FTH=3 (returning * "OK" instead of "CONNECT"), so send AT+FTH=3 again for those. */ tryanyway: framebuf[0] = 0x03 | T30_FINAL; switch( ppm ) { case pp_eom: framebuf[1] = T30_EOM | fax1_dis; break; case pp_eop: framebuf[1] = T30_EOP | fax1_dis; break; case pp_mps: framebuf[1] = T30_MPS | fax1_dis; break; default: lprintf( L_WARN, "fax1_send_page: canthappen(1) - PRI not supported" ); } if ( strcmp( line, "OK" ) == 0 ) /* re-send AT+FTH=3 */ { fax1_send_frame( fd, T30_CAR_V21, framebuf, 2 ); } else /* it got sent & acked */ { fax1_send_frame( fd, T30_CAR_HAVE_V21, framebuf, 2 ); } /* get MPS/RTP/RTN code */ fax1_receive_frame( fd, T30_CAR_V21, 30, framebuf ); /*!!! T.30 flow chart... */ switch( framebuf[1] ) { case T30_MCF: /* page good */ fax_page_tx_status = 1; fax1_phase = Phase_C; break; case T30_RTN: /* retrain / negative */ fax_page_tx_status = 2; fax1_phase = Phase_B; break; case T30_RTP: /* retrain / positive */ fax_page_tx_status = 3; fax1_phase = Phase_B; break; case T30_PIN: /* procedure interrupt */ fax_page_tx_status = 4; fax1_phase = Phase_B; break; case T30_PIP: fax_page_tx_status = 5; fax1_phase = Phase_C; break; default: lprintf( L_ERROR, "fax1_transmit_page: unexpected frame" ); fax1_send_dcn(fd, 53); break; } /* if this was the last page, and the receiver is happy * (MCF or RTP), send DCN, and call it quits */ if ( ppm == pp_eop && ( fax_page_tx_status == 1 || fax_page_tx_status == 3 || fax_page_tx_status == 5 ) ) { fax1_send_dcn( fd, 0 ); fax1_phase = Phase_E; } /* otherwise, nothing to do - caller will re-enter fax1_send_page(), * for next page / re-send of same page (we won't know) */ return NOERROR; } boolean fax1_receive_have_connect = FALSE; int fax1_receive_tcf _PROTO((int fd, int carrier, int wantbytes)); int fax1_receive_page _PROTO((int fd, int carrier, int * pagenum, char * dirlist, int uid, int gid, int mode )); int fax1_highlevel_receive _P6( (fd, pagenum, dirlist, uid, gid, mode ), int fd, int * pagenum, char * dirlist, int uid, int gid, int mode) { int rc; uch frame[C1_FRAMESIZE]; char * p; Post_page_messages ppm = pp_mps; boolean first = TRUE; int tries; boolean have_dcs; /* after ATA/CONNECT, first AT+FTH=3 is implicit -> send frames right away (first=TRUE) - when coming back to phase B after EOM, AT+FTH=3 must be sent */ /* with +FAE=1, the sequence seems to be * RING * ATA * FAX * CONNECT */ if ( !fax1_receive_have_connect ) { alarm(10); p = mdm_get_line( fd ); alarm(0); if ( p == NULL || strcmp( p, "CONNECT" ) != 0 ) { lprintf( L_WARN, "fax1_receive: initial CONNECT not seen" ); fax_hangup = TRUE; fax_hangup_code = FHUP_TIMEOUT; return ERROR; } } *pagenum = 0; /* phase B: Fax negotiations */ tries=0; have_dcs=FALSE; receive_phase_b: lprintf( L_MESG, "fax1 T.30 receive phase B (try %d)", tries+1 ); /* send NSF frame (if requested) */ if ( modem_quirks & MQ_SHOW_NSF ) { rc = fax1_send_nsf( fd, first?T30_CAR_HAVE_V21: T30_CAR_V21 ); } /* send local ID frame (CSI) - non-final */ rc = fax1_send_idframe( fd, T30_CSI, first?T30_CAR_HAVE_V21: T30_CAR_V21 ); first = FALSE; /* send DIS (but only if we haven't seen an error sending CSI) */ if ( rc == NOERROR ) rc = fax1_send_dis( fd ); /* now see what the other side has to say... */ wait_for_dcs: do { if ( fax1_receive_frame( fd, T30_CAR_V21, 30, frame ) == ERROR ) { if ( ++tries < 3 ) goto receive_phase_b; fax1_send_dcn( fd, 70 ); return ERROR; } switch( frame[1] & 0xfe ) /* FCF, ignoring X-bit */ { case T30_TSI: fax1_copy_id( frame ); break; case T30_NSF: break; case T30_DCS: fax1_parse_dcs( frame ); have_dcs=TRUE; break; case T30_DCN: fax1_send_dcn( fd, 70 ); return ERROR; break; default: lprintf( L_WARN, "unexpected frame type 0x%02x", frame[1] ); } } while( ( frame[0] & T30_FINAL ) == 0 ); if ( !have_dcs ) { lprintf( L_WARN, "T.30 B: final frame, but no DCS seen, re-send DIS" ); if ( ++tries < 3 ) goto receive_phase_b; fax1_send_dcn( fd, 70 ); return ERROR; } /* fax1_parse_dcs() has setup dcs_btp and fax_par_d for us */ /* receive 1.5s training sequence */ rc = fax1_receive_tcf( fd, dcs_btp->c_long, (dcs_btp->speed/8)*1.5 ); /* error receiving TCF ("no carrier seen") -> redo DIS/DCS */ if ( rc < 0 ) goto receive_phase_b; /* TCF bad? send FTT (failure to train), wait for next DCS */ if ( rc == 0 ) { rc = fax1_send_simf_final( fd, T30_CAR_V21, T30_FTT ); if ( ++tries < 10 ) goto wait_for_dcs; fax1_send_dcn( fd, 73 ); return ERROR; } /* TCF good, send CFR frame (confirmation to receive) */ rc = fax1_send_simf_final( fd, T30_CAR_V21, T30_CFR ); receive_next_page: /* phase C: start page reception & get page data */ lprintf( L_MESG, "fax1 T.30 receive phase C" ); rc = fax1_receive_page( fd, dcs_btp->c_short, pagenum, dirlist, uid, gid, mode ); /* if we have already hung up, not worth doing any retries etc. */ if ( rc == ERROR && fax_hangup ) return ERROR; /* phase D: post-message status * switch back to low-speed carrier, get (PRI-)EOM/MPS/EOP code */ tries=0; receive_phase_d: lprintf( L_MESG, "fax1 T.30 receive phase D" ); /* TODO: T.30 flow chart: will we ever hit non-final frames here? * what to do on error? */ do { if ( fax1_receive_frame( fd, T30_CAR_V21, 30, frame ) == ERROR ) { /* retry post-page handshake 3 times, then give up */ if ( ++tries < 3 ) goto receive_phase_d; fax1_send_dcn( fd, 100 ); return ERROR; } switch( frame[1] & 0xfe & ~T30_PRI ) /* FCF, ignoring X-bit */ { case T30_MPS: lprintf( L_MESG, "MPS: end of page, more to come" ); ppm = pp_mps; break; case T30_EOM: lprintf( L_MESG, "EOM: back to phase B" ); ppm = pp_eom; break; case T30_EOP: lprintf( L_MESG, "EOP: end of transmission" ); ppm = pp_eop; break; case T30_DCN: fax1_send_dcn( fd, 101 ); return ERROR; break; default: lprintf( L_WARN, "unexpected frame type 0x%02x", frame[1] ); } } while( ( frame[0] & T30_FINAL ) == 0 ); /* send back page good/bad return code (TODO: RTN/RTP codes) */ /* TODO: for RTN/RTP, restart training sequence (TCF) (??) */ rc = fax1_send_simf_final( fd, T30_CAR_V21, T30_MCF ); /* go back to phase B (EOM), go to next page (MPS), done (EOP) */ if ( ppm == pp_eom ) { goto receive_phase_b; } if ( ppm == pp_mps ) { goto receive_next_page; } /* EOP - get goodbye frame (DCN) from remote end, hang up */ fax1_receive_frame( fd, T30_CAR_V21, 30, frame ); if ( (frame[1] & 0xfe) != T30_DCN ) { lprintf( L_WARN, "fax1_receive: unexpected frame 0x%02x 0x%02x after EOP", frame[0], frame[1] ); } fax_hangup = TRUE; fax_hangup_code = 0; return NOERROR; } int fax1_receive_tcf _P3((fd,carrier,wantbytes), int fd, int carrier, int wantbytes) { int rc, count, notnull; char c, *p; boolean wasDLE=FALSE; int tries; tries=0; lprintf( L_NOISE, "fax1_r_tcf: carrier=%d", carrier ); get_carrier: rc = fax1_init_FRM( fd, carrier ); if ( rc == ERROR ) { while( ++tries<3 ) goto get_carrier; return ERROR; } /* TODO: proper timeout settings as per T.30 (?) */ alarm(5); count = notnull = 0; lprintf( L_JUNK, "fax1_r_tcf: got: " ); while(1) { if ( mdm_read_byte( fd, &c ) != 1 ) { /* timeout? corrupted DLE/ETX? let caller send FTT and retry */ lprintf( L_ERROR, "fax1_r_tcf: cannot read byte, return" ); return 0; } if ( c != 0 ) lputc( L_JUNK, c ); if ( wasDLE ) { if ( c == ETX ) break; wasDLE = 0; } if ( c == DLE ) { wasDLE = 1; continue; } count++; if ( c != 0 ) notnull++; } /* read post-frame "NO CARRIER" message */ p = mdm_get_line( fd ); alarm(0); if ( p == NULL || strcmp( p, "NO CARRIER" ) != 0 ) lprintf( L_WARN, "unexpected post-TCF modem response: '%s'", p ); if ( count < (wantbytes*3)/4 || /* not enough bytes */ notnull > count/10 ) /* or too many errors */ { lprintf( L_NOISE, "TCF: want %d, got %d, %d non-null -> retry", wantbytes, count, notnull ); return 0; /* try again */ } lprintf( L_NOISE, "TCF: want %d, got %d, %d non-null -> OK", wantbytes, count, notnull ); return 1; /* acceptable, go ahead */ } int fax1_receive_page _P7( (fd,carrier,pagenum,dirlist,uid,gid,mode), int fd, int carrier, int * pagenum, char * dirlist, int uid, int gid, int mode ) { int rc; char *p; int tries; char directory[MAXPATH]; fax_find_directory( dirlist, directory, sizeof(directory) ); tries=0; lprintf( L_NOISE, "fax1_rp: carrier=%d", carrier ); get_carrier: /* TODO: proper timeout settings as per T.30 */ alarm(10); rc = fax1_init_FRM( fd, carrier ); alarm(0); if ( rc == ERROR ) { if ( ++tries < 3 ) goto get_carrier; fax1_send_dcn( fd, 90 ); return ERROR; } /* now get page data (common function for class 1 and class 2) * note: fax_get_page_data() has its own alarm/timeout handling */ rc = fax_get_page_data( fd, ++(*pagenum), directory, uid, gid, mode ); /* read post-page "NO CARRIER" message */ alarm(10); p = mdm_get_line( fd ); alarm(0); if ( p == NULL || strcmp( p, "NO CARRIER" ) != 0 ) lprintf( L_WARN, "unexpected post-page modem response: '%s'", p ); if ( rc == ERROR ) { fax1_send_dcn( fd, 90 ); return ERROR; } /* TODO: copy quality checking */ return NOERROR; } #endif /* CLASS 1 */ mgetty-1.2.1/class1.h000066400000000000000000000115521334553713100143740ustar00rootroot00000000000000#ident "$Id: class1.h,v 4.13 2014/04/03 09:04:13 gert Exp $ Copyright (c) Gert Doering" /* class1.h * * common definitions for class 1 fax modules * * $Log: class1.h,v $ * Revision 4.13 2014/04/03 09:04:13 gert * rename FRAMESIZE to C1_FRAMESIZE, collision with AIX header file (grrr) * * Revision 4.12 2009/03/19 15:29:16 gert * add T30_CAR_HAVE_V21 (do not send AT, we have V21 carrier) * * Revision 4.11 2006/09/29 19:31:50 gert * add "scan time" parameter to fax1_send_dcs() * add function fax1_reduce_max() (baud rate stepdown) * add extern declaration for "remote_cap" (in class1lib.c) * * Revision 4.10 2006/06/14 09:54:03 gert * dcs_btp needs to be declared 'extern' * * Revision 4.9 2006/03/29 12:25:02 gert * change type of fax1_dis to uch (unsigned char) * change type of "fcf" in fax1_send_idframe() to uch * * Revision 4.8 2006/01/04 21:06:25 gert * remove "speed" argument from fax1_send_dcs() (use fax1_max global) * * Revision 4.7 2006/01/01 16:02:25 gert * introduce extra argument to fax1_send_dcn to set fax_hangup_code * * Revision 4.6 2005/12/31 17:46:43 gert * add fax1_send_dis() * * Revision 4.5 2005/12/31 15:52:46 gert * move typedef...uch from class1.h to mgetty.h * * Revision 4.4 2005/12/30 23:05:34 gert * update & add various prototypes * * Revision 4.3 2005/12/28 21:46:11 gert * T30_DCN had wrong hex value (should be 0xfa, was 0xfc) * add symbolic values for T30 carrier values (+FRH=3/+FTH=3) * add prototypes for most functions in class1lib.c * add CVS + file description header * */ #define C1_FRAMESIZE 300 extern uch fax1_dis; /* "X"-Bit (received DIS) */ /* class1lib.c */ RETSIGTYPE fax1_sig_alarm(SIG_HDLR_ARGS); void fax1_dump_frame _PROTO(( char io, uch * frame, int len )); int fax1_send_frame _PROTO(( int fd, int carrier, uch * frame, int len )); int fax1_send_simf_final _PROTO(( int fd, int carrier, uch fcf)); int fax1_send_simf_nonfinal _PROTO(( int fd, int carrier, uch fcf)); int fax1_send_dcn _PROTO(( int fd, int code )); void fax1_copy_id _PROTO(( uch * frame )); int fax1_send_idframe _PROTO(( int fd, uch fcf, int carrier)); void fax1_parse_dis _PROTO(( uch * frame )); void fax1_parse_dcs _PROTO(( uch * frame )); int fax1_send_dis _PROTO(( int fd )); int fax1_send_dcs _PROTO(( int fd, int s_time )); int fax1_receive_frame _PROTO (( int fd, int carrier, int timeout, uch * framebuf )); int fax1_init_FRM _PROTO(( int fd, int carrier )); void fax1_reduce_max _PROTO(( void )); /* class1.c */ int fax1_send_page _PROTO(( char * g3_file, int * bytes_sent, TIO * tio, Post_page_messages ppm, int fd )); struct fax1_btable { int speed; /* bit rate */ int flag; /* flag (for capabilities) */ int c_long, c_short; /* carrier numbers */ int dcs_bits; /* bits to be set in DCS */ }; extern struct fax1_btable * dcs_btp; /* current modulation */ extern fax_param_t remote_cap; /* receiver capabilities */ /* --- Definitions from ITU T.30, 07/96 --- */ /* control field - bit set on final frame, T.30 5.3.5 */ #define T30_FINAL 0x10 /* frame types (FCF), T.30 5.3.6, bits reversed! */ #define T30_DIS 0x80 /* Digital Information Signal */ #define T30_CSI 0x40 /* Called Subscriber Information */ #define T30_NSF 0x20 /* Non-Standard Facilities */ #define T30_DTC 0x81 /* Digital Transmit Command */ #define T30_CIG 0x41 /* Calling Subscriber Information */ #define T30_NSC 0x21 /* Non-Standard facilities Command */ #define T30_PWD 0xc1 /* Password (for polling) */ #define T30_SEP 0xa1 /* Selective Polling (subaddress) */ #define T30_DCS 0x82 /* Digital Command Signal */ #define T30_TSI 0x42 /* Transmit Subscriber Information */ #define T30_NSS 0x22 /* Non-Standard facilities Setup */ #define T30_SUB 0xc2 /* Subaddress */ #define T30_PWDT 0xa2 /* Password for Transmission */ #define T30_CFR 0x84 /* Confirmation To Receive */ #define T30_FTT 0x44 /* Failure To Train */ #define T30_EOM 0x8e /* End Of Message (end of page -> phase B) */ #define T30_MPS 0x4e /* MultiPage Signal (end of page -> phase C) */ #define T30_EOP 0x2e /* End Of Procedures (over and out) */ #define T30_PRI_EOM 0x9e /* EOM + PRI */ #define T30_PRI_MPS 0x5e /* MPS + PRI */ #define T30_PRI_EOP 0x3e /* EOP + PRI */ #define T30_PRI 0x10 /* bit 4 in FCF -> Procedure Interrupt */ #define T30_MCF 0x8c /* Message Confirmation (page good) */ #define T30_RTP 0xcc /* Retrain Positive */ #define T30_RTN 0x4c /* Retrain Negative */ #define T30_PIP 0xac /* Procedure Interrupt Positive */ #define T30_PIN 0x2c /* Procedure Interrupt Negative */ #define T30_DCN 0xfa /* Disconnect Now (phase E) */ #define T30_CRP 0x1c /* Command Repeat (optional) */ /* carrier values */ #define T30_CAR_SAME 0 /* pseudo-header, don't send AT+FTH/AT+FRH */ #define T30_CAR_V21 3 /* 300 bps for negotiation */ #define T30_CAR_HAVE_V21 -3 /* 300 bps for negotiation (already set) */ mgetty-1.2.1/class1lib.c000066400000000000000000000664331334553713100150660ustar00rootroot00000000000000#ident "$Id: class1lib.c,v 4.27 2015/08/19 17:36:10 gert Exp $ Copyright (c) Gert Doering" /* class1lib.c * * Low-level functions to handle class 1 fax -- * send a frame, receive a frame, dump frame to log file, ... * * $Log: class1lib.c,v $ * Revision 4.27 2015/08/19 17:36:10 gert * bit-tests with '&' and not '&&'... (found by clang) * * Revision 4.26 2014/04/03 09:04:13 gert * rename FRAMESIZE to C1_FRAMESIZE, collision with AIX header file (grrr) * * Revision 4.25 2014/02/03 19:03:11 gert * fax1_receive_frame(): * handle case where 0x13 character that needs to come after 0xff for * final frames is lost - print warning that this can be caused by wrong * xon/xoff flow control settings, and synthesize 0x13 character so we * can go on. Hack, but works :-) * * Revision 4.24 2014/02/02 13:44:19 gert * warning cleanup: * convert all "char" expressions to (uch) when calling ctype.h macros (*sigh*) * fix signed/unsigned char warning in function calls * * Revision 4.23 2009/03/19 15:31:21 gert * add CVS tags * */ #ifdef CLASS1 #include #include #include #include #include #include #include #include "mgetty.h" #include "fax_lib.h" #include "tio.h" #include "class1.h" #include "version.h" /* static variables * * only set by functions in this module and used by other functions, * but have to be module-global */ #define F1LID 20 static char fax1_local_id[F1LID]; /* local system ID */ static int fax1_min = 2400, /* min/max speed */ fax1_max = 14400; static int fax1_res; /* flag for normal resolution */ uch fax1_dis = 0x00; /* "X"-bit (last received DIS) */ static int fax1_fth, fax1_ftm, /* modem carrier capabilities */ fax1_frh, fax1_frm; /* symbolic constants for capability check */ #define V17 0xF00 #define V17_14400 0x800 #define V17_12000 0x400 #define V17_9600 0x200 #define V17_7200 0x100 #define V29 0x0F0 #define V29_9600 0x080 #define V29_7200 0x040 #define V27ter 0x00e #define V27t_4800 0x008 #define V27t_2400 0x004 #define V21 0x001 /* table of baud rate / carrier number / DCS bits */ struct fax1_btable fax1_btable[] = { { 14400, V17_14400, 145, 146, 0x20 /* 0001 */ }, { 12000, V17_12000, 121, 122, 0x28 /* 0101 */ }, { 9600, V17_9600, 97, 98, 0x24 /* 1001 */ }, { 9600, V29_9600, 96, 96, 0x04 /* 1000 */ }, { 7200, V17_7200, 73, 74, 0x2c /* 1101 */ }, { 7200, V29_7200, 72, 72, 0x0c /* 1100 */ }, { 4800, V27t_4800, 48, 48, 0x08 /* 0100 */ }, { 2400, V27t_2400, 24, 24, 0x00 /* 0000 */ }, { 300, V21, 3, 3, 0 }, { -1, -1,0,0,0 }}; /* pointer to current modulation in fax1_btable * (increment == fallback after FTT!) */ struct fax1_btable * dcs_btp = fax1_btable; /* table of bits-to-scan line time mappings, index = bits */ struct fax1_st_table { int st; int ms_n; int ms_f; char * txt; }; struct fax1_st_table fax1_st_table[8] = { /* ST, ms normal, ms fine bits */ { 5, 20, 20, " 20ms" }, /* 0 = 000 */ { 1, 5, 5, " 5ms" }, /* 1 = 100 */ { 3, 10, 10, " 10ms" }, /* 2 = 010 */ { 4, 20, 10, " 20/10ms" }, /* 3 = 110 */ { 7, 40, 40, " 40ms" }, /* 4 = 001 */ { 6, 40, 20, " 40/20ms" }, /* 5 = 101 */ { 2, 10, 5, " 10/5ms" }, /* 6 = 011 */ { 0, 0, 0, " 0ms" }}; /* 7 = 111 */ int fax1_set_l_id _P2( (fd, fax_id), int fd, char * fax_id ) { int i,l; char *p; l = strlen( fax_id ); if ( l > F1LID ) { l = F1LID; } /* bytes are transmitted in REVERSE order! */ p = &fax1_local_id[F1LID-1]; for ( i=0; ispeed > 0 ) { if ( cnr == btp->c_short || cnr == btp->c_long ) { cbits |= btp->flag; break; } btp++; } } return cbits; } /* step down max speed (at retrain time) */ void fax1_reduce_max _P0(void) { if ( dcs_btp->speed > 2400 ) { fax1_max = dcs_btp->speed - 2400; lprintf( L_NOISE, "reduce max speed to %d", fax1_max ); } } /* set fine/normal resolution flags and min/max transmission speed * including finding out maximum speed modem can do! */ int fax1_set_fdcc _P4( (fd, fine, max, min), int fd, int fine, int max, int min ) { char * p; lprintf( L_MESG, "fax1_set_fdcc: fine=%d, max=%d, min=%d", fine, max, min ); fax1_max = max; fax1_min = min; fax1_res = fine; if ( fax1_min == 0 ) fax1_min=2400; if ( fax1_max < fax1_min || fax1_max < 2400 || fax1_max > 14400 || fax1_min < 2400 || fax1_min > 14400 ) { lprintf( L_WARN, "min/max values (%d/%d) out of range, use 2400/14400", min, max ); fax1_min = 2400; fax1_max = 14400; } if ( fax1_res < 0 || fax1_res > 1 ) { lprintf( L_WARN, "fax1_res (%d) out of range, use fine (1)", fax1_res ); fax1_res = 1; } #if 0 /* we don't support anything but AT+FTH=3 yet */ p = mdm_get_idstring( "AT+FTH=?", 1, fd ); fax1_fth = fax1_carriers( p ); lprintf( L_MESG, "modem can send HDLC headers: %03x", fax1_fth ); #else fax1_fth = 001; #endif p = mdm_get_idstring( "AT+FTM=?", 1, fd ); fax1_ftm = fax1_carriers( p ); lprintf( L_MESG, "modem can send page data: %03x", fax1_ftm ); #if 0 /* we don't support anything but AT+FRH=3 yet */ p = mdm_get_idstring( "AT+FRH=?", 1, fd ); fax1_frh = fax1_carriers( p ); lprintf( L_MESG, "modem can recv HDLC headers: %03x", fax1_fth ); #else fax1_frh = 001; #endif p = mdm_get_idstring( "AT+FRM=?", 1, fd ); fax1_frm = fax1_carriers( p ); lprintf( L_MESG, "modem can recv page data: %03x", fax1_ftm ); return NOERROR; } /* timeout handler */ static boolean fax1_got_timeout = FALSE; RETSIGTYPE fax1_sig_alarm(SIG_HDLR_ARGS) { signal( SIGALRM, fax1_sig_alarm ); lprintf( L_WARN, "Warning: fax1: got alarm signal!" ); fax1_got_timeout = TRUE; } /* receive ONE frame, put it into *framebuf * * timeout set to "timout * 1/10 seconds" */ int fax1_receive_frame _P4 ( (fd, carrier, timeout, framebuf), int fd, int carrier, int timeout, uch * framebuf) { int count=0; /* bytes in frame */ int rc = NOERROR; /* return code */ char gotsync = FALSE; /* got 0xff frame sync */ char WasDLE = FALSE; /* got character */ char * line, c; if ( timeout > 0 ) { signal( SIGALRM, fax1_sig_alarm ); alarm( (timeout/10)+1 ); } if ( carrier > 0 ) { char cmd[20]; sprintf( cmd, "AT+FRH=%d", carrier ); /*!!! TOOD: DO NOT USE fax_send (FAX_COMMAND_DELAY) */ /* normally, fax_send() can only fail if something is really * messed up with the serial port, e.g. "stuck flow control" */ if ( fax_send( cmd, fd ) == ERROR ) { alarm(0); return ERROR; } /* wait for CONNECT/NO CARRIER */ line = mdm_get_line( fd ); if ( line != NULL && strcmp( line, cmd ) == 0 ) { line = mdm_get_line( fd ); } /* skip echo */ if ( line == NULL || strcmp( line, "CONNECT" ) != 0 ) { alarm(0); if ( line == NULL ) { char cancel_str[] = { CAN }; lprintf( L_WARN, "fax1_receive_frame: no carrier (timeout), send CAN" ); write( fd, cancel_str, 1 ); alarm(2); line = mdm_get_line( fd ); alarm(0); } else lprintf( L_WARN, "fax1_receive_frame: no carrier (%s)", line ); return ERROR; } } lprintf( L_NOISE, "fax1_receive_frame: got:" ); /* we have a CONNECT now - now find the first byte of the frame * (0xFF), and read in shielded data up to the */ while(1) { if ( mdm_read_byte( fd, &c ) != 1 ) { lprintf( L_ERROR, "fax1_receive_frame: cannot read byte, return" ); rc = ERROR; break; } /*!!!! TODO: CONNECT/ERROR statt Frame-Daten erkennen */ lputc( L_NOISE, c ); if ( !gotsync ) /* wait for preamble */ { if ( c == (char) 0xFF ) gotsync = TRUE; continue; } /* got preamble, all further bytes are put into buffer */ /* first byte of frame MUST be [03] (non-final) or [13] (final) * but if port is set to Xon/Xoff flow control, 0x13 gets lost * -> so if anything else shows up as "first byte" synthesize [13] */ if ( count == 0 && c != 0x03 && c != 0x13 ) { lprintf( L_WARN, "fax1_receive_frame: octet following 0xff must be 0x03 or 0x13, not 0x%02x - make sure outbound xon/xoff flow control is off!", c ); lputs( L_NOISE, "<*[0x13]*>" ); framebuf[count++] = 0x13; } /* enough room? */ if ( count >= C1_FRAMESIZE-5 ) { lprintf( L_ERROR, "fax1_receive_frame: too many octets in frame" ); rc = ERROR; break; } if ( WasDLE ) /* previous character was DLE */ { if ( c == DLE ) /* DLE DLE -> DLE */ { framebuf[count++] = DLE; } else if ( c == SUB ) /* DLE SUB -> DLE DLE */ { framebuf[count++] = DLE; framebuf[count++] = DLE; } else if ( c == ETX ) /* end of frame detected */ { rc = count; break; } WasDLE = 0; continue; } /* previous character was not DLE, check for DLE now... */ if ( c == DLE ) { WasDLE = 1; continue; } /* all other characters are stored in buffer */ framebuf[count++] = c; } /* now read OK / ERROR response codes (only if we're still happy) */ if ( rc != ERROR ) { line = mdm_get_line( fd ); if ( line == NULL || /* timeout ... */ strcmp( line, "ERROR" ) == 0 ) /* or FCS error */ { lprintf( L_MESG, "fax1_receive_frame: dropping frame" ); rc = ERROR; } } /* turn off alarm */ alarm(0); if ( rc > 0 ) { fax1_dump_frame( '<', framebuf, count ); } return rc; } void fax1_dump_frame _P3((io, frame, len), char io, unsigned char * frame, int len) { int fcf = frame[1]; lprintf( L_MESG, "%c frame type: 0x%02x len: %d %s%s", io, fcf, len, frame[0]&0x10? "final": "non-final", (fcf & 0x0e) && ( fcf & 0x01 ) ? " X": ""); if ( fcf & 0x0e ) fcf &= ~0x01; /* clear "X" bit */ switch( fcf ) { /* simple frames */ case T30_CSI: lprintf( L_NOISE, "CSI: '%20.20s'", &frame[2] ); break; case T30_CIG: lprintf( L_NOISE, "CIG: '%20.20s'", &frame[2] ); break; case T30_TSI: lprintf( L_NOISE, "TSI: '%20.20s'", &frame[2] ); break; case T30_NSF: lprintf( L_NOISE, "NSF" ); break; case T30_CFR: lprintf( L_NOISE, "CFR" ); break; case T30_FTT: lprintf( L_NOISE, "FTT" ); break; case T30_MCF: lprintf( L_NOISE, "MCF" ); break; case T30_RTP: lprintf( L_NOISE, "RTP" ); break; case T30_RTN: lprintf( L_NOISE, "RTN" ); break; case T30_EOM: lprintf( L_NOISE, "EOM" ); break; case T30_MPS: lprintf( L_NOISE, "MPS" ); break; case T30_EOP: lprintf( L_NOISE, "EOP" ); break; case T30_DCN: lprintf( L_NOISE, "DCN" ); break; /* complicated ones... */ case T30_DIS: lprintf( L_NOISE, "DIS:" ); if ( frame[2] & 0x40 ) lputs( L_NOISE, " V8" ); lputs( L_NOISE, frame[2] & 0x80 ? " 64": " 256" ); if ( frame[3] & 0x01 ) lputs( L_NOISE, " +FPO" ); if ( frame[3] & 0x02 ) lputs( L_NOISE, " RCV" ); switch( (frame[3] >> 2) &0x0f ) { case 0x00: lputs( L_NOISE, " V27ter_fb" ); break; case 0x02: lputs( L_NOISE, " V27ter" ); break; case 0x01: lputs( L_NOISE, " V29" ); break; case 0x03: lputs( L_NOISE, " V27ter+V29" ); break; case 0x0b: lputs( L_NOISE, " V27ter+V29+V17" ); break; default: lputs( L_NOISE, " V.???" ); break; } if ( frame[3] & 0x40 ) lputs( L_NOISE, " 200" ); if ( frame[3] & 0x80 ) lputs( L_NOISE, " 2D" ); switch( frame[4] & 0x03 ) { case 0x00: lputs( L_NOISE, " 215mm" ); break; case 0x02: lputs( L_NOISE, " 215+255+303" ); break; case 0x01: lputs( L_NOISE, " 215+255" ); break; } switch( (frame[4]>>2) & 0x03 ) { case 0x00: lputs( L_NOISE, " A4" ); break; case 0x02: lputs( L_NOISE, " unlim" ); break; case 0x01: lputs( L_NOISE, " A4+B4" ); break; } lputs( L_NOISE, fax1_st_table[ (frame[4]>>4) & 0x07 ].txt ); if ( ( frame[4] & 0x80 ) == 0 ) break; /* extent bit */ if ( frame[5] & 0x04 ) lputs( L_NOISE, " ECM" ); if ( frame[5] & 0x40 ) lputs( L_NOISE, " T.6" ); if ( ( frame[5] & 0x80 ) == 0 ) break; /* extent bit */ if ( ( frame[6] & 0x80 ) == 0 ) break; /* extent bit */ /* the next bytes specify 300/400 dpi, color fax, ... */ break; case T30_DCS: lprintf( L_NOISE, "DCS:" ); if ( frame[2] & 0x40 ) lputs( L_NOISE, " V8" ); lputs( L_NOISE, frame[2] & 0x80 ? " 64": " 256" ); if ( frame[3] & 0x02 ) lputs( L_NOISE, " RCV!" ); switch( (frame[3] >> 2) &0x0f ) { case 0x00: lputs( L_NOISE, " V27ter_2400" ); break; case 0x02: lputs( L_NOISE, " V27ter_4800" ); break; case 0x01: lputs( L_NOISE, " V29_9600" ); break; case 0x03: lputs( L_NOISE, " V29_7200" ); break; case 0x04: lputs( L_NOISE, " V33_14400" ); break; case 0x06: lputs( L_NOISE, " V33_12000" ); break; case 0x08: lputs( L_NOISE, " V17_14400" ); break; case 0x0a: lputs( L_NOISE, " V17_12000" ); break; case 0x09: lputs( L_NOISE, " V17_9600" ); break; case 0x0b: lputs( L_NOISE, " V17_7200" ); break; default: lputs( L_NOISE, " V.???" ); break; } if ( frame[3] & 0x40 ) lputs( L_NOISE, " 200!" ); if ( frame[3] & 0x80 ) lputs( L_NOISE, " 2D!" ); switch( frame[4] & 0x03 ) { case 0x00: lputs( L_NOISE, " 1728/215mm" ); break; case 0x02: lputs( L_NOISE, " 2432/303mm" ); break; case 0x01: lputs( L_NOISE, " 2048/255mm" ); break; } switch( (frame[4]>>2) & 0x03 ) { case 0x00: lputs( L_NOISE, " A4" ); break; case 0x02: lputs( L_NOISE, " unlim" ); break; case 0x01: lputs( L_NOISE, " B4" ); break; } lputs( L_NOISE, fax1_st_table[ (frame[4]>>4) & 0x07 ].txt ); if ( ( frame[4] & 0x80 ) == 0 ) break; /* extent bit */ if ( frame[5] & 0x04 ) lputs( L_NOISE, " ECM" ); if ( frame[5] & 0x40 ) lputs( L_NOISE, " T.6" ); if ( ( frame[5] & 0x80 ) == 0 ) break; /* extent bit */ if ( ( frame[6] & 0x80 ) == 0 ) break; /* extent bit */ /* the next bytes specify 300/400 dpi, color fax, ... */ break; default: lprintf( L_NOISE, "frame FCF 0x%02x not yet decoded", fcf ); } } /* send arbitrary frame */ int fax1_send_frame _P4( (fd, carrier, frame, len), int fd, int carrier, uch * frame, int len ) { char * line; static int carrier_active = -2; /* inter-frame marker */ uch dle_buf[C1_FRAMESIZE*2+2]; /* for DLE-coded frame */ int r,w; fax1_dump_frame( '>', frame, len ); /* this should never take more than a few msec, so the 10s timeout * is more a safeguard for modem lockups, implementation mistakes, etc. * - make sure we're not getting stuck in protocol loops */ alarm(10); /* send AT+FTH=3, wait for CONNECT * (but only if we've not sent an non-final frame before!) */ /* special-case (AT+FTS=8;+FTH=3) */ if ( carrier < 0 ) /* T30_CAR_HAVE_V21 */ { carrier_active = -carrier; /* -> T30_CAR_V21 */ carrier = T30_CAR_SAME; } /* catch internal out-of-sync condition ('canthappen') * (this is OK for the very first frame sent in receive mode - ugly, yes) */ if ( carrier == T30_CAR_SAME && carrier_active == -1 ) { errno = EINVAL; lprintf( L_ERROR, "fax1_send_frame: internal error - no carrier, but T30_CAR_SAME requested" ); return ERROR; } if ( carrier > 0 && carrier_active != carrier ) { char cmd[20]; sprintf( cmd, "AT+FTH=%d", carrier ); if ( fax_send( cmd, fd ) == ERROR ) { alarm(0); carrier_active=-1; return ERROR; } /* wait for CONNECT/NO CARRIER */ line = mdm_get_line( fd ); if ( line != NULL && strcmp( line, cmd ) == 0 ) { line = mdm_get_line( fd ); } /* skip echo */ if ( line == NULL || strcmp( line, "CONNECT" ) != 0 ) { alarm(0); lprintf( L_WARN, "fax1_send_frame: no carrier (%s)", line ); carrier_active=-1; return ERROR; } carrier_active=carrier; } /* first 0xff is mandatory, but not passed by caller */ dle_buf[0] = 0xff; w=1; /* send encoded frame data */ for( r=0; r */ dle_buf[w++] = DLE; dle_buf[w++] = ETX; lprintf( L_JUNK, "fax1_send_frame: %d/%d", len+1, w ); if ( write( fd, dle_buf, w ) != w ) { lprintf( L_ERROR, "fax1_send_frame: can't write all %d bytes", w ); alarm(0); fax_hangup=TRUE; return ERROR; } /*!!! alarm */ /*!!! LASAT schickt "CONNECT\r\nOK" bzw. nur "OK" (final/non-final) * --> ist das normal und richtig so??!? * * Nein... - es kommt immer entweder-oder, aber nach CONNECT muss * man OHNE neues AT+FTH *SOFORT* weitersenden! */ line = mdm_get_line( fd ); lprintf( L_NOISE, "fax1_send_frame: frame sent, got '%s'", line ); if ( frame[0] & T30_FINAL ) { carrier_active = -1; /* carrier is off */ lprintf( L_NOISE, "carrier is off - OK='%s'", line ); } /* as we're sending, we shouldn't see NO CARRIER response - but this * can happen, e.g. when the modem notices a remote hangup (ISDN etc.) */ if ( line == NULL || strcmp( line, "NO CARRIER" ) == 0 ) { lprintf( L_WARN, "fax1_send_frame: unexpected post-frame string '%s', assuming carrier off", line? line: "(null)" ); carrier_active = -1; return ERROR; } #if 0 if ( line != NULL && strcmp( line, "CONNECT" ) == 0 ) { line = mdm_get_line( fd ); lprintf( L_NOISE, "fax1_send_frame(2): got '%s'", line ); } #endif return NOERROR; } /* send simple frame, consisting only of FCF and no arguments * (non-final frame) */ int fax1_send_simf_nonfinal _P3( (fd, carrier, fcf), int fd, int carrier, uch fcf ) { uch frame[2]; frame[0] = 0x03; frame[1] = fcf; return fax1_send_frame( fd, carrier, frame, 2 ); } /* send simple frame, consisting only of FCF and no arguments * (final frame) */ int fax1_send_simf_final _P3( (fd, carrier, fcf), int fd, int carrier, uch fcf ) { uch frame[2]; frame[0] = 0x03 | T30_FINAL; frame[1] = fcf; return fax1_send_frame( fd, carrier, frame, 2 ); } /* send "disconnect now" frame (DCN), and move internal state to "game over" * Note: this is always a "final" frame */ int fax1_send_dcn _P2((fd, code), int fd, int code ) { if ( code != -1 ) { fax_hangup_code = code; fax_hangup = TRUE; } return fax1_send_simf_final( fd, T30_CAR_V21, T30_DCN|fax1_dis ); } /* send non-standard frame (NSF) with mgetty T.35 vendor ID */ int fax1_send_nsf _P2( (fd, carrier), int fd, int carrier ) { uch frame[C1_FRAMESIZE]; /* NSF is never final frame */ frame[0] = 0x03; frame[1] = T30_NSF; frame[2] = 0x20; /* germany */ frame[3] = 0x81; /* mgetty + */ frame[4] = 0x70; /* sendfax */ frame[5] = 0x00; /* frame version */ strncpy( (char*) &frame[6], "mgetty ", 7 ); strncpy( (char*) &frame[13], VERSION_SHORT, 7 ); return fax1_send_frame( fd, carrier, frame, 20 ); } /* send local identification (CSI, CIG or TSI) * Note: "final" bit is never set, as these frames are always optional. */ int fax1_send_idframe _P3((fd,fcf,carrier), int fd, uch fcf, int carrier) { unsigned char frame[F1LID+2]; frame[0] = 0x03; frame[1] = fcf; memcpy( &frame[2], fax1_local_id, F1LID ); return fax1_send_frame( fd, carrier, frame, sizeof(frame) ); } void fax1_copy_id _P1((frame), uch * frame ) { int w, r; char c; frame += 2; /* go to start of ID */ r = F1LID-1; w = 0; while ( r>= 0 && isspace(frame[r]) ) r--; /* skip leading whitespace */ while ( r>=0 ) /* copy backwards! */ { c = frame[r--]; if ( c == '"' || c == '\'' ) fax_remote_id[w++] = '_'; else fax_remote_id[w++] = c; } while( w>0 && isspace( (uch)fax_remote_id[w-1]) ) w--; fax_remote_id[w]=0; lprintf( L_MESG, "fax_id: '%s'", fax_remote_id ); } /* set local capabilities in DIS frame, announce to remote sender */ int fax1_send_dis _P1( (fd), int fd ) { uch frame[C1_FRAMESIZE]; int speedbits = 0; int r_flags; struct fax1_btable * dis_btp = fax1_btable; /* start with modem capabilities, restrain by FDCC values */ r_flags = fax1_frm; while( dis_btp->speed > 2400 ) { if ( dis_btp->speed < fax1_min || dis_btp->speed > fax1_max ) { r_flags &= ~(dis_btp->flag); lprintf( L_NOISE, "fax1_dis: %d out of range -> r_flags=%03x", dis_btp->speed, r_flags ); } dis_btp++; } /* some devices advertise V.17, but it doesn't work - so provide override * switch via modem_quirks that unconditionally turns off V.17 */ if ( modem_quirks & MQ_C1_NO_V17 ) r_flags &= ~V17; /* this is a bit messy, but I don't know a really elegant way to * use the fax1_btable structure for that (see T.30, Table 2, p.46) */ if ( (r_flags & V17) && (r_flags & V29) && (r_flags & V27ter) ) { speedbits = 0x2c; /* 1101 */ } else { if ( r_flags & V27t_4800 ) { speedbits |= 0x08; /* 0100 */ } if ( r_flags & V29 ) { speedbits |= 0x04; /* 1000 */ } } lprintf( L_NOISE, "fax1_dis: r_flags=%03x -> speedbits=0x%02x", r_flags, speedbits ); /* DIS is always final frame */ frame[0] = 0x03 | T30_FINAL; frame[1] = T30_DIS; frame[2] = 0x00; /* bits 1..8: group 1/2 - unwanted */ frame[3] = 0x00 | /* bit 9: can transmit - TODO: polling! */ 0x02 | /* bit 10: can receive */ speedbits | /* bit 11..14: receive rates - TODO!! */ ((fax1_res&1) <<6) | /* bit 15: can fine */ 0x00; /* bit 16: can 2D */ frame[4] = 0x08 | /* bits 17..20 = 215mm width, unlim. length */ 0x70 | /* bits 21..23 = 0ms scan time */ 0x00; /* bit 24: extend bit - final */ return fax1_send_frame( fd, T30_CAR_SAME, frame, 5 ); } /* parse incoming DIS frame, set remote capability flags */ fax_param_t remote_cap; void fax1_parse_dis _P1((frame), uch * frame ) { remote_cap.vr = remote_cap.br = remote_cap.wd = remote_cap.ln = remote_cap.df = remote_cap.ec = remote_cap.bf = remote_cap.st = 0; frame += 2; /* go to start of FIF */ /* bit 9: ready to transmit fax (polling) */ if ( frame[1] & 0x01 ) fax_to_poll = TRUE; /* bit 10: receiving capabilities */ if ( ( frame[1] & 0x02 ) == 0 ) { /*!!!! HANDLE THIS */ lprintf( L_WARN, "remote station can't receive!" ); fax_hangup = TRUE; fax_hangup_code = 21; return; } switch( frame[1] & 0x3c ) /* bits 11..14 - data signalling rate */ { case 0x00: remote_cap.br = V27t_2400; break; case 0x08: remote_cap.br = V27ter; break; case 0x04: remote_cap.br = V29; break; case 0x0c: remote_cap.br = V29 | V27ter; break; case 0x1c: remote_cap.br = V29 | V27ter; break; /* V.33 */ case 0x2c: remote_cap.br = V17 | V29 | V27ter; break; default: lprintf( L_WARN, "unknown signalling rate: 0x%02x, use V27ter", frame[1] & 0x3c ); remote_cap.br = V27ter; } if ( frame[1] & 0x40 ) /* bit 15: fine res. */ { remote_cap.vr = 1; /*!! check bits 42 + 43 for "super-fine" (300/400 dpi) */ } if ( frame[1] & 0x80 ) /* bit 16: 2D */ remote_cap.df = 1; /* df??? */ /* bit 17+18: recording width, valid: 0/1/2 = 215/255/303 mm */ remote_cap.wd = frame[2] & 0x03; /* bit 19+20: recording length, valid: 0/1/2 = A4/B4/unlimited */ remote_cap.ln = ( frame[2] >> 2 ) & 0x03; /* bit 21-23: minimum scan line time */ remote_cap.st = fax1_st_table[ (frame[2] >> 4) & 0x07 ].st; if ( frame[2] & 0x80 ) /* extend bit */ { /* bit 27: ECM */ if ( frame[3] & 0x04 ) remote_cap.ec = 1; } fax1_dis = 0x01; /* set "X" bit (= received DIS OK) */ lprintf( L_MESG, "+FIS: %d,%03x,%d,%d,%d,%d,%d,%d", remote_cap.vr, remote_cap.br, remote_cap.wd, remote_cap.ln, remote_cap.df, remote_cap.ec, remote_cap.bf, remote_cap.st ); } int fax1_send_dcs _P2((fd, s_time), int fd, int s_time ) { uch framebuf[C1_FRAMESIZE]; int i; /* find baud/carrier table entry that has a speed not over * "speed", and that uses a modulation scheme supported by both * the local and remote modem */ dcs_btp = fax1_btable; while( dcs_btp->speed > 2400 && ( dcs_btp->speed > fax1_max || ( dcs_btp->flag & fax1_ftm & remote_cap.br ) == 0 ) ) dcs_btp++; lprintf( L_NOISE, "+DCS: 1,%03x", dcs_btp->flag ); /*!!! calculate ALL values from DIS and to-be-sent page */ framebuf[0] = 0x03 | T30_FINAL; /* DCS is always final frame */ framebuf[1] = fax1_dis | T30_DCS; /* FCF */ framebuf[2] = 0; /* bits 1..8 */ framebuf[3] = 0x02 | /* bit 10: receiver operation */ dcs_btp->dcs_bits | /* bits 11..14: signalling rate */ ((fax1_res&remote_cap.vr)<<6) | /* bit 15: fine mode */ 0x00; /* bit 16: 2D */ framebuf[4] = 0x00 | /* bit 17+18: 215 mm width */ 0x04 | /* bit 19+20: B4 length */ 0x00 | /* bits 21-23: scan line time */ 0x00; /* bit 24: extend bit - final */ /* calculate correct bit settings for scan line time (bits 21-23) */ for( i=0;i<=7;i++ ) { if ( fax1_st_table[i].ms_n == s_time ) { framebuf[4] |= i<<4; break; } } return fax1_send_frame( fd, T30_CAR_V21, framebuf, 5 ); } /* parse incoming DCS frame * put communication parameters into global variables (dcs_btp, fax_par_d) */ /* TODO: error handling? "I don't understand this -> DCN" */ void fax1_parse_dcs _P1((frame), uch *frame) { /* bit rate + modulation requested (bits 11..14) */ dcs_btp = fax1_btable; while( dcs_btp->speed > 2400 && dcs_btp->dcs_bits != (frame[3] & 0x3c) ) dcs_btp++; fax_par_d.br = dcs_btp->speed/2400 - 1; /* fine resolution: bit 15 (98/196 lpi) */ fax_par_d.vr = ( frame[3] & 0x40 )? 1: 0; /* 2D: bit 16 (1D/2D mod read) */ fax_par_d.df = ( frame[3] & 0x80 )? 1: 0; /* page width: bits 17+18 (byte 4, bits 0+1) */ fax_par_d.wd = frame[4] & 0x03; /* page length: bits 19+20 */ fax_par_d.ln = (frame[4] >> 2 ) & 0x03; /* scan line time: bits 21-23 */ fax_par_d.st = fax1_st_table[ (frame[4] >> 4) & 0x07 ].st; /* extend bit? */ if ( ( frame[4] & 0x80 ) == 0 ) goto done; /* ECM - TODO */ done: lprintf( L_NOISE, "DCS: speed=%d, flag=%03x", dcs_btp->speed, dcs_btp->flag ); } int fax1_init_FRM _P2((fd,carrier), int fd, int carrier ) { char cmd[20]; char *line; int timeout = 30; /* TODO: is this sufficient timeout handling? */ if ( timeout > 0 ) { signal( SIGALRM, fax1_sig_alarm ); alarm( (timeout/10)+1 ); } sprintf( cmd, "AT+FRM=%d", carrier ); if ( fax_send( cmd, fd ) ) { alarm(0); return ERROR; } /* wait for CONNECT/NO CARRIER */ line = mdm_get_line( fd ); if ( line != NULL && strcmp( line, cmd ) == 0 ) { line = mdm_get_line( fd ); } /* skip echo */ alarm(0); if ( line == NULL || strcmp( line, "CONNECT" ) != 0 ) { lprintf( L_WARN, "fax1_init_FRM: no carrier (%s)", line ); return ERROR; } return NOERROR; } #endif /* CLASS1 */ mgetty-1.2.1/clean_line.c000066400000000000000000000042461334553713100152740ustar00rootroot00000000000000#ident "$Id: clean_line.c,v 4.1 2014/01/31 13:02:08 gert Exp $ Copyright (c) Gert Doering" /* clean_line.c * * auxiliary function that doesn't properly fit anywhere else * "wait until no more data is available on a tty line" * * used from mgetty and sendfax (but not from tap, microcom, etc.) */ #include #include #include #include #include #include #include "mgetty.h" #include "policy.h" #include "tio.h" /* clean_line() * * wait for the line "fd" to be silent for "waittime" tenths of a second * if more than 500 bytes are read, stop logging them. We don't want to * have the log files fill up all of the hard disk. */ int clean_line _P2 ((fd, waittime), int fd, int waittime ) { char buffer[2]; int bytes = 0; /* bytes read */ #if defined(MEIBE) || defined(NEXTSGTTY) || defined(BROKEN_VTIME) ||\ defined(FAX_SEND_SOCKETS) /* on some systems, the VMIN/VTIME mechanism is obviously totally * broken. So, use a select()/flush queue loop instead. */ lprintf( L_NOISE, "waiting for line to clear (select/%d ms), read: ", waittime * 100 ); while( wait_for_input( fd, waittime * 100 ) && read( fd, buffer, 1 ) > 0 && bytes < 10000 ) { if ( ++bytes < 500 ) lputc( L_NOISE, buffer[0] ); } #else TIO tio, save_tio; lprintf( L_NOISE, "waiting for line to clear (VTIME=%d), read: ", waittime); /* set terminal timeout to "waittime" tenth of a second */ tio_get( fd, &tio ); save_tio = tio; /*!! FIXME - sgtty?! */ tio.c_lflag &= ~ICANON; tio.c_cc[VMIN] = 0; tio.c_cc[VTIME] = waittime; tio_set( fd, &tio ); /* read everything that comes from modem until a timeout occurs */ while ( read( fd, buffer, 1 ) > 0 && bytes < 10000 ) { if ( ++bytes < 500 ) lputc( L_NOISE, buffer[0] ); } /* reset terminal settings */ tio_set( fd, &save_tio ); #endif if ( bytes > 500 ) lprintf( L_WARN, "clean_line: only 500 of %d bytes logged", bytes ); if ( bytes >= 10000 ) { extern char * Device; lprintf( L_FATAL, "clean_line: got too much junk (dev=%s).", Device ); } return 0; } mgetty-1.2.1/cnd.c000066400000000000000000000214161334553713100137450ustar00rootroot00000000000000#ident "@(#)cnd.c $Id: cnd.c,v 4.28 2018/03/06 11:39:25 gert Exp $ Copyright (c) 1993 Gert Doering/Chris Lewis" #include #include #include #include #include "syslibs.h" #include "policy.h" #include "mgetty.h" #include "config.h" extern char * Device; /* mgetty.c */ char *Connect = ""; char *CallerId = "none"; char *CallTime = ""; char *CallName = ""; char *CalledNr = ""; /* dialed number [ISDN MSN] */ /* the next few are for Rockwell */ char *CallDate = ""; char *CallMsg1 = ""; char *CallMsg2 = ""; /* those are for Rockwell "CONNECT" messages */ static char * cnd_carrier = ""; static char * cnd_protocol= ""; struct cndtable { char *string; char **variable; }; struct cndtable cndtable[] = { /* for the ELSA MicroLink/TLV.34: "RING;08912345;08765, ATS153=6 */ {"RING;", &CallerId}, {"RING"}, /* speedups */ {"OK"}, /* speedups */ {"CONNECT ", &Connect}, /* ZyXEL 1496 */ {"CALLER NAME: ", &CallName}, {"CALLER NUMBER: ", &CallerId}, {"TIME: ", &CallTime}, {"REASON FOR NO CALLER NUMBER: ", &CallerId}, {"REASON FOR NO CALLER NAME: ", &CallName}, /* isdn4linux (2.4.10 or patched) - Jan Oberlaender, mindriot@gmx.net */ {"CALLED NUMBER: ", &CalledNr}, /* for the ZyXEL 2864(D)I: "FM:xxx TO:yyy" */ {"FM:", &CallerId}, /* those are for rockwell-based modems insisting on a multi-line message "CARRIER ... / PROTOCOL ... / CONNECT" */ {"CARRIER ", &cnd_carrier}, {"PROTOCOL: ", &cnd_protocol}, /* ELSA does it similarily (if AT+MR=1 is set) */ {"+MCR: ", &cnd_carrier}, {"+MRR: ", &cnd_protocol}, /* those are for Rockwell Caller ID */ {"DATE = ", &CallDate}, {"TIME = ", &CallTime}, {"NMBR = ", &CallerId}, {"NAME = ", &CallName}, {"MESG = ", &CallMsg1}, {"MESG = ", &CallMsg2}, /* some Rockwell chips intro the Caller ID as follows */ /* (contributed by Edmund Bacon, ebacon@onesystem.com) */ {"DDN_NMBR= ", &CallerId}, /* The Digi DataFire RAS reports this different again... */ /* (reported by Akiko Takahashi ) */ /* also for the Zoom 2949L, K C Yuen */ /* also used by ELSA MicroLink Office */ {"DATE=", &CallDate}, {"TIME=", &CallTime}, {"NMBR=", &CallerId}, {"NAME=", &CallName}, /* Digi DataFire RAS / Patton 2977 can also report dialed number */ /* (if AT#CID=10 is set, contributed by Edwin Groothuis) */ {"NDID=", &CalledNr}, /* yet another incompatible modem... */ {"CALLER'S NUMBER: ", &CallerId}, /* Kortex Adaptix 56000 (Quercia Michel, quercia@cal.enst.fr) */ {"NBR=", &CallerId}, /* Russian USR Courier V.everything hackware, Alexey Promokhov */ {"CallerID: ", &CallerId}, /* Swedish Telia/ZyXEL Omni 52k - Torulf Lundgren, torulf@upsys.se */ {"Diverting number:", &CallerId}, /* FALCOM A2D gsm modem - Andreas Barth, debian bug */ {"+CLIP: ", &CallerId}, {NULL} }; void cndfind _P1((str), char *str) { struct cndtable *cp; register int len; register char *p; /* strip off blanks */ while (*str && isspace( (uch)*str )) str++; p = str + strlen(str) - 1; while(p >= str && isspace( (uch)*p )) *p-- = '\0'; lprintf(L_JUNK, "CND: %s", str); /* The ELINK 301 ISDN modem can send us the caller ID if it is asked for it with AT\O. The CID will simply get sent on a single line consisting only of digits. So, if we get a line starting with a digit, let's assume that it's the CID... */ if ( isdigit( (uch)*str ) ) { CallerId = p = strdup(str); while( isdigit( (uch)*p ) ) p++; *p = 0; lprintf( L_NOISE, "CND: ELink caller ID: '%s'", CallerId ); return; } for (cp = cndtable; cp->string; cp++) { len = strlen(cp->string); if (strncmp(cp->string, str, len) == 0) { if (!cp->variable) return; /* special case: Rockwell sends *two* MESG=... lines */ if (cp->variable == &CallMsg1 && CallMsg1[0] != 0) continue; /* special case for CONNECT on Rockwell-Based modems */ if ( ( cnd_carrier[0] != 0 || cnd_protocol[0] != 0 ) && strncmp( str, "CONNECT ", 8 ) == 0 ) { *(cp->variable) = malloc( strlen(str) - len + strlen( cnd_carrier ) + strlen( cnd_protocol ) + 5 ); sprintf( *(cp->variable), "%s/%s %s", str+len, cnd_carrier, cnd_protocol ); } else /* normal case */ { *(cp->variable) = p = malloc(strlen(str) - len + 1); (void) strcpy(*(cp->variable), str+len); /* nuke quotes and non-printable characters (some of this * stuff is passed to shell commands and environment vars) */ while( *p != '\0' ) { if ( *p == '\'' || *p == '\"' || !isprint( (uch)*p ) ) *p = ' '; p++; } } lprintf(L_NOISE, "CND: found: %s", *(cp->variable)); return; } } } /* process Rockwell-style caller ID. Weird */ void process_rockwell_mesg _P0 (void) { int length = 0; int loop; char *p; /* In Canada, Bell Canada has come up with a fairly odd method of encoding the caller_id into MESG fields. With Supra caller ID (Rockwell), these come out as follows: MESG = 030735353531323132 The first two bytes seem to mean nothing. The second two bytes are a hex number representing the phone number length. The phone number begins with the digit 3, then each digit of the phone number. Each digit of the phone number is preceeded by the character '3'. NB: I'm not sure whether this is Bell's or Rockwell's folly. I'd prefer to blaim Rockwell. gert */ if ( CallMsg1[0] == 0) return; if ( (CallMsg1[0] != '0') || (CallMsg1[1] != '3')) return; /* Get the length of the number */ CallMsg1[4] = '\0'; sscanf( &CallMsg1[2], "%x", &length); lprintf(L_JUNK, "CND: number length: %d",length); /* Allocate space for the new number */ p = CallerId = malloc(length + 1); /* Get the phone number only and put it into CallerId */ for (loop = 5; loop <= (3 + length*2); loop += 2) { *p = CallMsg1[loop]; p++; } *p = 0; lprintf(L_NOISE, "CND: caller ID: %s", CallerId); } /* lookup Caller ID in CNDFILE, decide upon answering or not */ int cndlookup _P0 (void) { int match = 1; #ifdef CNDFILE FILE *cndfile; char buf[BUFSIZ]; cndfile = fopen( makepath( CNDFILE, CONFDIR ), "r"); if ( cndfile == NULL ) return(1); process_rockwell_mesg(); /* parse ugly rockwell msg */ lprintf(L_JUNK, "CND: check no: '%s'", CallerId ); while (fgets(buf, sizeof(buf), cndfile)) { register char *p = buf, *p2; while(isspace(*p)) p++; if (*p == '#' || *p == '\n') continue; while( (p2 = strtok(p, " \t\n,")) != NULL ) { match = (*p2 != '!'); if (!match) p2++; lprintf(L_JUNK, "CND: check vs: %s", p2); if (strcmp(p2, "all") == 0) goto leave; if (strncmp(p2, CallerId, strlen(p2)) == 0) goto leave; p = NULL; } } match = 1; leave: fclose(cndfile); #endif return(match); } /* check Caller ID via external program call */ int cnd_call _P3((name, tty, dist_ring), char * name, char * tty, int dist_ring ) { char * program; int rc; program = malloc( strlen(name) + strlen(tty) + strlen( CallerId ) + strlen( CalledNr ) + strlen( CallName ) + sizeof( CONSOLE ) + 50 ); if ( program == NULL ) { lprintf( L_ERROR, "cnd_call: can't malloc" ); return 0; } sprintf( program, "%s %s '%s' '%s' %d '%s' >%s 2>&1 >8; } /* set_env_var( var, string ) * * create an environment entry "VAR=string" */ void set_env_var _P2( (var,string), char * var, char * string ) { char * v; v = malloc( strlen(var) + strlen(string) + 2 ); if ( v == NULL ) lprintf( L_ERROR, "set_env_var: cannot malloc" ); else { sprintf( v, "%s=%s", var, string ); lprintf( L_NOISE, "setenv: '%s'", v ); if ( putenv( v ) != 0 ) lprintf( L_ERROR, "putenv failed" ); } } void setup_environment _P0(void) { if ( *CallerId ) set_env_var( "CALLER_ID", CallerId ); if ( *CallDate ) set_env_var( "CALL_DATE", CallDate ); if ( *CallTime ) set_env_var( "CALL_TIME", CallTime ); if ( *CallName ) set_env_var( "CALLER_NAME", CallName ); if ( *CalledNr ) set_env_var( "CALLED_ID", CalledNr ); set_env_var( "CONNECT", Connect ); set_env_var( "DEVICE", Device ); } mgetty-1.2.1/compat/000077500000000000000000000000001334553713100143145ustar00rootroot00000000000000mgetty-1.2.1/compat/.files000066400000000000000000000000341334553713100154140ustar00rootroot00000000000000mg.echo.c newslock.c README mgetty-1.2.1/compat/README000066400000000000000000000006331334553713100151760ustar00rootroot00000000000000In this directory (mgetty/compat) you'll find various programs that are needed to make mgetty+sendfax work on not-so-compatible platforms. mg.echo.c: a replacement for the SystemV echo program, which can do escape characters, taken from GNU shellutils 1.92 (modified). newslock.c: an "atomic test-and-set" link operation for files, to be called from shell scripts. Taken from C-News (unmodified). mgetty-1.2.1/compat/mg.echo.c000066400000000000000000000132301334553713100157770ustar00rootroot00000000000000/* echo.c * * taken from GNU shell utilities 1.9.2 * heavily modified by Gert Doering (configuration stuff dropped) */ /* echo.c, taken from Bash. Copyright (C) 1987, 1989, 1991, 1992 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. Bash 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. Bash 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 Bash; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include /* echo [-neE] [arg ...] Output the ARGs. If -n is specified, the trailing newline is suppressed. If the -e option is given, interpretation of the following backslash-escaped characters is turned on: \a alert (bell) \b backspace \c suppress trailing newline \f form feed \n new line \r carriage return \t horizontal tab \v vertical tab \\ backslash \num the character whose ASCII code is NUM (octal). You can explicitly turn off the interpretation of the above characters on System V systems with the -E option. */ /* If defined, interpret backslash escapes if -e is given. */ #define V9_ECHO /* If defined, interpret backslash escapes unless -E is given. V9_ECHO must also be defined. */ #define V9_DEFAULT #if defined (V9_ECHO) # if defined (V9_DEFAULT) # define VALID_ECHO_OPTIONS "neE" # else # define VALID_ECHO_OPTIONS "ne" # endif /* !V9_DEFAULT */ #else /* !V9_ECHO */ # define VALID_ECHO_OPTIONS "n" #endif /* !V9_ECHO */ /* The name this program was run with. */ char *program_name; static void usage (status) int status; { if (status != 0) fprintf (stderr, "Try `%s --help' for more information.\n", program_name); else { printf ("Usage: %s [OPTION]... [STRING]...\n", program_name); printf ("\ \n\ -n do not output the trailing newline\n\ -e (unused)\n\ -E disable interpolation of some sequences in STRINGs\n\ --help display this help and exit (should be alone)\n\ --version output version information and exit (should be alone)\n\ \n\ Without -E, the following sequences are recognized and interpolated:\n\ \n\ \\NNN the character whose ASCII code is NNN (octal)\n\ \\\\ backslash\n\ \\a alert (BEL)\n\ \\b backspace\n\ \\c suppress trailing newline\n\ \\f form feed\n\ \\n new line\n\ \\r carriage return\n\ \\t horizontal tab\n\ \\v vertical tab\n\ "); } exit (status); } /* Print the words in LIST to standard output. If the first word is `-n', then don't print a trailing newline. We also support the echo syntax from Version 9 unix systems. */ void main (argc, argv) int argc; char **argv; { int display_return = 1, do_v9 = 0; program_name = argv[0]; #if 0 parse_long_options (argc, argv, usage); #else if ( argc > 1 && strcmp( argv[1], "--help" ) == 0 ) usage(0); if ( argc > 1 && strcmp( argv[1], "--version" ) == 0 ) { printf( "GNU Echo 1.9.2 - hacked for mgetty\n" ); exit(0); } #endif /* System V machines already have a /bin/sh with a v9 behaviour. We use the identical behaviour for these machines so that the existing system shell scripts won't barf. */ #if defined (V9_ECHO) && defined (V9_DEFAULT) do_v9 = 1; #endif --argc; ++argv; while (argc > 0 && *argv[0] == '-') { register char *temp; register int i; /* If it appears that we are handling options, then make sure that all of the options specified are actually valid. Otherwise, the string should just be echoed. */ temp = argv[0] + 1; for (i = 0; temp[i]; i++) { if (strchr (VALID_ECHO_OPTIONS, temp[i]) == 0) goto just_echo; } if (!*temp) goto just_echo; /* All of the options in TEMP are valid options to ECHO. Handle them. */ while (*temp) { if (*temp == 'n') display_return = 0; #if defined (V9_ECHO) else if (*temp == 'e') do_v9 = 1; #if defined (V9_DEFAULT) else if (*temp == 'E') do_v9 = 0; #endif /* V9_DEFAULT */ #endif /* V9_ECHO */ else goto just_echo; temp++; } argc--; argv++; } just_echo: if (argc > 0) { #if defined (V9_ECHO) if (do_v9) { while (argc > 0) { register char *s = argv[0]; register int c; while ((c = *s++)) { if (c == '\\' && *s) { switch (c = *s++) { case 'a': c = '\007'; break; case 'b': c = '\b'; break; case 'c': display_return = 0; continue; case 'f': c = '\f'; break; case 'n': c = '\n'; break; case 'r': c = '\r'; break; case 't': c = '\t'; break; case 'v': c = (int) 0x0B; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': c -= '0'; if (*s >= '0' && *s <= '7') c = c * 8 + (*s++ - '0'); if (*s >= '0' && *s <= '7') c = c * 8 + (*s++ - '0'); break; case '\\': break; default: putchar ('\\'); break; } } putchar(c); } argc--; argv++; if (argc > 0) putchar(' '); } } else #endif /* V9_ECHO */ { while (argc > 0) { fputs (argv[0], stdout); argc--; argv++; if (argc > 0) putchar (' '); } } } if (display_return) putchar ('\n'); exit (0); } mgetty-1.2.1/compat/newslock.c000066400000000000000000000007621334553713100163120ustar00rootroot00000000000000/* * newslock - simple, unbroken version of ln(1) for shell-program locking * * (System V has broken ln(1) itself.) * * TAKEN UNMODIFIED FROM C-NEWS BY Geoffrey Collyer AND Henry Spencer */ #include #include #include #include int main(argc, argv) int argc; char *argv[]; { if (argc != 3) { fprintf(stderr, "Usage: %s tempname lockname\n", argv[0]); exit(2); } if (link(argv[1], argv[2]) < 0) exit(1); else exit(0); /* NOTREACHED */ } mgetty-1.2.1/conf_mg.c000066400000000000000000000245201334553713100146100ustar00rootroot00000000000000#ident "$Id: conf_mg.c,v 4.22 2018/03/06 11:39:25 gert Exp $ Copyright (c) Gert Doering" /* conf_mg.c * * configuration defaults / configuration reading code for mgetty * * $Log: conf_mg.c,v $ * Revision 4.22 2018/03/06 11:39:25 gert * Alex Manoussakis: cid-program patch set * * Revision 4.21 2018/03/05 18:34:05 gert * Add new config option "open-delay " (same thing as for sendfax) * * Feature wish from Marc Daniel Fege , needed on some ELSAs * * Revision 4.20 2010/09/14 15:38:27 gert * add CVS log * add options for SMS processing - sms-handler, sms-handler-{user,group} * */ #include #include #include #include "mgetty.h" #include "policy.h" #include "syslibs.h" #include "tio.h" #include "config.h" #include "conf_mg.h" #include "version.h" char * mgetty_version = VERSION_LONG; /* version.h */ #ifndef MODEM_CHECK_TIME # define MODEM_CHECK_TIME -1 /* no check */ #endif #ifndef FAX_RECV_SWITCHBD #define FAX_RECV_SWITCHBD 0 /* no switching */ #endif #ifndef FAX_FILE_MODE #define FAX_FILE_MODE -1 /* controlled by umask */ #endif /* initialize the modem - MODEM_INIT_STRING defined in policy.h */ static char * def_init_chat_seq[] = { "", "\\dATQ0V1H0", "OK", MODEM_INIT_STRING, "OK", NULL }; /* "force init" the modem (DLE ETX for voice modems, +++ATH0 for all others) */ static char * def_force_init_chat_seq[] = { "", "\\d\020\03\\d\\d\\d+++\\d\\d\\d\r\\dATQ0V1H0", "OK", NULL }; /* default way to answer the phone... */ static char * def_answer_chat_seq[] = { "", "ATA", "CONNECT", "\\c", "\n", NULL }; /* this is the default configuration... */ struct conf_data_mgetty c = { { "speed", {DEFAULT_PORTSPEED}, CT_INT, C_PRESET }, { "switchbd", {FAX_RECV_SWITCHBD}, CT_INT, C_PRESET }, { "direct", {FALSE}, CT_BOOL, C_PRESET }, { "blocking", {FALSE}, CT_BOOL, C_PRESET }, { "port-owner", {(p_int) DEVICE_OWNER}, CT_STRING, C_PRESET }, #ifdef DEVICE_GROUP { "port-group", {(p_int) DEVICE_GROUP}, CT_STRING, C_PRESET }, #else { "port-group", {0}, CT_STRING, C_EMPTY }, #endif { "port-mode", {FILE_MODE}, CT_INT, C_PRESET }, { "toggle-dtr", {TRUE}, CT_BOOL, C_PRESET }, { "toggle-dtr-waittime", {500}, CT_INT, C_PRESET }, { "open-delay", {0}, CT_INT, C_EMPTY }, { "need-dsr", {FALSE}, CT_BOOL, C_PRESET }, { "data-only", {FALSE}, CT_BOOL, C_PRESET }, { "fax-only", {FALSE}, CT_BOOL, C_PRESET }, { "modem-type", {(p_int) DEFAULT_MODEMTYPE}, CT_STRING, C_PRESET }, { "modem-quirks", {0}, CT_INT, C_EMPTY }, { "init-chat", {0}, CT_CHAT, C_EMPTY }, { "force-init-chat", {0}, CT_CHAT, C_EMPTY }, { "post-init-chat", {0}, CT_CHAT, C_EMPTY }, { "data-flow", {DATA_FLOW}, CT_FLOWL, C_PRESET }, { "fax-send-flow", {FAXSEND_FLOW}, CT_FLOWL, C_PRESET }, { "fax-rec-flow", {FAXREC_FLOW}, CT_FLOWL, C_PRESET }, { "modem-check-time", {MODEM_CHECK_TIME}, CT_INT, C_PRESET }, { "rings", {1}, CT_INT, C_PRESET }, { "msn-list", {(p_int) NULL}, CT_CHAT, C_EMPTY }, { "get-cnd-chat", {0}, CT_CHAT, C_EMPTY }, { "cid-program", {(p_int) NULL}, CT_STRING, C_EMPTY }, { "cnd-program", {(p_int) NULL}, CT_STRING, C_EMPTY }, { "answer-chat", {0}, CT_CHAT, C_EMPTY }, { "answer-chat-timeout", {80}, CT_INT, C_PRESET }, { "autobauding", {FALSE}, CT_BOOL, C_PRESET }, { "ringback", {FALSE}, CT_BOOL, C_PRESET }, { "ringback-time", {30}, CT_INT, C_PRESET }, { "ignore-carrier", {FALSE}, CT_BOOL, C_PRESET }, { "issue-file", {(p_int)"/etc/issue"}, CT_STRING, C_PRESET }, { "prompt-waittime", {500}, CT_INT, C_PRESET }, { "login-prompt", {(p_int) LOGIN_PROMPT}, CT_STRING, C_PRESET }, #ifdef MAX_LOGIN_TIME { "login-time", {MAX_LOGIN_TIME}, CT_INT, C_PRESET }, #else { "login-time", {0}, CT_INT, C_EMPTY }, #endif { "fido-send-emsi", {TRUE}, CT_BOOL, C_PRESET }, { "login-env-ttyprompt-hack", {FALSE}, CT_BOOL, C_PRESET }, #ifdef LOGIN_CFG_FILE { "login-conf-file", {(p_int) LOGIN_CFG_FILE}, CT_STRING, C_PRESET }, #else { "login-conf-file", {0}, CT_STRING, C_EMPTY }, #endif { "fax-id", {(p_int)FAX_STATION_ID}, CT_STRING, C_PRESET }, { "fax-min-speed", {0}, CT_INT, C_PRESET }, { "fax-max-speed", {14400}, CT_INT, C_PRESET }, { "fax-server-file", {0}, CT_STRING, C_EMPTY }, { "diskspace", {MINFREESPACE}, CT_INT, C_PRESET }, #ifdef MAIL_TO { "notify", {(p_int)MAIL_TO}, CT_STRING, C_PRESET }, #else { "notify", {0}, CT_STRING, C_EMPTY }, #endif { "fax-owner", {(p_int)FAX_IN_OWNER}, CT_STRING, C_PRESET }, #ifdef FAX_IN_GROUP { "fax-group", {(p_int)FAX_IN_GROUP}, CT_STRING, C_PRESET }, #else { "fax-group", {0}, CT_STRING, C_EMPTY }, #endif { "fax-mode", {FAX_FILE_MODE}, CT_INT, C_PRESET }, #ifdef __STDC__ { "fax-spool-in", {(p_int) FAX_SPOOL_IN ":/tmp"}, CT_STRING, C_PRESET }, #else { "fax-spool-in", {(p_int) FAX_SPOOL_IN}, CT_STRING, C_PRESET }, #endif { "debug", {LOG_LEVEL}, CT_INT, C_PRESET }, { "statistics-chat", {0}, CT_CHAT, C_EMPTY }, { "statistics-file", {0}, CT_STRING, C_EMPTY }, { "gettydefs", {(p_int)GETTYDEFS_DEFAULT_TAG}, CT_STRING, C_PRESET }, { "term", {0}, CT_STRING, C_EMPTY }, #ifdef SMS { "sms-handler", {0}, CT_STRING, C_EMPTY }, { "sms-handler-user", {(p_int) "nobody"}, CT_STRING, C_PRESET }, { "sms-handler-group", {0}, CT_STRING, C_EMPTY }, #endif { NULL, {0}, CT_STRING, C_EMPTY }}; /* * exit_usage() - exit with usage display */ void exit_usage _P1((code), int code ) { #ifdef USE_GETTYDEFS lprintf( L_FATAL, "Usage: mgetty [-x debug] [-s speed] [-r] line [gettydefentry]" ); #else lprintf( L_FATAL, "Usage: mgetty [-x debug] [-s speed] [-r] line" ); #endif exit(code); } int mgetty_parse_args _P2( (argc,argv), int argc, char ** argv ) { int opt; #ifdef USE_GETTYDEFS extern boolean verbose; #endif /* sanity check: * make sure that structs-in-struct can be handled exactly as if * packed in array (get_config relies on it!) */ conf_data c_a[2]; if ( ( (char *)&c_a[1] - (char *)&c_a[0] ) != ( (char *)&c.switchbd - (char *)&c.speed ) ) { fprintf( stderr, "ERROR: config table size mixup. contact author\n" ); exit(99); } /* initialize a few things that can't be done statically */ c.init_chat.d.p = (void *) def_init_chat_seq; c.init_chat.flags = C_PRESET; c.force_init_chat.d.p = (void *) def_force_init_chat_seq; c.force_init_chat.flags = C_PRESET; c.answer_chat.d.p = (void *) def_answer_chat_seq; c.answer_chat.flags = C_PRESET; /* get command line arguments */ /* some magic done by the command's name */ if ( strcmp( get_basename( argv[0] ), "getty" ) == 0 ) { conf_set_bool( &c.blocking, TRUE ); conf_set_bool( &c.direct_line, TRUE ); } while ((opt = getopt(argc, argv, "c:x:s:rp:n:R:i:DC:FS:k:m:I:baV")) != EOF) { switch (opt) { case 'c': /* check */ #ifdef USE_GETTYDEFS verbose = TRUE; dumpgettydefs(optarg); exit(0); #else lprintf( L_FATAL, "gettydefs not supported\n"); exit_usage(2); #endif case 'k': /* kbytes free on disk */ conf_set_int( &c.diskspace, atol(optarg) ); break; case 'x': /* log level */ conf_set_int( &c.debug, atoi(optarg) ); log_set_llevel( c_int(debug) ); break; case 's': /* port speed */ conf_set_int( &c.speed, atoi(optarg) ); break; case 'r': /* direct line (nullmodem) */ conf_set_int( &c.direct_line, TRUE ); break; case 'p': /* login prompt */ conf_set_string( &c.login_prompt, optarg ); break; case 'n': /* ring counter */ conf_set_int( &c.rings_wanted, atoi(optarg) ); break; case 'R': /* ringback timer */ conf_set_bool( &c.ringback, TRUE ); conf_set_int( &c.ringback_time, atoi(optarg) ); break; case 'i': /* use different issue file */ conf_set_string( &c.issue_file, optarg ); break; case 'D': /* switch off fax */ conf_set_bool( &c.data_only, TRUE ); break; case 'F': /* switch off data-mode (security!) */ conf_set_bool( &c.fax_only, TRUE ); break; case 'C': /* set modem mode (fax/data) */ conf_set_string( &c.modem_type, optarg ); break; case 'S': /* fax poll file to send */ conf_set_string( &c.fax_server_file, optarg ); break; case 'I': /* local station ID */ conf_set_string( &c.station_id, optarg); break; case 'b': /* open port in blocking mode */ conf_set_bool( &c.blocking, TRUE ); break; case 'a': /* autobauding */ conf_set_bool( &c.autobauding, TRUE ); break; case 'm': /* modem init sequence */ c.init_chat.flags = C_OVERRIDE; c.init_chat.d.p = conf_get_chat( optarg ); break; case 'V': /* show version number */ printf("\nmgetty+sendfax by Gert Doering\n%s\n\n", mgetty_version); printf("log file written to '"); printf(LOG_PATH, ""); #ifdef MGETTY_CONFIG printf("'\nconfig file read from '%s", makepath( MGETTY_CONFIG, CONFDIR )); #endif printf("'\n\n"); exit(0); case '?': exit_usage(2); break; } } return NOERROR; } /* get mgetty configuration from file (if configured) */ void mgetty_get_config _P1( (port), char * port ) { #ifdef MGETTY_CONFIG lprintf( L_NOISE, "reading configuration data for port '%s'", port ); get_config( makepath( MGETTY_CONFIG, CONFDIR ), (conf_data *)&c, "port", port ); #else lprintf( L_NOISE, "not reading config file, not configured" ); #endif /* tell log subsystem about new log level */ log_set_llevel( c_int(debug) ); /* tell getdisk.c about desired disk space (in kbytes) */ minfreespace = c_int(diskspace); /* sanity checks */ if ( tio_check_speed( c_int(speed) ) < 0 ) { lprintf( L_FATAL, "invalid port speed: %d", c_int(speed)); exit_usage(2); } if ( c_isset(switchbd) && c_int(switchbd) != 0 && !c_bool(data_only) && tio_check_speed( c_int(switchbd) ) < 0 ) { lprintf( L_FATAL, "invalid fax reception switch speed: %d", c_int(switchbd) ); exit_usage(2); } if ( c_int(rings_wanted) == 0 ) conf_set_int( &c.rings_wanted, 1 ); if ( c_int(ringback_time) < 30 ) conf_set_int( &c.ringback_time, 30); if ( c_int(modem_check_time) >= 0 && c_int(modem_check_time) < 900 ) { lprintf( L_NOISE, "increasing modem_check_time to 900 sec." ); conf_set_int( &c.modem_check_time, 900 ); } if ( c_isset(modem_quirks) ) { lprintf( L_NOISE, "set modem_quirks: 0x%04x", c_int(modem_quirks)); modem_quirks = c_int(modem_quirks); } } mgetty-1.2.1/conf_mg.h000066400000000000000000000062421334553713100146160ustar00rootroot00000000000000#ident "$Id: conf_mg.h,v 4.14 2018/03/06 11:39:25 gert Exp $ Copyright (c) 1994 Gert Doering" /* all (dynamic) mgetty configuration is contained in this structure. * It is initialized and loaded in conf_mg.c and accessed from mgetty.c * * $Log: conf_mg.h,v $ * Revision 4.14 2018/03/06 11:39:25 gert * Alex Manoussakis: cid-program patch set * * Revision 4.13 2018/03/05 18:34:05 gert * Add new config option "open-delay " (same thing as for sendfax) * * Feature wish from Marc Daniel Fege , needed on some ELSAs * * Revision 4.12 2010/09/14 15:38:27 gert * add CVS log * add options for SMS processing - sms-handler, sms-handler-{user,group} * */ extern struct conf_data_mgetty { struct conf_data speed, /* port speed */ switchbd, /* speed switch for fax rec.*/ direct_line, /* direct lines */ blocking, /* do blocking open */ port_owner, /* "uucp" */ port_group, /* "modem" */ port_mode, /* "660" */ toggle_dtr, /* toggle DTR for modem reset */ toggle_dtr_waittime, /* time to hold DTR low */ open_delay, /* time time to wait for draining */ need_dsr, /* wait for DSR+CTS */ data_only, /* no fax */ fax_only, /* no data */ modem_type, /* auto/c2.0/cls2/data */ modem_quirks, /* strange behaviourisms */ init_chat, /* modem initialization */ force_init_chat, /* for stubborn modems */ post_init_chat, /* for forgetful modems */ data_flow, /* flow ctl. in data mode */ fax_send_flow, /* '' in fax rec mode */ fax_rec_flow, /* '' in fax send mode */ modem_check_time, /* modem still alive? */ rings_wanted, /* number of RINGs */ msn_list, /* ISDN MSNs (dist.ring) */ getcnd_chat, /* get caller ID (for ELINK)*/ cid_program, /* notify about caller ID */ cnd_program, /* accept caller? */ answer_chat, /* ATA...CONNECT...""...\n */ answer_chat_timeout, /* longer as S7! */ autobauding, ringback, /* ringback enabled */ ringback_time, /* ringback time */ ignore_carrier, /* do not clear CLOCAL */ issue_file, /* /etc/issue file */ prompt_waittime, /* ms wait before prompting */ login_prompt, login_time, /* max. time to log in */ do_send_emsi, /* send EMSI_REQ string */ env_ttyprompt, /* suppress login prompt */ login_config, /* login.config file name */ station_id, /* local fax station ID */ fax_min_speed, /* minimum fax speed */ fax_max_speed, /* maximum fax sped */ fax_server_file, /* fax to send upon poll */ diskspace, /* min. free disk space */ notify_mail, /* fax mail goes to... */ fax_owner, /* "fax" */ fax_group, /* "staff" */ fax_mode, /* "660" */ fax_spool_in, /* "/var/fax/inc:/tmp" */ debug, /* log level */ statistics_chat, /* get some call statist. */ statistics_file, /* default: log file */ gettydefs_tag, termtype, /* $TERM=... */ #ifdef SMS sms_handler, /* sms handler program */ sms_handler_user, /* sms handler program */ sms_handler_group, /* sms handler program */ #endif end_of_config; } c; int mgetty_parse_args _PROTO(( int argc, char ** argv )); void mgetty_get_config _PROTO(( char * port )); mgetty-1.2.1/conf_sf.c000066400000000000000000000137241334553713100146210ustar00rootroot00000000000000#ident "$Id: conf_sf.c,v 4.16 2010/09/17 15:27:04 gert Exp $ Copyright (c) Gert Doering" /* conf_sf.c * * configuration defaults / configuration reading code for sendfax * * $Log: conf_sf.c,v $ * Revision 4.16 2010/09/17 15:27:04 gert * add CVS log tags * */ #include #include #include #include "mgetty.h" #include "policy.h" #include "syslibs.h" #include "config.h" #include "conf_sf.h" #include "version.h" char * mgetty_version = VERSION_LONG; /* version.h */ #ifndef FAX_SEND_MAX_TRIES #define FAX_SEND_MAX_TRIES 0 #endif #ifndef FAX_SEND_SWITCHBD #define FAX_SEND_SWITCHBD 0 #endif struct conf_data_sendfax c = { { "fax-devices", {0}, CT_STRING, C_EMPTY }, { "fax-devices", {0}, CT_STRING, C_IGNORE }, { "modem-init", {0}, CT_STRING, C_EMPTY }, #ifdef FAX_MODEM_HANDSHAKE { "modem-handshake", {(p_int) FAX_MODEM_HANDSHAKE}, CT_STRING, C_PRESET }, #else { "modem-handshake", {0}, CT_STRING, C_EMPTY }, #endif { "modem-type", {(p_int) DEFAULT_MODEMTYPE}, CT_STRING, C_PRESET }, { "modem-quirks", {0}, CT_INT, C_EMPTY }, { "reset-after-fail", {0}, CT_STRING, C_EMPTY }, { "fax-send-flow", {FAXSEND_FLOW}, CT_FLOWL, C_PRESET }, { "fax-rec-flow", {FAXREC_FLOW}, CT_FLOWL, C_PRESET }, { "max-tries", {FAX_SEND_MAX_TRIES}, CT_INT, C_PRESET }, { "max-tries-continue", {TRUE}, CT_BOOL, C_PRESET }, { "speed", {FAX_SEND_BAUD}, CT_INT, C_PRESET }, { "switchbd", {FAX_SEND_SWITCHBD}, CT_INT, C_PRESET }, { "open-delay", {0}, CT_INT, C_EMPTY }, { "ignore-carrier", {TRUE }, CT_BOOL, C_PRESET }, { "dial-prefix", {(p_int) FAX_DIAL_PREFIX}, CT_STRING, C_PRESET }, { "fax-id", {(p_int)FAX_STATION_ID}, CT_STRING, C_PRESET }, { "poll-dir", {(p_int)"."}, CT_STRING, C_PRESET }, { "normal-res", {0}, CT_BOOL, C_PRESET }, { "fax-min-speed", {0}, CT_INT, C_PRESET }, { "fax-max-speed", {14400}, CT_INT, C_PRESET }, { "debug", {LOG_LEVEL}, CT_INT, C_PRESET }, { "verbose", {FALSE}, CT_BOOL, C_PRESET }, { "" /* polling */, {FALSE}, CT_BOOL, C_PRESET }, { "page-header", {0}, CT_STRING, C_EMPTY }, { "" /* stdin */, {FALSE}, CT_BOOL, C_PRESET }, { "" /* rename */, {FALSE}, CT_BOOL, C_PRESET }, { "" /* acct_handle */, {(p_int)""}, CT_STRING, C_PRESET }, { NULL, {0}, CT_STRING, C_EMPTY }}; int sendfax_parse_args _P2( (argc,argv), int argc, char ** argv ) { int opt; char * p; /* sanity check: * make sure that structs-in-struct can be handled exactly as if * packed in array (get_config relies on it!) */ conf_data c_a[2]; if ( ( (char *)&c_a[1] - (char *)&c_a[0] ) != ( (char *)&c.ttys_0 - (char *)&c.ttys ) ) { fprintf( stderr, "ERROR: config table size mixup. contact author\n" ); exit(99); } /* since "ttys" has to be writable, we strdup() the default string */ p = malloc( sizeof( FAX_MODEM_TTYS )+1 ); if ( p == NULL ) c.ttys.flags = C_EMPTY; else { strcpy( p, FAX_MODEM_TTYS ); c.ttys.d.p = p; c.ttys.flags = C_CONF; } /* get command line arguments */ while ((opt = getopt(argc, argv, "d:vx:ph:l:nm:SC:I:rA:D:M:R:V")) != EOF) { switch (opt) { case 'd': /* set target directory for polling */ conf_set_string( &c.poll_dir, optarg ); break; case 'v': /* verbose blurb on stdout */ conf_set_bool( &c.verbose, TRUE ); break; case 'x': /* set debug level */ conf_set_int( &c.debug, atoi(optarg) ); log_set_llevel( c_int(debug) ); break; case 'p': /* activate poll receive */ conf_set_int( &c.fax_poll_wanted, TRUE ); break; case 'h': /* set header page */ conf_set_string( &c.fax_page_header, optarg ); break; case 'l': /* set device(s) to use */ if ( optarg[0] == '/' && strncmp( optarg, "/dev/", 5 ) != 0 ) { fprintf( stderr, "%s: -l: device must be located in /dev!\n", argv[0]); exit(1); } conf_set_string( &c.ttys, optarg ); break; case 'n': /* set normal resolution */ conf_set_bool( &c.normal_res, TRUE ); break; case 'm': /* modem initialization string */ conf_set_string( &c.modem_init, optarg ); break; case 'S': /* modem on stdin */ conf_set_bool( &c.use_stdin, TRUE ); break; case 'C': /* modem class */ conf_set_string( &c.modem_type, optarg ); break; case 'I': /* local fax id */ conf_set_string( &c.station_id, optarg ); break; case 'r': conf_set_bool( &c.rename_files, TRUE ); break; case 'A': conf_set_string( &c.acct_handle, optarg ); break; case 'D': conf_set_string( &c.dial_prefix, optarg ); break; case 'M': /* set max. fax speed */ conf_set_int( &c.fax_max_speed, atoi(optarg) ); break; case 'R': /* retries */ conf_set_int( &c.max_tries, atoi(optarg) ); break; case 'V': printf("\nmgetty+sendfax by Gert Doering\n%s\n\n", mgetty_version); printf("log file written to '%s'\n", FAX_LOG ); #ifdef SENDFAX_CONFIG printf("config file read from '%s'\n\n", makepath( SENDFAX_CONFIG, CONFDIR )); #endif exit(0); case '?': /* unrecognized parameter */ return ERROR; break; } } return NOERROR; } /* get sendfax configuration from file (if configured) * * if "port == NULL", read "fax-devices" (c.tty), if != NULL, skip * c.tty (because it woudln't make sense to set it, and would break * fax_open()) */ void sendfax_get_config _P1( (port), char * port ) { #ifdef SENDFAX_CONFIG if ( port == NULL ) { lprintf( L_NOISE, "reading default configuration" ); get_config( makepath( SENDFAX_CONFIG, CONFDIR ), (conf_data *)&c, "port", NULL ); } else { lprintf( L_NOISE, "reading specific data for port '%s'", port ); get_config( makepath( SENDFAX_CONFIG, CONFDIR ), ((conf_data *)&c)+1, "port", port ); } #else lprintf( L_NOISE, "not reading config file, not configured" ); #endif log_set_llevel( c_int(debug) ); if ( c_isset(modem_quirks) ) { lprintf( L_NOISE, "set modem_quirks: 0x%04x", c_int(modem_quirks)); modem_quirks = c_int(modem_quirks); } } mgetty-1.2.1/conf_sf.h000066400000000000000000000020111334553713100146110ustar00rootroot00000000000000#ident "$Id: conf_sf.h,v 4.7 2010/09/17 15:27:04 gert Exp $ Copyright (c) 1994 Gert Doering" /* all (dynamic) sendfax configuration is contained in this structure. * It is initialized and loaded in conf_sf.c and accessed from sendfax.c * * $Log: conf_sf.h,v $ * Revision 4.7 2010/09/17 15:27:04 gert * add CVS log tags * */ extern struct conf_data_sendfax { struct conf_data ttys, ttys_0, /* for "ignore" */ modem_init, modem_handshake, modem_type, modem_quirks, reset_after_fail, fax_send_flow, fax_rec_flow, max_tries, max_tries_ctd, speed, switchbd, open_delay, ignore_carrier, dial_prefix, station_id, poll_dir, normal_res, fax_min_speed, fax_max_speed, debug, verbose, fax_poll_wanted, /* cli only (-p) */ fax_page_header, use_stdin, /* cli only (-S) */ rename_files, /* cli only (-r) */ acct_handle, /* cli only (-A) */ end_of_config; } c; int sendfax_parse_args _PROTO(( int argc, char ** argv )); void sendfax_get_config _PROTO(( char * port )); mgetty-1.2.1/config.c000066400000000000000000000245421334553713100144510ustar00rootroot00000000000000#ident "$Id: config.c,v 4.8 2014/02/02 13:06:24 gert Exp $ Copyright (c) 1993 Gert Doering" /* * config.c * * This module is part of the mgetty kit - see LICENSE for details * * Read and parse config file(s), see conf_*.[ch] for example use */ #include #include "syslibs.h" #include #include #ifndef ENOENT #include #endif #include "mgetty.h" #include "config.h" /* read a line from FILE * fp, terminated by "\n" * the line can be of any length (buffer will dynamically grow) * - trailing "\n" is chopped off * - continuation lines (trailing "\") will automatically be put together * - comment lines (leading "#") will be skipped */ char * fgetline _P1((fp), FILE * fp ) { static int bufsz = 0; static char * bufp = NULL; int bufidx; char * p; if ( bufp == NULL ) { if ( ( bufp = malloc( bufsz = 1024 ) ) == NULL ) { lprintf( L_ERROR, "fgetline: cannot allocate memory" ); return NULL; } } bufidx = 0; while ( TRUE ) { p = fgets( &bufp[ bufidx ], bufsz-bufidx, fp ); if ( p == NULL ) /* nothing more to read */ { if ( bufidx == 0 ) { free( bufp ); bufp = NULL; bufsz = 0; return NULL; } else break; } /* continuation lines? Buffer overflow? */ bufidx += strlen( &bufp[ bufidx ] ); /* discard trailing '\n' */ if ( bufidx > 0 && bufp[ bufidx-1 ] == '\n' ) bufp[ --bufidx ] = 0; /* buffer full */ if ( bufidx == bufsz-1 ) { lprintf( L_NOISE, "realloc line" ); if ( ( p = realloc( bufp, bufsz += 1024 ) ) == NULL ) { free( bufp ); bufp = NULL; bufsz = 0; lprintf( L_ERROR, "fgetline: cannot realloc" ); return NULL; } bufp = p; continue; } /* continuation lines */ if ( bufidx > 0 && bufp[ bufidx-1 ] == '\\' ) { bufidx--; continue; } /* comments */ if ( bufidx > 0 ) { char * sp = bufp; while( isspace( (uch)*sp ) ) sp++; /* skip whitespace */ if ( *sp == '#' ) { bufidx = 0; continue; } } break; } return bufp; } /* compress whitespace, drop leading / trailing whitespace, * put pointer to key word into *key */ void norm_line _P2( (line, key), char ** line, char ** key ) { char * r, *wp; int w, kflag; r = wp = *line; w = 0; kflag = 0; while ( *r ) { if ( isspace( (uch)*r ) ) { if ( w > 0 && wp[ w-1 ] != ' ' ) { if ( kflag == 0 ) kflag = w; wp[ w++ ] = ' '; } } else wp[ w++ ] = *r; r++; } wp[ w ] = 0; if ( w > 0 && wp[ w-1 ] == ' ' ) w--; wp[ w ] = 0; /* set key / line pointers */ *key = wp; if ( kflag == 0 ) *line = &wp[w]; else { wp[ kflag ] = 0; *line = &wp[ kflag+1 ]; } } /* change a input line into a (char ** ) chat sequence * all the data is in one malloc() block, so one free() suffices */ void * conf_get_chat _P1( (line), char * line ) { int cnt, i; int quote; char ** p; char * s; /* get number of distinct strings in this chat, for allocation */ quote=0; for ( cnt = i = 0; line[i]; i++ ) { if ( line[i] == '"' && ( i==0 || line[i-1]!='\\' ) ) quote = !quote; if ( line[i] == ' ' && !quote ) cnt++; } cnt+=2; /* lprintf( L_JUNK, "gc: %d strings", cnt-1 ); */ /* allocate memory for ptr list and chat script itself */ p = (char **) malloc( cnt * sizeof( char * ) + strlen(line) +1 ); if ( p == 0 ) { lprintf( L_ERROR, "conf_get_chat: cannot malloc" ); return NULL; } s = (char * ) &p[cnt]; /* pointer to data area */ /* build up ptr list, and copy script over */ quote = 0; p[ cnt=0 ] = s; while( *line ) { if ( *line == '"' ) quote = !quote; else if ( *line == ' ' && ! quote ) { *(s++) = 0; cnt++; p[cnt] = s; } else /* handle a few escape sequences */ if ( *line == '\\' && *(line+1) ) { switch( *(++line) ) { case 'r': *(s++) = '\r'; break; case 'n': *(s++) = '\n'; break; case 't': *(s++) = '\t'; break; case '\\': case '\"': *(s++) = *line; break; default: /* rest is handled in do_chat.c, especially "\c" */ *(s++) = '\\'; *(s++) = *line; } } else *(s++) = *line; line++; } /* terminate last string and ptr list */ *s = 0; cnt++; p[cnt] = NULL; /* for ( i=0; p[i]; i++ ) lprintf( L_JUNK, "chat string %d = '%s'", i, p[i] ); */ return p; } /* change "verbal" flow control names into FLOW_* bits * note: numeric constants (0x01/0x06) are used to avoid the need * to pull in tio.h/termio(s).h and friends */ int conf_get_flow _P2( (line, cp), char * line, conf_data * cp ) { if ( strncmp( line, "rts", 3 ) == 0 || strncmp( line, "hard", 4 ) == 0 ) { cp->d.i = FLOW_HARD; return 0; /* hardware flow control only */ } if ( strncmp( line, "xon", 3 ) == 0 || strncmp( line, "soft", 4 ) == 0 ) { cp->d.i = FLOW_SOFT; return 0; /* software flow control only */ } if ( strcmp( line, "both" ) == 0 ) { cp->d.i = FLOW_BOTH; return 0; /* hardware & software */ } if ( strcmp( line, "none" ) == 0 ) { cp->d.i = FLOW_NONE; return 0; /* none of it (DDTAH) */ } lprintf( L_WARN, "conf_get_flow: unknown keyword '%s'", line); return -1; } /* write the config structure into the log file */ void display_cd _P1( (cd), conf_data * cd ) { conf_data * cp; char ** p; cp = cd; while ( cp->key != NULL ) { char buf[100]; lprintf( L_NOISE, "key: '%s', type=%d, flags=%d, data=", cp->key, cp->type, cp->flags ); if ( cp->flags == C_EMPTY ) lputs( L_NOISE, "(empty)" ); else if ( cp->flags == C_IGNORE ) lputs( L_NOISE, "(ignored)" ); else switch ( cp->type ) { case CT_FLOWL: #ifdef PTR_IS_LONG /* 64bit machines: d.i is "long" */ case CT_INT: sprintf( buf, "%ld", cp->d.i ); #else case CT_INT: sprintf( buf, "%d", cp->d.i ); #endif lputs( L_NOISE, buf ); break; case CT_STRING: lputs( L_NOISE, (char *) cp->d.p ); break; case CT_BOOL: lputs( L_NOISE, cp->d.i ? "TRUE" : "FALSE" ); break; case CT_CHAT: p = (char **) cp->d.p; while ( *p != NULL ) { lputs( L_NOISE, *p ); lputc( L_NOISE, ' '); p++; } break; default: lputs( L_NOISE, "**unprintable**" ); break; } cp++; } } /* like strcmp(), but permit wildcard matches: * - '?' will match any character in the peer string * - if one string is shorter, and the remainder of the other string * consists only of '?', accept match */ int wildcard_strcmp _P2(( a, b ), char * a, char * b) { while( *a && *b ) { if ( *a != *b && *a != '?' && *b != '?' ) { return (*a - *b); /* not wildcard -> no match */ } a++; b++; } if ( *a == '\0' ) /* b longer than a */ { while( *b ) { if ( *b++ != '?' ) return -1; /* no match */ } return 0; /* match */ } /* a longer than b */ while( *a ) { if ( *a++ != '?' ) return +1; /* no match */ } return 0; /* match */ } int get_config _P4( (conf_file,cd,section_key,key_value), char * conf_file, conf_data * cd, char * section_key, char * key_value ) { FILE * conf_fp; char * line; char * key; conf_data * cp; int errflag = 0; int ignore = 0; /* ignore keywords in non-matching section */ conf_fp = fopen( conf_file, "r" ); if ( conf_fp == NULL ) { if ( errno == ENOENT ) lprintf( L_WARN, "no config file found: %s", conf_file ); else lprintf( L_FATAL, "cannot open %s", conf_file ); return ERROR; } lprintf( L_NOISE, "reading %s...", conf_file ); /* display_cd ( cd ); */ while ( ( line = fgetline( conf_fp ) ) != NULL ) { norm_line( &line, &key ); if ( key[0] == 0 ) continue; /* empty line */ lprintf( L_NOISE, "conf lib: read: '%s %s'", key, line ); /* sort in data */ errflag = 0; cp = cd; if ( strcmp( key, section_key ) == 0 ) /* new section */ { ignore = ( key_value == NULL ) || /* match "wanted" section? */ ( wildcard_strcmp( line, key_value ) != 0 ); lprintf( L_NOISE, "section: %s %s, %s", key, line, (ignore)?"ignore":"**found**" ); } else if ( ! ignore ) while ( cp->key != NULL ) { if ( strcmp( cp->key, key ) == 0 ) { /* special case: CT_KEYWORD pseudo-type * * additional "section key" keyword, handled similar to the * "standard" section keyword -> ignore everything below */ if ( cp->type == CT_KEYWORD ) { lprintf( L_NOISE, "found CT_KEYWORD %s %s", key, line ); ignore = TRUE; break; } if ( cp->flags == C_CONF && ( cp->type == CT_STRING || cp->type == CT_CHAT ) ) { free( cp->d.p ); cp->d.p = NULL; } if ( cp->flags != C_OVERRIDE && cp->flags != C_IGNORE ) { switch( cp->type ) { case CT_INT: if ( isdigit( (uch)line[0] ) || ( line[0] == '-' && isdigit( (uch)line[1] ) ) ) cp->d.i = strtol( line, NULL, 0 ); else errflag++; break; case CT_STRING: if ( ( cp->d.p = malloc( strlen( line ) +1 ) ) == NULL ) errflag ++; else strcpy( cp->d.p, line ); break; case CT_CHAT: if ( ( cp->d.p = conf_get_chat( line ) ) == NULL ) errflag ++; break; case CT_BOOL: cp->d.i = ( line[0] == 0 || line[0] == 1 || tolower((uch)line[0]) == 'y' || tolower((uch)line[0]) == 't' || strncmp( line, "on", 2 ) == 0 ); break; case CT_FLOWL: if ( conf_get_flow( line, cp ) < 0 ) errflag++; break; default: lprintf( L_ERROR, "yet unable to handle type %d", cp->type ); errflag ++; break; } cp->flags = C_CONF; } break; } cp++; } if ( cp->key == NULL || errflag ) { lprintf( L_WARN, "something foul in config line: '%s %s'", key, line ); if ( cp->key == NULL ) lprintf( L_WARN, " (keyword '%s' not found)", key ); else lprintf( L_WARN, " (most likely syntax error)" ); } } display_cd ( cd ); fclose( conf_fp ); return NOERROR; } /* makepath * * only needed on non-ANSI-compilers or for non-fixed arguments * * concatenate the first argument (file name) with the second * (path name), but only if the file name doesn't start with "/" */ char * _makepath _P2( (file, path), char * file, char * path ) { char * p; if ( file[0] == '/' ) return file; p = malloc( strlen( path ) + strlen( file ) +2 ); if ( p == NULL ) { lprintf( L_FATAL, "malloc error (in makepath)" ); exit(1); } sprintf( p, "%s/%s", path, file ); return p; } mgetty-1.2.1/config.h000066400000000000000000000036401334553713100144520ustar00rootroot00000000000000#ifndef ___CONFIG_H #define ___CONFIG_H #ident "$Id: config.h,v 4.5 2006/03/29 12:26:09 gert Exp $ Copyright (c) 1993 Gert Doering" /* type definitions, prototypes, defines needed for configuration stuff */ #ifdef PTR_IS_LONG typedef long p_int; /* a "long" is the same size as an "char *" */ #else typedef int p_int; /* an "int" is the same size as an "char *" */ #endif typedef struct conf_data { char * key; union { p_int i; void * p; } d; enum { CT_INT, CT_STRING, CT_CHAT, CT_BOOL, CT_FLOWL, CT_ACTION, CT_KEYWORD } type; enum { C_EMPTY, C_PRESET, C_OVERRIDE, C_CONF, C_IGNORE } flags; } conf_data; int get_config _PROTO(( char * conf_file, conf_data * cd, char * section_key, char * key_value )); void display_cd _PROTO(( conf_data * cd )); char * fgetline _PROTO(( FILE * fp )); void norm_line _PROTO(( char ** line, char ** key )); void * conf_get_chat _PROTO(( char * line )); #ifndef ERROR #define ERROR -1 #define NOERROR 0 #endif /* macros for effecient initializing of "conf_data" values */ #define conf_set_string( cp, s ) { (cp)->d.p = (s); (cp)->flags = C_OVERRIDE; } #define conf_set_bool( cp, b ) { (cp)->d.i = (b); (cp)->flags = C_OVERRIDE; } #define conf_set_int( cp, n ) { (cp)->d.i = (n); (cp)->flags = C_OVERRIDE; } /* macros for implementation-indepentent access */ #define c_isset( cp ) ( c.cp.flags != C_EMPTY ) #define c_string( cp ) ((char *) c.cp.d.p) #define c_bool( cp ) ((boolean) c.cp.d.i) #define c_int( cp ) ((int) c.cp.d.i) #define c_chat( cp ) ((char **) c.cp.d.p) /* concatenate two paths (if second path doesn't start with "/") */ /* two variants: ANSI w/ macro, K&R w/ C subroutine in config.c */ #ifdef __STDC__ #define makepath( file, base ) ((file)[0] == '/'? (file) : (base"/"file)) #else #define makepath( file, base ) _makepath( file, base ) #endif extern char * _makepath _PROTO(( char * file, char * base )); #endif /* ___CONFIG_H */ mgetty-1.2.1/contrib/000077500000000000000000000000001334553713100144715ustar00rootroot00000000000000mgetty-1.2.1/contrib/.files000066400000000000000000000005361334553713100156000ustar00rootroot00000000000000Makefile README 3b1 dvi-fax faxdvi.config faxdvi2.perl faxin.c faxiobe.sh sun.readme faxmail-smail frame40ps.fix g3tolj.c g3tolj.1 g3toxwd.c g3toxwd.1 g3tops.c gs-security.fix logparse.c lp-fax mgetty-to-flexfax.sh pbm2styl800.tar.gz pbmscale.c pbmsplit.c pgx.c readme.supra tsfax-0.1.tgz ttyenable two-modems usr_gotcha.mail autoprint.sh watchit.pl mgetty-1.2.1/contrib/3b1000066400000000000000000000120151334553713100150000ustar00rootroot00000000000000Hi, here are a few mails explaining how to get mgetty+sendfax to work on the 3B1 machines (with the mail addresses of people who got it to work). A few words on my own: - the 3B1 cannot do more than 1920 bps - so #define FAX_SEND_BAUD and DEFAULT_PORTSPEED to B19200 - maybe it's necessary to remove the lines in sendfax.c where CLOCAL gets cleared (around line 446): ------- /* by now, the modem should have raised DCD, so remove CLOCAL flag */ fax_termio.c_cflag &= ~CLOCAL; ioctl(...) ------- gert ------------------------------------------------ To: Subject: Re: mgetty-sendfax Message-Id: <9307190917.AA02797@gladys.UUCP> Date: Mon, 19 Jul 1993 18:17:14 +0200 From: gladys!dalton@PacBell.COM (David Dalton) Greetings, Gert... Thanks for answering my message about mgetty-sendfax. You asked where I found the socket code for my AT&T 3B1. This machine is well-supported by hackers (it's almost a cult), and there is an archive at cheops.cis.ohio-state.edu The socket code lives in: pub/att7300/kernel/uipc.tar.Z The socket emulation seems reliable, but it did not include all the header files needed to compile mgetty-sendfax. Several calls brought trouble: timeval, fd_set, and bzero. I did have the necessary objects, but I had to scrounge to find some header files. I pieced together what I needed from the uipc source code and from include files at crl.com, where I have an account. [...] Regards, David Dalton dalton@gladys.uucp pacbell!gladys!dalton -------------------------------------------------------------------------------- From: "Glenn E. Thobe" To: gert@greenie.muc.de Subject: mgetty+sendfax 3b1 patches, Part 1 of 2 ========================= begin 3b1 instructions ================= Installing and using mgetty+sendfax on the AT&T pc7300/unixpc/3b1 mgetty+sendfax won't compile on a 3b1 with only the stock development system, you need a few extras: The socket library with select is kernel/uipc.tar.Z at either osu-cis (archive.cis.ohio-state.edu: pub/att7300) or uunet (ftp.uu.net: systems/att7300). This is essentially the same as what comes with the 3b1 distribution of MGR, which is what I used. Those who have ethernet or starlan, may prefer to use the libraries that come with them (this hasn't been tried). The PBMPLUS sources and patches are in the 1991 comp.sources.misc. You can get supposedly get the fully patched sources in compressed tar form from one of: export.lcs.mit.edu:contrib/pbmplus.tar.Z ftp.ee.lbl.edu:pbmplus.tar.Z where is probably "05dec91". The 3b1 archives (osu-cis and uunet) have binaries for a much older version of PBMPLUS. I compiled with GCC 2.4.5 (binaries from ftp.cs.caltech.edu: pub/3b1). My header files in /usr/include and /usr/include/sys are no longer stock as I consider it more productive to bring the headers up to date than to modify application software to compile with outdated headers. Comp.sources.3b1 has ported BSD headers (bsd-incl) and more-or-less ansified headers (ansihdr) which may prove helpful, at least as a guide, to those who wish to follow this road. You must add -D_3B1_ to your CFLAGS definition in the Makefile. mgetty+sendfax depend on other utilities to compose the g3 format fax image for transmission or to convert the received g3 format image to something that can be viewed on the screen or printed. For composing, you can use pbmtext and the modified pbmtog3. For more flexibility use LaTeX and either dvips or dvialw (or any other combination of utilites you like) to produce PostScript, and use ghostscript (get 3b1 binaries from ftp.cs.caltech.edu) to produce g3. For viewing, you may use g3topbm and either pbmto3b1 for stock TAM windows (get it from uunet or osu-cis) or mview for MGR (get mgrabscr from comp.sources.3b1). Mview has a minor bug which means you must read the PBM image from a file. WARNING, reading beyond this point may endanger your sanity! The 3b1's limited VM means that g3topbm will bomb on full size pages, so I ported Sam Leffler's TIFF library and built fax2tiff and do the following: fax2tiff -M incoming_fax.g3; tifftopnm fax.tiff | pbmtowhatever Unfortunately you can't build the g3 part of the TIFF library on the 3b1 without some machinations because there is not enough VM to compile g3states.h. My answer to this was to modify mkg3state.c to output the state tables in the form of a gas (GNU assembler) source file, which assembles easily, and an abbreviated g3states.h which references the state tables as "extern". The assembled state tables go into libtiff.a. If you don't want to fool with TIFF, you can probably rewrite g3topbm so it doesn't overflow VM. I also modified pbmtoepson (for Epson FX and related 9-pin printers) to produce the highest possible resolution of 240 dpi x 216 dpi and to economize on VM. I am working on a way to make my results (TIFF and pbmtoepson) and available. -Glenn Thobe Thu Sep 16 15:07:57 PDT 1993 ========================= end 3b1 instructions =================== mgetty-1.2.1/contrib/Makefile000066400000000000000000000010651334553713100161330ustar00rootroot00000000000000# # Makefile for miscellaneous stuff in contrib # # # settings for CC, CFLAGS imported from above # (call with "make contrib-all" from top level mgetty directory) all: faxin FIOBJS=faxin.o \ ../modem.o ../faxlib.o ../faxrec.o ../faxsend.o ../faxhng.o \ ../logfile.o ../io.o ../tio.o ../getdisk.o faxin: $(FIOBJS) $(CC) $(CFLAGS) $(LDFLAGS) -o faxin $(FIOBJS) $(LIBS) faxin.o: faxin.c ../mgetty.h ../policy.h $(CC) $(CFLAGS) $(LDFLAGS) -I.. -c -o faxin.o faxin.c $(LIBS) g3hack: g3hack.c $(CC) $(CFLAGS) -o g3hack g3hack.c clean: rm -f faxin g3hack *.o mgetty-1.2.1/contrib/README000066400000000000000000000137671334553713100153670ustar00rootroot00000000000000Much of this stuff is contributed by someone else, so please don't ask *me*. gert ----------------------------------------------------------- next-login/ Replacement for /bin/login on NeXT machines (standard one has problems with 8-Bit characters) ----------------------------------------------------------- autoprint.sh make the "print" command of ELM/MUSH print the incoming fax instead if you feed it a "a fax has arrived" mail. ----------------------------------------------------------- logparse.c A Logfile parser for sendfax-Logfiles ----------------------------------------------------------- faxman.pl / faxman.doc Fax Manager: view incoming / outgoing fax queues, manipulate faxes, print, ... - Klaus Lichtenwalder (klaus@gaston.m.isar.de) (now in ../frontends/tkperl) ----------------------------------------------------------- faxview.tcl Fax viewer using Tcl/Tk, from Ralf Schleicher (rs@purple.in-ulm.de) (now in ../frontends/tcl) ----------------------------------------------------------- faxdvi-1.1.tar Tool suite for even better interaction of faxspool/sendfax with TeXdvi, written by Ralf Schleicher . NOT INCLUDED (too big), but you can get it from ftp.informatik.tu-muenchen.de, in the /pub/comp/networking/communication/modems/mgetty/ directory. ----------------------------------------------------------- faxdvi2.perl Part of that suite, make faxing of .dvi files more comfortable. ----------------------------------------------------------- ttyenable script to enable / disable /etc/inittab entries for a given tty line (H.P.Heidinger) ----------------------------------------------------------- readme.supra some notes about some SUPRA Faxmodem releases that tend to forget about the RTS/CTS handshake settings ----------------------------------------------------------- log_diags Some patches by Uwe S. Fuerst, to include diagnostic informations about the last connection made into the mgetty log files (configurable for different modem types). Look at it, instructions / examples included. ----------------------------------------------------------- dvi-fax A brief instruction how to make "dvips" generate high-quality 204x196 dpi fonts for fax files (far better output quality than with re-scaled 300 dpi fonts). klaus@snarc.greenie.muc.de ----------------------------------------------------------- ../samples/new_fax.lj A sample script to print incoming faxes on a HP laserjet. Use as "FAX_NOTIFY_PROGRAM" (policy.h). klaus@snarc.greenie.muc.de ----------------------------------------------------------- ../samples/new_fax.mail A sample script to mail away incoming faxes. gert@greenie.muc.de ----------------------------------------------------------- ../samples/new_fax.mime A sample script to send incoming faxes as MIME mail to ``faxmaster'' Marc@Synergytics.Com ----------------------------------------------------------- lp-fax A printer driver for SCO Unix (and ODT), to send faxes with "lp -dfax -oto=" from within any application Used as "/usr/spool/lp/admins/lp/interfaces/fax" script. gert@greenie.muc.de ----------------------------------------------------------- faxiobe.sh A fax driver backend for IBM AIX (provided by Michael Staats). Readme included in the shell archive. michael@hal6000.thp.uni-duisburg.de ----------------------------------------------------------- gslp-iso.p A patch to ghostscript's "gslp.ps" to be able to use all iso-8859- characters (including national special characters). arne@mars.rmt.sub.org ----------------------------------------------------------- gs-security.fix A patch to ghostscript's "gs_init.ps" to prevent ugly things from happening if you view "bad-guy-postscript". juphoff@nrao.edu ----------------------------------------------------------- 3b1 Some additional hints about AT&T's 3B1 and mgetty+sendfax. ----------------------------------------------------------- faxin.c compile, link with logfile.o, faxlib.o, faxrec.o and you have a standalone fax receiver that could be called upon receipt of "+FCON" from any getty or login program. Options: "-x ", "-d " Make: just go to the mgetty directory, call "make contrib-all" gert@greenie.muc.de ----------------------------------------------------------- g3toxwd.c From: Chel van Gennip A small program to convert G3 input to X11 screen dumps (xwd) - a lot faster than g3tobpm |pbmtoxwd ----------------------------------------------------------- g3tolj.c From: Chel van Gennip A small program to convert G3 input to HP laserjet output ----------------------------------------------------------- two-modems Instruction + patches to use mgetty with two modems on a line, one for fax-only and one for data-only. ----------------------------------------------------------- ../dialog/listen A small utility to browse through incoming voice messages, play them or delete them. nelson@crynwr.com (Russell Nelson), klaus@snarc.greenie.muc.de (Klaus Weidner) ----------------------------------------------------------- pbmscale.c From: Chel van Gennip To: gert@greenie.muc.de Subject: Re: FAX software to run under SCO ???? [...] To improve the speed of handling faxes I made a simple pbmscale program to scale portable bitmaps without converting them to graymaps. I'll include the source in this mail. To use it with pbmplus you only need some trivial changes in pbmmerge.c an Makefile. Typical usage: cat faxn... |g3topbm|pbmscale -scale 0.35 -aspect 2.0| pnmtoxdm |xdum or cat faxn... |g3topbm|pbmscale -scale 1.35 -aspect 2.0| pbmtolj | lp -d hpdeskjet [...] From: Chel van Gennip To: gert@greenie.muc.de >Do you have some explantation of all the switches? pbmscale [-scale N] [-aspect N] [-stretch] [pbmfile]"; -scale N Scale x and y by factor N, eg. -scale 1.35 -aspect N, N is multiplier for the y scale factor eg. -aspect 1.9 -stretch equivalent with -aspect 2.0 So the resulting bitmap is *x by **y dots. Regards, Chel ----------------------------------------------------------- mgetty-1.2.1/contrib/autoprint.sh000066400000000000000000000050041334553713100170510ustar00rootroot00000000000000From owner-mgetty Tue May 7 22:46:47 1996 Return-Path: Received: by greenie.muc.de (/\==/\ Smail3.1.24.1 #24.2) id ; Tue, 7 May 96 22:46 MEST Return-Path: Received: by greenie.muc.de (/\==/\ Smail3.1.24.1 #24.2) id ; Tue, 7 May 96 22:46 MEST Received: from mail2.dircon.co.uk ([194.112.32.10]) by vogon.muc.de with SMTP id <93325-3>; Tue, 7 May 1996 22:45:49 +0200 Received: from diversity.org.uk (diversity.org.uk [193.128.226.199]) by mail2.dircon.co.uk (8.7.5/8.7.3) with SMTP id VAA19338 for ; Tue, 7 May 1996 21:38:39 +0100 (BST) From: Nigel Whitfield Date: Tue, 7 May 1996 22:16:29 +0200 Reply-To: nigel@diversity.org.uk X-Mailer: Mail User's Shell (7.2.5 10/14/92) To: mgetty@muc.de Subject: Some quick and dirty scripts Message-ID: <9605072116.aa15322@fags.stonewall.demon.co.uk> Status: ROr Just in case anyone wants. here are a couple of very quick and very dirty scripts that I use in conjunction with my mail programs here. The end result is that from within elm or mush using the print command prints ordinary messages, but for notifications of incoming faxes, prints the fax instead. Enjoy! ---- /usr/local/bin/autoprint - works out if this is a fax or not #!/bin/sh - # # autoprint - attempts to determine if a mail message # is a fax notification, and prints the fax if so, # otherwise prints the mail message # # first save the text cat - > /usr/tmp/autoprint.$$ if grep -l -s 'Subject: fax from' /usr/tmp/autoprint.$$ then cat /usr/tmp/autoprint.$$ | /usr/local/bin/pfax else lp /usr/tmp/autoprint.$$ fi rm -f /usr/tmp/autoprint.$$ ---- end of autoprint ---- /usr/local/bin/pfax - prints the fax files named in the msg #!/bin/sh - # # pfax - script to accept a fax notification message # on std in and print it out # PAGES=`grep "fax/incoming"` G3TOLJ="/usr/local/bin/g3tolj" for i in $PAGES do FAX=$i RES=`basename $FAX | sed 's/.\(.\).*/\1/'` if [ "$RES" = "n" ] then STRETCH="-aspect 2.0" else STRETCH="" fi $G3TOLJ $STRETCH $FAX \ | lp -dlaser -oraw -onb > /dev/null done exit 0 ---- end of pfax Amend as necessary for your printer; this works for me on SCO ODT 3. Nigel. -- Nigel Whitfield nigel@diversity.org.uk Digital Diversity nigel@stonewall.demon.co.uk and uk-motss ***** All demon.co.uk sites are independently run internet hosts ***** mgetty-1.2.1/contrib/dvi-fax000066400000000000000000000157711334553713100157650ustar00rootroot00000000000000From owner-mgetty Tue Jan 25 23:58:10 1994 Return-Path: Received: by greenie.muc.de (/\==/\ Smail3.1.24.1 #24.3) id ; Tue, 25 Jan 94 23:58 MET Return-Path: Received: by greenie.muc.de (/\==/\ Smail3.1.24.1 #24.3) id ; Tue, 25 Jan 94 23:58 MET Received: from greenie by colin.muc.de with UUCP id <22327>; Tue, 25 Jan 1994 23:41:49 +0100 Received: by greenie.muc.de (/\==/\ Smail3.1.24.1 #24.3) id ; Tue, 25 Jan 94 20:55 MET Received: by snarc.greenie.muc.de (Linux Smail3.1.28.1 #14) id m0pOt9a-0002hNC; Tue, 25 Jan 94 20:10 MET Message-Id: From: klaus@snarc.greenie.muc.de (Klaus Weidner) Subject: Generating 204x196 fonts for TeX To: mgetty@muc.de (mgetty mailing list) Date: Tue, 25 Jan 1994 20:10:20 +0100 X-Mailer: ELM [version 2.4 PL21] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 5276 Status: RO Hello, due to popular request (hello Gert...), here is a description of what you have to do to get high-quality fonts for your fax files. If you use the usual setup, you will probably end up scaling down the 300dpi bitmap fonts available on your system to 204x196dpi needed for faxing. This works, but the quality of the resulting fonts is awful, and Donald Knuth will probably send the International Font Police after you for such cruel abuse of a wonderful typesetting program. There are three steps you have to take care of to get better results: - your dvi-to-whatever converter has to use the right font size - metafont has to be set up to generate fonts of the right resolution when needed. - both programs have to agree where the fonts are stored. I use dvips to convert the dvi input to PostScript and then GhostScript to generate g3 fax files. The paths used below are those used on my system, you will have to edit them to match your setup. A shell script takes care of everything from the user's point of view: % dvi2fax test.dvi creates the file(s) test-001.fax (one per page) in the current directory, which can then be passed on to sendfax. The script looks like this: ----- dvi2fax ------------------------------------------------------------ #! /bin/sh for i do NAME=`basename $i .dvi` dvips -P dfaxhigh $NAME.dvi -o $NAME.ps gs -sDEVICE=dfaxhigh -sOutputFile=$NAME-%03d.fax -sNOPAUSE -- $NAME.ps done -------------------------------------------------------------------------- This calls dvips with a printer name of `dfaxhigh'. The `-P' flag tells dvips to use the following configuration file: --- /usr/TeX/lib/tex/ps/config.dfaxhigh ---------------------------------- M GThreeFaxHigh X 204 Y 196 -------------------------------------------------------------------------- (M defines the configuration Metafont will use to generate the font, X and Y define the resolution in dots/inch.) You will have to define a Metafont mode for creating the fax fonts, by default it only knows about low-resolution faxes. Put the following definition into /usr/TeX/lib/mf/macros/modes.mf: --- /usr/TeX/lib/mf/macros/modes.mf -------------------------------------- [...] mode_def GThreeFaxHigh = % 204 x 196dpi G3fax mode_param (pixels_per_inch, 204); mode_param (aspect_ratio, 196 / pixels_per_inch); mode_param (blacker, 0); mode_param (fillin, .2); mode_param (o_correction, .2); mode_common_setup_; enddef; -------------------------------------------------------------------------- Then create a new metafont base file: inimf "plain; input modes; dump" mv plain.base /usr/TeX/lib/mf/bases/mf.base Now Metafont knows how to generate fonts at the right resolution. Dvips will check if the needed fonts exist, and if they don't, it will call MakeTeXPK to create them. On my system, the G3 fonts have filenames like `/usr/TeX/lib/tex/fonts/GThreeFaxHigh/cmr10.204pk'. The environment variable TEXPKS is used to tell dvips, xdvi and other programs where the fonts are stored: TEXPKS=/usr/TeX/lib/tex/fonts/%m/%f.%dpk (%m is replaced with the Metafont `mode', %f with the font name and %d with the X pixel size.) If the font doesn't exist, dvips will call a shell script like this: MakeTeXPK The MakeTeXPK script was included in my TeX distribution, I have edited it to match my setup: --- MakeTeXPK ------------------------------------------------------------ #!/bin/sh # # This script file makes a new TeX PK font, because one wasn't # found. Parameters are: # # name dpi bdpi magnification [mode [subdir]] # # `name' is the name of the font, such as `cmr10'. `dpi' is # the resolution the font is needed at. `bdpi' is the base # resolution, useful for figuring out the mode to make the font # in. `magnification' is a string to pass to MF as the # magnification. `mode', if supplied, is the mode to use. # # Note that this file must execute Metafont, and then gftopk, # and place the result in the correct location for the PostScript # driver to find it subsequently. If this doesn't work, it will # be evident because MF will be invoked over and over again. # # Of course, it needs to be set up for your site. # TEXDIR=/usr/TeX/lib/tex LOCALDIR=/usr/TeX/lib/tex # # TEMPDIR needs to be unique for each process because of the possibility # of simultaneous processes running this script. # if test "$TMPDIR" = "" then TEMPDIR=/tmp/mtpk.$$ else TEMPDIR=$TMPDIR/mtpk.$$ fi NAME=$1 DPI=$2 BDPI=$3 MAG=$4 MODE=$5 if [ -z "$MODE" ] then case $BDPI in 204) MODE=GThreeFaxHigh ;; 240) MODE=EpsonMXFX ;; *) MODE=localfont ;; esac fi DESTDIR=$LOCALDIR/fonts/$MODE GFNAME=$NAME.$DPI'gf' PKNAME=$NAME.$DPI'pk' # Clean up on normal or abnormal exit trap "cd /; /bin/rm -rf $TEMPDIR $DESTDIR/pktmp.$$" 0 1 2 15 if test ! -d $DESTDIR then mkdir $DESTDIR fi if test "$6" != "" then DESTDIR=$DESTDIR"$6" if test ! -d $DESTDIR then mkdir $DESTDIR fi fi mkdir $TEMPDIR cd $TEMPDIR if test -r $DESTDIR/$PKNAME then echo "$DESTDIR/$PKNAME already exists!" exit 0 fi # check also in the standard place if test "$6" = "" then if test -r $TEXDIR/fonts/$PKNAME then echo $TEXDIR/fonts/$PKNAME already exists! exit 0 fi else if test -r $TEXDIR/fonts/$6"$PKNAME" then echo $TEXDIR/fonts/$6"$PKNAME" already exists! exit 0 fi fi echo "mf \"\\mode:=$MODE; mag:=$MAG; scrollmode; input $NAME\" < /dev/null" mf "\mode:=$MODE; mag:=$MAG; scrollmode; input $NAME" < /dev/null if test ! -r $GFNAME then echo "Metafont failed for some reason on $GFNAME" exit 1 fi gftopk -v ./$GFNAME ./$PKNAME # Install the PK file carefully, since others may be doing the same # as us simultaneously. mv $PKNAME $DESTDIR/pktmp.$$ cd $DESTDIR mv pktmp.$$ $PKNAME exit 0 ----------------------------------------------------------------------------- ciao, Klaus -- \ klaus@snarc.greenie.muc.de--kweidner@physik.tu-muenchen.de--2:246/55.4 \ .signature error -- quote dumped mgetty-1.2.1/contrib/faxdvi.config000066400000000000000000000023131334553713100171400ustar00rootroot00000000000000# faxdvi.config # # This is an example configuration file for FAXDVI. Feel free to do # anything you want to do with it. # # Ralph Schleicher # 241:10000/1513@PNoF # rs@purple.PNoF.sub.org # Phone number aliases can be specified with the `alias' command. The # syntax is # # alias [] # # The optional comment has to be put into parenthesis. # can be either the final phone number or another alias. Dialing lists # may be built by joining multiple phone numbers separated with commas. # # will be treated as a command if it starts with a vertical # bar (this feature does not work within the definition of a dialing list). # The token `@' will be replaced with only if is given. # alias ts (Thomas Schmitt) 07522-28363 alias cdg (Cees de Groot) |pnof -f -r name -r phone | fgrep '@' | cut -f2 -d, alias pnof ts,cdg # The topmost matching translation rule will be applied to the resulting # phone number after alias substitution. `dialtrans' is a single matching # search and replace command as you know if from perl(1). # dialtrans /^0/0/ dialtrans /^([1-9][0-9]*)$/$1/ dialtrans /^49-7352-// dialtrans /^49-/0/ dialtrans /^/00/ mgetty-1.2.1/contrib/faxdvi2.perl000077500000000000000000000116651334553713100167340ustar00rootroot00000000000000#!/usr/local/bin/perl # # faxdvi2 -- pass a DVI file to the FAX subsystem. # # 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. # # Ralph Schleicher # 241:10000/1513@PNoF # rs@purple.PNoF.sub.org $config_file = '/usr/local/lib/mgetty+sendfax/faxdvi.config'; $user_file = "$ENV{'HOME'}/.faxdvirc"; $dvips = 'dvips -t letter -P fax'; $gs = 'gs -sPAPERSIZE=letter -sDEVICE=dfaxhigh'; $version_string = 'FAXDVI2 Version 1.0 (Perl)'; sub usage { print <] [-V] [-?] [- ] -C, --config-file Use as the configuration file instead of the default `$config_file'. -V, --version Displays the version number. -?, --help Prints this small help. -, -- Pass verbatim to DVIPS. A real phone number or a FAX alias. You name it. STOP } {} # Get the command line options. # while (($_ = $ARGV[0]) =~ /^-/) { shift; if ($_ eq '-C' || $_ eq '--config-file') { $config_file = shift @ARGV; die "$0: Missing option argument for `$_'\n" if $config_file =~ /^-/; } elsif ($_ eq '-V' || $_ eq '--version') { $version = 1; $exit = 0; } elsif ($_ eq '-?' || $_ eq '--help') { $help = 1; $exit = 0; } elsif (/^--?$/) { push (@DVIPS, shift @ARGV) while @ARGV > 2; last; } else { die "$0: Unknown option `$_', try `--help'\n"; } } if (@ARGV == 2) { $phone_number = $ARGV[0]; $dvi_file = $ARGV[1]; } elsif ($exit eq '') { $help = 1; $exit = 1; } print "\nThis is $version_string\n\n" if $version; &usage if $help; exit $exit if $exit ne ''; # Read the configuration files. # sub configure { local ($config) = @_; local (*CONF); open (CONF, $config) || die "$0:$config: $!\n"; foreach () { next if /^\s*#/; next if /^\s*$/; chop; $comment{$1} = $3, $alias{$1} = $4, next if /^alias\s+(\S+)\s+(\((.*)\)\s+)?(.+)/; push (@dialtrans, $1), next if /^dialtrans\s+(.+)/; die "$0:$config:$.: Bad line\n"; } close (CONF); } &configure ($config_file) if $config_file ne ''; &configure ($user_file) if -f $user_file; # Do alias substitution and phone number translation. # foreach (grep ($alias{$_} =~ /^\|/, keys %alias)) { ($command = $alias{$_}) =~ s/^\|//; $command =~ s/@/$comment{$_}/ if $comment{$_} ne ''; $alias{$_} = `$command`; chop $alias{$_}; die "$0: Command alias for `$_' evaluates to null\n" if $alias{$_} =~ /^\s*$/; } for (@work = ($phone_number); @work > 0; ++$done{shift @work}) { unshift (@work, split (',', $alias{shift @work})) while $alias{$work[0]} ne ''; } foreach $num (keys %done) { foreach $rule (@dialtrans) { if ($num =~ (split (substr ($rule, 0, 1), $rule))[1]) { eval "\$num =~ s$rule"; die "$0: $@\n" if $@ ne ''; last; } } push (@number, $num); } # Convert the DVI file into G3 format. # $temp_dir = "/tmp/faxdvi2.$$"; mkdir ($temp_dir, 0755) || die "$0:$temp_dir: $!\n"; sub cleanup { local ($sig) = @_; local (*DIR); opendir (DIR, $temp_dir); unlink grep ($_ = "$temp_dir/$_", grep (! /^\.\.?$/, readdir (DIR))); closedir (DIR); rmdir ($temp_dir); exit ($sig eq '') ? 0 : 1; } $SIG{'HUP'} = 'cleanup'; $SIG{'INT'} = 'cleanup'; $SIG{'QUIT'} = 'cleanup'; $SIG{'PIPE'} = 'cleanup'; $SIG{'TERM'} = 'cleanup'; open (NULL, ">/dev/null") || die "$0:/dev/null: $!\n"; open (SAVOUT, ">&STDOUT") || die "$0:(stdout): $!\n"; open (STDOUT, ">&NULL") || die "$0:(stdout): $!\n"; open (SAVERR, ">&STDERR") || die "$0:(stderr): $!\n"; open (STDERR, ">&NULL") || die "$0:(stderr): $!\n"; sub bye { open (STDOUT, ">&SAVOUT"); open (STDERR, ">&SAVERR"); warn @_; &cleanup; } $output = join ('/', ($temp_dir, 'f')); system ("$dvips @DVIPS -o $output $dvi_file") && &bye ("$0: DVIPS failed on `$dvi_file'\n"); system ("$gs -dNOPAUSE -sOUTPUTFILE=$output%07d.g3 $output quit.ps") && &bye ("$0: Ghostscript failed for some reason\n"); opendir (DIR, $temp_dir) || &bye ("$0:$temp_dir: $!\n"); @pages = grep ($_ = "$temp_dir/$_", grep (/\.g3$/, readdir (DIR))); closedir (DIR); foreach (@number) { system ("faxspool $_ @pages\n") && &bye ("$0: Sending `$dvi_file' to `$_' failed\n"); } &cleanup; mgetty-1.2.1/contrib/faxin.c000066400000000000000000000027461334553713100157530ustar00rootroot00000000000000#include #include #include #include #include #ifdef ISC #include #endif #include "mgetty.h" #include "policy.h" void exit_usage _P1( (retcode), int retcode ) { fprintf( stderr, "usage: faxin [-d ] [-x ]\n"); exit( retcode ); } char * Device; /* faxrec() needs it [for the filenames] */ time_t call_start; /* ditto */ char * CallerId = "unknown"; /* only available in mgetty / cnd.c */ char * CallName = "unknown"; /* ditto */ int main _P2( (argc, argv), int argc, char ** argv ) { char * fax_spool_in = FAX_SPOOL_IN; int c; char log_path[MAXPATH]; while ((c = getopt(argc, argv, "x:d:")) != EOF) { switch (c) { case 'x': log_set_llevel( atoi(optarg) ); break; case 'd': fax_spool_in = optarg; break; case '?': exit_usage(2); break; } } /* get the name of the tty stdin is connected to (jcp) */ Device = ttyname(STDIN_FILENO); if ( Device == NULL || *Device == '\0' ) Device = "unknown"; /* if present, remove the leading "/dev/" prefix */ if ( strncmp( Device, "/dev/", 5 ) == 0 ) Device += 5; /* remember the start time */ call_start = time( NULL ); /* construct the log path string */ sprintf( log_path, LOG_PATH, Device ); /* initialize logging subsystem */ log_init_paths( argv[0], log_path, &Device[strlen(Device)-2] ); /* receive the fax */ faxrec( fax_spool_in, 0, -1, -1, 644, NULL ); return 0; } mgetty-1.2.1/contrib/faxiobe.sh000066400000000000000000000261621334553713100164510ustar00rootroot00000000000000#!/bin/sh # This is a shell archive (shar 3.32) # made 11/16/1993 15:42 UTC by gert@greenie # Source directory /u/gert/mgetty/contrib # # existing files WILL be overwritten # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 1194 -rw-r--r-- faxiobe/Makefile # 1449 -rw-r--r-- faxiobe/README # 6146 -rw-r--r-- faxiobe/faxiobe.c # 98 -rwxr-xr-x faxiobe/nofax # if touch 2>&1 | fgrep 'amc' > /dev/null then TOUCH=touch else TOUCH=true fi # ============= faxiobe/Makefile ============== if test ! -d 'faxiobe'; then echo "x - creating directory faxiobe" mkdir 'faxiobe' fi echo "x - extracting faxiobe/Makefile (Text)" sed 's/^X//' << 'SHAR_EOF' > faxiobe/Makefile && X X# binary will be installed in DESTDIR with make install X XDESTDIR=/usr/local/sbin X X# set DIALPREF to a prefix to be added to the faxnumber X XDIALPREF=\"8,\" X X# define GHOSTSCRIPT and SENDFAX correct for you site X XGHOSTSCRIPT=\"/usr/local/bin/gs\" XSENDFAX=\"/usr/local/sbin/sendfax -v\" X X# define NOFAX for a dummy program instead of sendfax X# this is for debugging. A sample "nofax" is in the distribution. X XNOFAX=\"/usr/local/bin/nofax\" X X# BUGGYMODEM is defined for our Zyxel 1496EG+. X# ARRGH! XDEFINES=-DDIALPREF="$(DIALPREF)" -DGHOSTSCRIPT="$(GHOSTSCRIPT)"\ X -DSENDFAX="$(SENDFAX)" -DNOFAX="$(NOFAX)" -DBUGGYMODEM X X# Use this for working modems.... X#DEFINES=-DDIALPREF="$(DIALPREF)" -DGHOSTSCRIPT="$(GHOSTSCRIPT)"\ X# -DSENDFAX="$(SENDFAX)" -DNOFAX="$(NOFAX)" -DBUGGYMODEM X Xfaxiobe: faxiobe.o X $(CC) -o faxiobe faxiobe.o $(LDFLAGS) -lqb X Xfaxiobe.o: faxiobe.c X $(CC) -c $(CFLAGS) $(DEFINES) faxiobe.c X Xclean: X /bin/rm -f *.o *~ core faxiobe X Xinstall: faxiobe X [ -d $(DESTDIR) ] || mkdir $(DESTDIR) X /usr/ucb/install -m 2755 -o bin -g printq faxiobe $(DESTDIR) X X### ignore the following.... X Xtarfile: clean X tar czvf /nfs/sahara/ftp/pub/source/faxiobe-1.04.tar.gz -C .. faxiobe X SHAR_EOF $TOUCH -am 1115104093 faxiobe/Makefile && chmod 0644 faxiobe/Makefile || echo "restore of faxiobe/Makefile failed" set `wc -c faxiobe/Makefile`;Wc_c=$1 if test "$Wc_c" != "1194"; then echo original size 1194, current size $Wc_c fi # ============= faxiobe/README ============== echo "x - extracting faxiobe/README (Text)" sed 's/^X//' << 'SHAR_EOF' > faxiobe/README && X -*-text-*- X X Xfaxiobe: a fax backend for AIX. (C) Michael Staats 1993 X free software according the Gnu Public License, see X File copying. X XIf you want to understand what this program does, ask info about X"piobe" and "Understanding Backend Routines in libqb". X XLook at the Makefile and define GHOSTSCRIPT and SENDFAX correctly for Xyour site. Sendfax is the the sendfax program from the mgetty+sendfax Xpackacge by Gert Doering. X XDefine DIALPREF to a string wich will be put in front of the fax Xnumber. Leave it empty if you don't need any prefixes or want Xthe user to provide them with the faxnumber. X XDefine NOFAX to a program to be called instead of sendfax for Xdebugging purpose. There is a small shell script in the distribution. XIt exits with an exitvalue of the faxnumber, so you can debug the Xerrorhandling. X XInstall it as a printer, just with a different backend. XA sample local queue definition could be (in /etc/qconfig): X X========================= entry in /etc/qconfig =============== X X* Local queue fax X Xfax: X device = modem X discipline = fcfs X acctfile = /var/adm/acct/fax Xmodem: X backend = /usr/local/sbin/faxiobe X X=============================================================== X XThen you can send a fax with X Xlp -d fax -o -n [ -o -fg3 ] files ... X Xor X Xlp -d fax [ -o -fg3 ] -o to= files ... X XI'm sorry that I don't have the time to provide more documentation. X XMichael (michael@hal6000.thp.Uni-Duisburg.DE) SHAR_EOF $TOUCH -am 1115103993 faxiobe/README && chmod 0644 faxiobe/README || echo "restore of faxiobe/README failed" set `wc -c faxiobe/README`;Wc_c=$1 if test "$Wc_c" != "1449"; then echo original size 1449, current size $Wc_c fi # ============= faxiobe/faxiobe.c ============== echo "x - extracting faxiobe/faxiobe.c (Text)" sed 's/^X//' << 'SHAR_EOF' > faxiobe/faxiobe.c && X/* faxiobe: A fax backend for AIX. X (C) Michael Staats (michael@hal6000.thp.Uni-Duisburg.DE) X*/ Xstatic const char *What = X"@(#) faxiobe - A fax backend for AIX.\n" X"@(#) (C) Michael Staats (michael@hal6000.thp.Uni-Duisburg.DE)\n" X"@(#) free software according GNU Public License"; X X#include X#include X#include X#include X#include X X#define MAXRETRY "3" X#define SLEEPTIME 300 /* make multiple of 10 please */ X X#ifndef GHOSTSCRIPT X#define GHOSTSCRIPT "/usr/local/bin/gs" X#endif X X#ifndef SENDFAX X#define SENDFAX "/usr/local/sbin/sendfax" X#endif X X#ifndef NOFAX X#define NOFAX "/usr/local/bin/nofax" X#endif X X#ifndef DIALPREF X#define DIALPREF "8," X#endif X X#ifndef SPOOLDIR X#define SPOOLDIR "/var/spool/fax/outgoing" X#endif X X/* #define DEBUG */ X X#ifdef DEBUG X#define USE_NOFAX X#endif X X#define LATER ", I'll try again later...\n" X#define FAILED "Your fax failed, " X X/* define this empty if you modem is not buggy, ours is :-( */ X X#ifdef BUGGYMODEM X#define BUGGYMODEMT "\nOur modem has a little BUG, so please switch it OFF and\ X after 5 seconds ON\n again. If you do not do this, NO incoming calls (faxes)\ Xwill be recognized!!!!\n\n" X#else X#define BUGGYMODEMT X#endif X X#define MSGMOD (get_mail_only()?DOMAIL:DOWRITE) X X#define RETRY 99 X Xchar *msg[] = { X FAILED "unknown commandline option.\n", X FAILED "specify Faxnumber with -o -n\n", X FAILED "ghostscript Error. Maybe input is not PostScript?\n", X FAILED "unknown input format specified.\n", X FAILED "fatal sendfax error.\n" BUGGYMODEMT, X FAILED "fork() failed, no automatic retry.\n", X "Fax failed completely, always errors after " MAXRETRY " trials...\n" X}; X X Xchar *sfmsg[] = { X "", "", /* 0 1 */ X "Cannot open fax device" LATER, X "Error initializing modem" LATER BUGGYMODEMT, X "Line busy" LATER BUGGYMODEMT, /* 4 */ X "","","","","", /* 5 6 7 8 9 */ X "Error ocurred while dialing" LATER BUGGYMODEMT, X "", X "Error transmitting page(s)" LATER X}; X X#define PS 1 X#define G3 2 X Xtypedef struct { char *fstring; int fint; } fstruct; X Xstatic const fstruct formats[] = {{"ps", PS}, {"g3", G3}, {NULL, 0}}; X X#define TRUE 1 X#define FALSE 0 X X#ifdef DEBUG X#define D(a) { a; } X#else X#define D(a) {} X#endif X X Xchar *tmpf = NULL; X Xint rmfiles(); Xint do_rmfiles(); X Xmain(int argc, char *argv[]) X{ X#ifdef DEBUG X FILE *deb = fopen("/dev/console", "w"); X#endif X FILE *fptr; X char *cmd; X int l, i, ffarg, ev; X int rm = FALSE; X char *format = "ps"; X int iformat; X char *faxno = NULL; X int retry; X char *g3files; X fstruct *fs; X X log_init(); X X D(int ii; X fprintf(deb,"%s called, argc = %d args = ",argv[0],argc); X for (ii=1; iifstring != NULL; fs++) X if (strcmp(format, fs->fstring) == 0) iformat = fs->fint; X X switch (iformat) { X case PS: X signal(SIGTERM, rmfiles); X rm = TRUE; X X tmpf = malloc(50+strlen(faxno)); X X sprintf(tmpf,"%s/faxf-%s.%d",SPOOLDIR, faxno, getpid()); X X l=strlen(tmpf); X for (i = ffarg; i < argc; i++) l+=strlen(argv[i])+3; X X cmd = malloc(l+200); X log_status(INIT); X X sprintf(cmd,"%s -q -sDEVICE=dfaxhigh -dNOPAUSE -sOutputFile=%s.%%02d ", X GHOSTSCRIPT, tmpf); X for (i = ffarg; i < argc; i++) { X strcat(cmd, "\""); X strcat(cmd, argv[i]); X strcat(cmd, "\" "); X } X strcat(cmd, "< /dev/null"); X D(fprintf(deb,"faxiobe: cmdline=%s\n",cmd);); X system(cmd); X X sprintf(cmd,"%s.01", tmpf); X if ((fptr = fopen(cmd, "r")) == NULL) { X sysnot(get_to(), "", msg[2], MSGMOD); X exit(EXITOTHER+1); X } else fclose(fptr); X X g3files = malloc(strlen(tmpf)+3); X sprintf(g3files,"%s.??", tmpf); X free(cmd); X break; X case G3: X for (l = 0, i = ffarg; i < argc; i++) l+=strlen(argv[i])+3; X g3files = malloc(l+1); X for (i = ffarg; i < argc; i++) { X strcat(g3files, "\""); X strcat(g3files, argv[i]); X strcat(g3files, "\" "); X } X break; X default: X sysnot(get_to(), "", msg[3], MSGMOD); X exit(EXITOTHER+1); X break; X } X X cmd = malloc(strlen(g3files) + 80); X X#ifdef USE_NOFAX X sprintf(cmd,"%s \"%s\" %s", NOFAX, faxno, g3files); /**/ X#else X sprintf(cmd,"%s \"%s%s\" %s", SENDFAX, DIALPREF, faxno, g3files); /**/ X#endif X X retry = 0; X do { X log_percent(0); X log_status(SENDING); X D(fprintf(deb,"sendfax command=%s\n",cmd);); X ev = system(cmd) >> 8; X X D(fprintf(stderr,"exitval sendfax %d\n",ev);); X switch(ev) { X case 0: X ev = EXITOK; X break; X case 2: X case 3: X case 4: X case 10: X case 12: X if (retry==0) X sysnot(get_to(), "", sfmsg[ev], MSGMOD); X log_status(WAITING); X for (i=0; i < 10; i++) { X log_percent(10*i); /* hm, this doesn't work.... */ X D(fprintf(deb,"%d %% ",i);); X sleep(SLEEPTIME/10); X } X log_percent(0); X log_status(RUNNING); X retry++; X ev = RETRY; X break; X default: X sysnot(get_to(), "", msg[4], MSGMOD); X ev = EXITFATAL; X break; X } X } while (ev == RETRY && retry < atoi(MAXRETRY)); X X if (ev == RETRY) { X sysnot(get_to(), "", msg[6], MSGMOD); X ev = EXITOTHER+1; X } X X free(cmd); X if (rm) do_rmfiles(); X log_status(READY); X if (ev == EXITOK) log_charge(1); X exit(ev); X} X Xint rmfiles() { X do_rmfiles(); X exit(EXITSIGNAL); X} X Xint do_rmfiles() X{ X char *cmd; X if (tmpf == NULL) return(0); X cmd = malloc(strlen(tmpf) + 20); X sprintf(cmd, "/bin/rm -f %s.??", tmpf); X return(system(cmd)); X} X X SHAR_EOF $TOUCH -am 1115102793 faxiobe/faxiobe.c && chmod 0644 faxiobe/faxiobe.c || echo "restore of faxiobe/faxiobe.c failed" set `wc -c faxiobe/faxiobe.c`;Wc_c=$1 if test "$Wc_c" != "6146"; then echo original size 6146, current size $Wc_c fi # ============= faxiobe/nofax ============== echo "x - extracting faxiobe/nofax (Text)" sed 's/^X//' << 'SHAR_EOF' > faxiobe/nofax && X#!/bin/ksh X{ Xdate Xecho "Nofax called with $@" Xll $2 Xecho "exiting with $1" X}>/dev/console Xexit $1 SHAR_EOF $TOUCH -am 1113131693 faxiobe/nofax && chmod 0755 faxiobe/nofax || echo "restore of faxiobe/nofax failed" set `wc -c faxiobe/nofax`;Wc_c=$1 if test "$Wc_c" != "98"; then echo original size 98, current size $Wc_c fi exit 0 mgetty-1.2.1/contrib/faxmail-smail000066400000000000000000000062171334553713100171460ustar00rootroot00000000000000Newsgroups: de.comp.os.unix Path: greenie!colin.muc.de!lrz-muenchen.de!fauern!news.dfn.de!news.dkrz.de!ifmsun8.ifm.uni-hamburg.de!lutzifer!mwhh!solec!hb From: hb@solec.hanse.de (Heiko Bobzin) Subject: Re: Mail an user fax soll weggefaxt werden - elm-filter oder wie? References: <1993Jul22.183534.2705@panda.hanse.de> Organization: Software & Electronix, Altona, Hamburg Date: Fri, 23 Jul 1993 16:11:56 GMT Message-ID: <1993Jul23.161156.31520@solec.hanse.de> Lines: 85 michaelw@panda.hanse.de (Michael Will) writes: >Wie kann ich es einrichten, das jede mail die an den user fax geht >automatisch an das faxspool-script verfüttert wird? >Wer hat das Problem schon gelöst? Hier ! >All Information welcome :-) Ich hab das Ganze ins smail transports/routers eingebaut (leider hast Du vergessen, Deinen Mail-Transport-Agent anzugeben) in "/usr/local/lib/smail/routers" steht bei mir u.A.: FAXSPOOLER: transport=fax, driver=queryprogram; cmd="/usr/bin/test X${lc:host} = Xfax" und in "/usr/local/lib/smail/transports" noch dazu: fax: max_addrs=5, max_chars=200, +from, return_path, unix_from_hack, driver=pipe; cmd="/bin/sh -c /usr/bin/faxq $((${strip:addr})$)", parent_env Dann muss allerdings auch "uux" mit eingetragem sein, wenn noch nicht vorhanden (s. Manual-Page, je nach Deinen Einstellungen) Das Gute an "smail" ist, daß es so viele Environment- Variablen setzt (SENDER, BASENAME, ADDR ...) ! "faxq" konvertiert die Mails, die an @fax gehen, per "psf" und "ghostscript" nach G3. Das File wird dann in SPOOLDIR abgelegt. Ein Fax-Daemon holt die Dateien dort ab und verschickt sie per "mgetty/sendfax". Jetzt fehlt eigentlich nur noch "/usr/bin/faxq": # if [ "$SENDER" = "" ] ; then SENDER="$LOGNAME" ; fi if [ "$BASENAME" = "" ] ; then BASENAME="f.$SENDER.$$"; fi if [ "$ADDR" = "" ] ; then ADDR="$1"; File="$2" ; fi function do_error_check { if [ "X$?" != "X0" ] ; then ( echo -e "From: root (FAX SUBSYSTEM)\nTo: $SENDER\nSubject: Kann nicht senden $*\n\n" echo "$0: Dein Fax an $addr" echo "$0: Fehler-Ausgabe:" cat $tmp.err rm $tmp.* 2>/dev/null ) | /usr/lib/sendmail $SENDER exit 0 fi } # addr=`echo $ADDR | sed -e 's/@fax//'` tmp=/usr/spool/fax/tmp/$BASENAME.fax SPOOLDIR=/usr/spool/fax/outgoing case $SENDER in root) ;; # root darf faxen machen (he,he,) *) ( echo -e "From: MAILER_DAEMON (FAX SUBSYSTEM)\nTo: $SENDER\nSubject: Faxen an $addr\n\n" echo "$0: Dein Fax an $addr konnte nicht versandt werden." echo "$0: Bitte lass dich bei FaxMaster@sonstwo eintragen!" cat ) | /usr/lib/smail $SENDER exit 0 ;; esac # jobid=`date +'%H%M%S'` if [ "$File" = "" ] ; then ( awk ' { if (flag || match($0,"^From:") || match($0,"^Date:") || match($0,"^To:")) print ; if ($0 == "") flag++; } ' | tee $tmp.log | psf -g Fax | \ gs -sDEVICE=dfaxhigh -sOutputFile=$SPOOLDIR/$jobid.%02d -dQUIET ) 2>$tmp.err else echo | gs -sDEVICE=dfaxhigh -sOutputFile=$SPOOLDIR/$jobid.%02d -dQUIET $File 2>$tmp.err fi # echo "SENDER $SENDER ADDR $addr BASENAME $BASENAME" > $SPOOLDIR/$jobid.job do_error_check postscript-file -- "Die gefährlichsten Hacker sitzen bei der IBM und nicht im Knast." - IBM-Anzeige mgetty-1.2.1/contrib/frame40ps.fix000066400000000000000000000141321334553713100170030ustar00rootroot00000000000000From owner-mgetty Fri Aug 18 19:28:01 1995 Return-Path: Received: by greenie.muc.de (/\==/\ Smail3.1.24.1 #24.2) id ; Fri, 18 Aug 95 19:28 MEST Return-Path: Received: by greenie.muc.de (/\==/\ Smail3.1.24.1 #24.2) id ; Fri, 18 Aug 95 19:27 MEST Received: from lilly.ping.de ([193.100.14.2]) by colin.muc.de with SMTP id <41359-1>; Fri, 18 Aug 1995 19:27:11 +0200 Received: from cliwe.ping.de by lilly.ping.de with smtp (Smail3.1.28.1 #4) id m0sjUwL-000oo6C; Fri, 18 Aug 95 19:10 MET DST From: fdc@cliwe.ping.de (Frank D. Cringle) Date: Fri, 18 Aug 1995 19:19:25 +0200 Message-Id: <9508181719.AA11601@cliwe.ping.de> Received: by cliwe.ping.de (5.0/GEN-1.0.17-fdc) id AA11601; Fri, 18 Aug 95 19:19:25 +0200 To: mgetty@muc.de In-Reply-To: gert@greenie.muc.de's message of Wed, 16 Aug 1995 19:48:45 +0200 Subject: Re: output from gs3.33 References: <199508152346.QAA21503@hyla.chez.sgi.com> content-length: 0 Status: RO gert@greenie.muc.de (Gert Doering) writes: [ ... ] >This part seems to be responsible for it... looks weird. > > {{1 dict dup /PageSize [paperwidth paperheight]put setpagedevice }stopped > { (Can't select requested paper size for Frame print job!) FMFAILURE } if > {1 dict dup /ManualFeed manualfeed put setpagedevice } stopped pop } > >Does anyone have an idea how to "fix" those documents? OK, I admit it. I have a brain like a sieve! Attached below is a posting by Konstantin Laufer that I saved a few months ago and promptly forgot all about. After applying his patch to a private copy of the frame ps_prolog my scanlines are 1728 pixels long like they should be. Before I rediscovered this treasure I mucked about with gs3 and found that the width is initially set to 1728 (or 2048) in gdev_fax_open() but is subsequently recalculated by gx_device_set_page_size() based on the resolution. It is possible to reset the pdev->width to 1728 in gdev_fax_init_state() and get the desired output, but whether this is a satisfactory fix is beyond me. Did we ever find out what the cause of R"udiger Jacob's original problem was? ---------------------------------------------------------------- |From laufer@math.luc.edu Fri Apr 14 13:45:04 1995 |Path: cliwe.ping.de!ping.de!Germany.EU.net!howland.reston.ans.net!vixen.cso.uiuc.edu!uchinews!apollo!math.luc.edu!laufer |From: laufer@math.luc.edu (Konstantin Laufer) |Newsgroups: comp.text.frame |Subject: Re: US letter vs A4 Letter (solution) |Date: 25 Mar 1995 01:39:02 GMT |Organization: Loyola University Chicago |Lines: 90 |Distribution: world |Message-ID: <3kvs7m$n5f@apollo.it.luc.edu> |References: <3k20ll$mev@klaatu.btv.ibm.com> <3kusjt$bjc@louhi.to.icl.fi> |NNTP-Posting-Host: schauinsland.math.luc.edu In article <3kusjt$bjc@louhi.to.icl.fi>, ippa@to.icl.fi (Ritva Koivisto) writes: > In article <3k20ll$mev@klaatu.btv.ibm.com>, warfield@btv.ibm.com (David R. Warfield) says: > > >FrameMaker seems to explicitly put a lot of printer specific > >information right into the postscript file such as paper tray > >(that's burned me a few times), manual feed, and horizontal and > >vertcial size. I suspect that is why this user had to manually > >eject the page. Can anyone confirm this? Is there a way to > >generate one postscript file from FM that can be used for both > >US letter and A4 letter size? > > Was the error message something like "load letter"? If so, > sounds familiar... My guess is that the error message was the following, taken directly >from $FMHOME/fminit/ps_prolog, where it occurs in two places: Can't select requested paper size for Frame print job! Checking the page size is a new "feature" in FM 4. It is the reason why PostScript files generated by Frame for US Letter cannot be printed on an A4 printer any more and vice versa. Why is this a problem? Because many papers are exchanged *as PS files* between parties in different parts of the world. Here is a fix: 1) Use the following patch (context diff) to remove the repressive size checking from $FMHOME/fminit/ps_prolog. The patched file can go into your personal fminit directory as ~/fminit/ps_prolog. The files generated with the new prolog can be used for either page size. *** /usr/local/software/Xframe4.0/fminit/ps_prolog Tue Feb 1 17:00:56 1994 --- /home/laufer/fminit/ps_prolog Fri Mar 24 13:42:25 1995 *************** *** 653,668 **** /FMoptop count def setpapername manualfeed {true} {papersize} ifelse ! {manualpapersize} {false} ifelse ! {desperatepapersize} {false} ifelse ! { (Can't select requested paper size for Frame print job!) FMFAILURE } if count -1 FMoptop {pop pop} for countdictstack -1 FMdicttop {pop end} for } ! {{1 dict dup /PageSize [paperwidth paperheight]put setpagedevice}stopped ! { (Can't select requested paper size for Frame print job!) FMFAILURE } if ! {1 dict dup /ManualFeed manualfeed put setpagedevice } stopped pop } ! ifelse FMPColor { currentcolorscreen --- 653,663 ---- /FMoptop count def setpapername manualfeed {true} {papersize} ifelse ! {manualpapersize} if count -1 FMoptop {pop pop} for countdictstack -1 FMdicttop {pop end} for } ! if FMPColor { currentcolorscreen 2) A tiny sed script to change the page sizes in existing PS files >from A4 to US Letter. Alternatively, you may directly apply the patch above to the PS files. #! /bin/sh tmpfile=${TMPDIR-/tmp}/fmfixa4.$$ for file in $*; do sed -e "s/595 842/612 792/" < $file > $tmpfile mv $file $file.backup mv $tmpfile $file done To convert from US Letter to A4, change the sed line to this: sed -e "s/612 792/595 842/" < $file > $tmpfile Disclaimer: This stuff is provided as is without any kind of warranty. I use it with Frame 4 on SunOS 4.1.3. I hope it is helpful. Please post improvements to this group. -- Konstantin Laufer@math.luc.edu KL -- Frank Cringle | fdc@cliwe.ping.de voice + fax | +49 2304 467101 mgetty-1.2.1/contrib/g3hack.c000066400000000000000000000134651334553713100160060ustar00rootroot00000000000000/* * From owner-mgetty Wed Jun 28 02:08:30 1995 * Return-Path: * Received: by greenie.muc.de (/\==/\ Smail3.1.24.1 #24.2) * id ; Wed, 28 Jun 95 02:08 MEST * Return-Path: * Received: by greenie.muc.de (/\==/\ Smail3.1.24.1 #24.2) * id ; Wed, 28 Jun 95 02:08 MEST * Received: from greenie.muc.de ([193.174.4.62]) by colin.muc.de with SMTP id <25543-2>; Wed, 28 Jun 1995 02:08:14 +0200 * Received: by greenie.muc.de (/\==/\ Smail3.1.24.1 #24.2) * id ; Wed, 28 Jun 95 01:59 MEST * Received: from GATEWAY by greenie.muc.de with netnews * for mgetty@muc.de (mgetty@muc.de) * To: mgetty@muc.de * Date: Sat, 24 Jun 1995 21:26:42 +0200 * From: fdc@cliwe.ping.de (Frank D. Cringle) * Message-ID: * Organization: calls for speculation * References: * Subject: Save the forests (was: Conversion ascii->g3) * Status: RO * * gert@greenie.muc.de (Gert Doering) writes: * >Erlend Schei wrote: * >> Any recommendations (perhaps som script-gurus who know how to make * >> gslp skip the white stuff at the end of the last page)? * > * >I'd like to see that too. I don't think it's easy, you'll have to hack the * >dfaxhigh (or faxg3) driver, I think. * * Here is a nasty little hack that will chop the end off a g3 file. It * is nasty 'cos it only works for single-page 1d-encoded files with * msbfirst bit order. But that is what mgetty uses at present, so what * the hell. * * It is rather cool in the way that it decides what to chop. All * identical lines at the end of the page are candidates and any more * than 10 (by default) are discarded. It does not matter whether they * are white, black or striped. * * I leave it to a competent shell programmer to integrate it into the * faxspool script. * * ---------------------------------------------------------------- */ /* g3hack.c - hack identical lines off the end of a fax * * This program is in the public domain. If it does not work or * causes you any sort of grief, blame the public, not me. * * fdc@cliwe.ping.de, 1995-06-24 * * $Id: g3hack.c,v 1.2 2006/06/14 10:33:14 gert Exp $ * * $Log: g3hack.c,v $ * Revision 1.2 2006/06/14 10:33:14 gert * add to silence compiler warnings * add ibits=0 to silence compiler warning * (the code was correct, but the compiler didn't see this...) * */ #include #include #include extern int getopt(); extern char *optarg; extern int optind, opterr; char *usage = "usage: %s <-n count> <-h size> -o \n\n\ Copy a g3-(1d)-fax file from stdin to stdout and delete any\n\ more than `count' identical trailing lines (default 10).\n\ Optionally skip `size'-byte header.\n\ Optionally named outputfile (else stdout).\n"; #define nxtbit() ((imask>>=1) ? ((ibits&imask)!=0) : \ ((ibits=getchar()) == EOF) ? -1 : \ (((imask=0x80)&ibits)!=0)) #define putbit(b) \ do { \ if (b) \ obits |= omask; \ if ((omask >>= 1) == 0) { \ this->line[this->length>>3] = obits; \ omask = 0x80; \ obits = 0; \ } \ this->length++; \ if (this->length >= BUFSIZ<<3) { \ fputs("g3hack: unreasonably long line\n", stderr); \ exit(1); \ } \ } while (0) static void copy(int nlines) { int ibits = 0, imask = 0; /* input bits and mask */ int obits = 0; /* output bits */ int omask = 0x80; /* output mask */ int zeros = 0; /* number of consecutive zero bits */ int thisempty = 1; /* empty line (so far) */ int empties = 0; /* number of consecutive EOLs */ int identcount = 0; /* number of consecutive identical lines */ struct { char line[BUFSIZ]; int length; } lines[2], *prev, *this, *temp; this = &lines[0]; prev = &lines[1]; this->length = prev->length = 0; while (!ferror(stdout)) { int bit = nxtbit(); if (bit == -1) break; /* end of file */ putbit(bit); if (bit == 0) { zeros++; continue; } if (zeros < 11) { /* not eol and not empty */ zeros = 0; thisempty = 0; for ( ; empties; empties--) fwrite("\0\1", 1, 2, stdout); continue; } /* at end of line */ zeros = 0; omask = 0x80; obits = 0; if (thisempty) { empties++; if (empties >= 6) break; this->length = 0; continue; } thisempty = 1; /* at end of non-empty line */ identcount++; this->length = (this->length+7)&~7; this->line[(this->length-1)>>3] = 1; /* byte-align the eol */ if (this->length == prev->length && memcmp(this->line, prev->line, this->length>>3) == 0) { this->length = 0; continue; } /* at end of non-matching line */ for ( ; identcount; identcount--) fwrite(prev->line, 1, prev->length>>3, stdout); temp = prev; prev = this; this = temp; this->length = 0; } if (identcount > nlines) identcount = nlines; for ( ; !ferror(stdout) && identcount; identcount--) fwrite(prev->line, 1, prev->length>>3, stdout); for ( ; !ferror(stdout) && empties; empties--) fwrite("\0\1", 1, 2, stdout); if (ferror(stdout)) { fputs("write error\n", stderr); exit(1); } } int main(int argc, char **argv) { int c; int header = 0; int nlines = 10; opterr = 0; while ((c = getopt(argc, argv, "h:n:o:")) != EOF) switch (c) { case 'h': header = atoi(optarg); break; case 'n': nlines = atoi(optarg); break; case 'o': if (freopen(optarg, "w", stdout) == NULL) { perror(optarg); exit(1); } break; case '?': fprintf(stderr, usage, argv[0]); exit(1); } while (header--) putchar(getchar()); copy(nlines); exit(0); } /* * -- * Frank Cringle | fdc@cliwe.ping.de * voice + fax | +49 2304 467101 */ mgetty-1.2.1/contrib/g3tolj.1000066400000000000000000000043711334553713100157620ustar00rootroot00000000000000.TH g3tolj 1 "22 may 94" "Chel" "mgetty+sendfax manual" .IX g3tolj .SH NAME g3tolj \- converts a Group 3 fax file into a printable HP-PCL file .SH SYNOPSIS .B g3tolj .RB [ -kludge ] .RB [ -reversebits ] .RB [ -scale\ N ] .RB [ -aspect\ N ] .RB [ -resolution\ 75|100|150|300 ] .RB [ -compress\ 0|1|2 ] .RB [ -pagelength\ N ] .RB [ -duplength\ N ] .RI [ g3file ] .SH DESCRIPTION Reads a Group 3 fax file (raw or digifax) as input. If no filename is given, stdin is used. .IX "Group 3 fax" .IX fax Produces a printable HP-PCL file as output. .SH OPTIONS .TP .B -kludge Tells .I g3tolj to skip the first lines for synchronisation. .TP .B -reversebits Tells .I g3tolj to interpret bits least-significant first, instead of the default most-significant first. Apparently some fax modems do it one way and others do it the other way. If you get a whole bunch of "invalid code" messages, try using this flag. .TP .B -scale N Scale the output to match the printer resolution and paper size, the default of 1.40 will do in most cases. .TP .B -aspect N Scale the output to match the printer resolution and paper size, the default of 1.0 will do for high resolution faxes, 2.0 will do for low resolution faxes. .TP .B -resolution 75|100|150|300 Selects print resolution. The default is 300. .TP .B -compress 0|1|2 Selects compression method for the print output. 0 = none, 1 = rll, 2 = tiff. The default is 0. .TP .B -pagelength N Defines the pagelength in inches, the default is 10.95. After this length a pagebreak is generated and the last part of the previous page is duplicated on the next page .TP .B -duplength N Defines the length in inches that will be duplicated after a pagebreak, The default is 0.7. .SH REFERENCES The standard for Group 3 fax is defined in CCITT Recommendation T.4. .SH BUGS Please report bugs to chel@vangennip.nl .SH "SEE ALSO" pbmtog3(1), pbm(5), g3cat(1), sendfax(8), mgetty(1) .SH AUTHOR .I g3tolj is Copyright (C) 1994 by Chel van Gennip, . Sources of .I g3topbm and .I pbmtolj programs in Jef Poskanzers .I pbmplus package have been used, but al lot of code has been changed or added to simplify its use for printing faxes. Value added: low use of memory, fast scaling, printing of long faxes with page breaks, print file compression (by John Watson) mgetty-1.2.1/contrib/g3tolj.c000066400000000000000000000506041334553713100160440ustar00rootroot00000000000000/* g3topbm.c - read a Group 3 FAX file and produce a portable bitmap * * * Copyright (C) 1989 by Paul Haeberli . * * * gcc -g -o g3tolj -O2 g3tolj.c * * Permission to use, copy, modify, and distribute this software and its * * documentation for any purpose and without fee is hereby granted, provided * * that the above copyright notice appear in all copies and that both that * * copyright notice and this permission notice appear in supporting * * documentation. This software is provided "as is" without express or * * implied warranty. * * * * pbmtolj.c - read a portable bitmap and produce a LaserJet bitmap file * * * based on pbmtops.c * * * Michael Haberler HP Vienna mah@hpuviea.uucp * mcvax!tuvie!mah * * misfeatures: o positioning * * * Bug fix Dec 12, 1988 : * * lines in putbit() reshuffled now runs OK on HP-UX 6.0 with X10R4 and HP * Laserjet II * * Bo Thide', Swedish Institute of Space Physics, Uppsala * * * * Copyright (C) 1988 by Jef Poskanzer and Michael Haberler. * * Copyright (C) 1993 by Chel van Gennip. * * Update aug 31,1993, Chel van Gennip, combined g3topbm and pbmtolj, removed * 8MB array, added simple scaling to improve speed, * * From: "John Watson -- Self Empl. Sys.Integrator" * * Date: Tue, 11 Jan 94 11:11:03 EST * * Thankyou for sending me this conversion program. * * I found that it generated huge files that took a long time to send to the * laser printer (serial port), so I added a -compress [012] option to * compress the data. Not very "cute" but it works. Some printers are not * capable like the Panasonic KX-P4450i, where I must still use -co 0, most * others can do -co 2, which is much better. * * Update 22 may 1994 Chel van Gennip Better handling of EOF of input files * Support for long faxes * * $Log: g3tolj.c,v $ * Revision 1.2 2003/10/03 11:36:02 gert * fix some return types and prototypes (Debian/ABA) * * Revision 1.1 2003/10/03 11:34:41 gert * G3 -> HP PCL bitmap, initial checkin * * */ /* #include "pbm.h" */ #include #include #include #include typedef unsigned char bit; #define PBM_WHITE 0 #define PBM_BLACK 1 #define pm_error(a,b,c,d,e,f) {fprintf(stderr,a,b,c,d,e,f);fprintf(stderr,"\n");} #define pm_message(a,b,c,d,e,f) {fprintf(stderr,a,b,c,d,e,f);fprintf(stderr,"\n");} #define pm_usage(a) { fprintf(stderr,"usage: %s\n",a) ; exit(7) ;} #define pbm_allocrow(a) (bit*)malloc(a) /* g3.h - header file for group 3 FAX compression filters from pm package */ #ifndef _G3_H_ #define _G3_H_ typedef struct tableentry { int tabid; int code; int length; int count; } tableentry; #define TWTABLE 23 #define MWTABLE 24 #define TBTABLE 25 #define MBTABLE 26 #define EXTABLE 27 #define VRTABLE 28 static struct tableentry twtable[]= { {TWTABLE, 0x35, 8, 0}, {TWTABLE, 0x7, 6, 1}, {TWTABLE, 0x7, 4, 2}, {TWTABLE, 0x8, 4, 3}, {TWTABLE, 0xb, 4, 4}, {TWTABLE, 0xc, 4, 5}, {TWTABLE, 0xe, 4, 6}, {TWTABLE, 0xf, 4, 7}, {TWTABLE, 0x13, 5, 8}, {TWTABLE, 0x14, 5, 9}, {TWTABLE, 0x7, 5, 10}, {TWTABLE, 0x8, 5, 11}, {TWTABLE, 0x8, 6, 12}, {TWTABLE, 0x3, 6, 13}, {TWTABLE, 0x34, 6, 14}, {TWTABLE, 0x35, 6, 15}, {TWTABLE, 0x2a, 6, 16}, {TWTABLE, 0x2b, 6, 17}, {TWTABLE, 0x27, 7, 18}, {TWTABLE, 0xc, 7, 19}, {TWTABLE, 0x8, 7, 20}, {TWTABLE, 0x17, 7, 21}, {TWTABLE, 0x3, 7, 22}, {TWTABLE, 0x4, 7, 23}, {TWTABLE, 0x28, 7, 24}, {TWTABLE, 0x2b, 7, 25}, {TWTABLE, 0x13, 7, 26}, {TWTABLE, 0x24, 7, 27}, {TWTABLE, 0x18, 7, 28}, {TWTABLE, 0x2, 8, 29}, {TWTABLE, 0x3, 8, 30}, {TWTABLE, 0x1a, 8, 31}, {TWTABLE, 0x1b, 8, 32}, {TWTABLE, 0x12, 8, 33}, {TWTABLE, 0x13, 8, 34}, {TWTABLE, 0x14, 8, 35}, {TWTABLE, 0x15, 8, 36}, {TWTABLE, 0x16, 8, 37}, {TWTABLE, 0x17, 8, 38}, {TWTABLE, 0x28, 8, 39}, {TWTABLE, 0x29, 8, 40}, {TWTABLE, 0x2a, 8, 41}, {TWTABLE, 0x2b, 8, 42}, {TWTABLE, 0x2c, 8, 43}, {TWTABLE, 0x2d, 8, 44}, {TWTABLE, 0x4, 8, 45}, {TWTABLE, 0x5, 8, 46}, {TWTABLE, 0xa, 8, 47}, {TWTABLE, 0xb, 8, 48}, {TWTABLE, 0x52, 8, 49}, {TWTABLE, 0x53, 8, 50}, {TWTABLE, 0x54, 8, 51}, {TWTABLE, 0x55, 8, 52}, {TWTABLE, 0x24, 8, 53}, {TWTABLE, 0x25, 8, 54}, {TWTABLE, 0x58, 8, 55}, {TWTABLE, 0x59, 8, 56}, {TWTABLE, 0x5a, 8, 57}, {TWTABLE, 0x5b, 8, 58}, {TWTABLE, 0x4a, 8, 59}, {TWTABLE, 0x4b, 8, 60}, {TWTABLE, 0x32, 8, 61}, {TWTABLE, 0x33, 8, 62}, {TWTABLE, 0x34, 8, 63}, }; static struct tableentry mwtable[]= { {MWTABLE, 0x1b, 5, 64}, {MWTABLE, 0x12, 5, 128}, {MWTABLE, 0x17, 6, 192}, {MWTABLE, 0x37, 7, 256}, {MWTABLE, 0x36, 8, 320}, {MWTABLE, 0x37, 8, 384}, {MWTABLE, 0x64, 8, 448}, {MWTABLE, 0x65, 8, 512}, {MWTABLE, 0x68, 8, 576}, {MWTABLE, 0x67, 8, 640}, {MWTABLE, 0xcc, 9, 704}, {MWTABLE, 0xcd, 9, 768}, {MWTABLE, 0xd2, 9, 832}, {MWTABLE, 0xd3, 9, 896}, {MWTABLE, 0xd4, 9, 960}, {MWTABLE, 0xd5, 9, 1024}, {MWTABLE, 0xd6, 9, 1088}, {MWTABLE, 0xd7, 9, 1152}, {MWTABLE, 0xd8, 9, 1216}, {MWTABLE, 0xd9, 9, 1280}, {MWTABLE, 0xda, 9, 1344}, {MWTABLE, 0xdb, 9, 1408}, {MWTABLE, 0x98, 9, 1472}, {MWTABLE, 0x99, 9, 1536}, {MWTABLE, 0x9a, 9, 1600}, {MWTABLE, 0x18, 6, 1664}, {MWTABLE, 0x9b, 9, 1728}, }; static struct tableentry tbtable[]= { {TBTABLE, 0x37, 10, 0}, {TBTABLE, 0x2, 3, 1}, {TBTABLE, 0x3, 2, 2}, {TBTABLE, 0x2, 2, 3}, {TBTABLE, 0x3, 3, 4}, {TBTABLE, 0x3, 4, 5}, {TBTABLE, 0x2, 4, 6}, {TBTABLE, 0x3, 5, 7}, {TBTABLE, 0x5, 6, 8}, {TBTABLE, 0x4, 6, 9}, {TBTABLE, 0x4, 7, 10}, {TBTABLE, 0x5, 7, 11}, {TBTABLE, 0x7, 7, 12}, {TBTABLE, 0x4, 8, 13}, {TBTABLE, 0x7, 8, 14}, {TBTABLE, 0x18, 9, 15}, {TBTABLE, 0x17, 10, 16}, {TBTABLE, 0x18, 10, 17}, {TBTABLE, 0x8, 10, 18}, {TBTABLE, 0x67, 11, 19}, {TBTABLE, 0x68, 11, 20}, {TBTABLE, 0x6c, 11, 21}, {TBTABLE, 0x37, 11, 22}, {TBTABLE, 0x28, 11, 23}, {TBTABLE, 0x17, 11, 24}, {TBTABLE, 0x18, 11, 25}, {TBTABLE, 0xca, 12, 26}, {TBTABLE, 0xcb, 12, 27}, {TBTABLE, 0xcc, 12, 28}, {TBTABLE, 0xcd, 12, 29}, {TBTABLE, 0x68, 12, 30}, {TBTABLE, 0x69, 12, 31}, {TBTABLE, 0x6a, 12, 32}, {TBTABLE, 0x6b, 12, 33}, {TBTABLE, 0xd2, 12, 34}, {TBTABLE, 0xd3, 12, 35}, {TBTABLE, 0xd4, 12, 36}, {TBTABLE, 0xd5, 12, 37}, {TBTABLE, 0xd6, 12, 38}, {TBTABLE, 0xd7, 12, 39}, {TBTABLE, 0x6c, 12, 40}, {TBTABLE, 0x6d, 12, 41}, {TBTABLE, 0xda, 12, 42}, {TBTABLE, 0xdb, 12, 43}, {TBTABLE, 0x54, 12, 44}, {TBTABLE, 0x55, 12, 45}, {TBTABLE, 0x56, 12, 46}, {TBTABLE, 0x57, 12, 47}, {TBTABLE, 0x64, 12, 48}, {TBTABLE, 0x65, 12, 49}, {TBTABLE, 0x52, 12, 50}, {TBTABLE, 0x53, 12, 51}, {TBTABLE, 0x24, 12, 52}, {TBTABLE, 0x37, 12, 53}, {TBTABLE, 0x38, 12, 54}, {TBTABLE, 0x27, 12, 55}, {TBTABLE, 0x28, 12, 56}, {TBTABLE, 0x58, 12, 57}, {TBTABLE, 0x59, 12, 58}, {TBTABLE, 0x2b, 12, 59}, {TBTABLE, 0x2c, 12, 60}, {TBTABLE, 0x5a, 12, 61}, {TBTABLE, 0x66, 12, 62}, {TBTABLE, 0x67, 12, 63}, }; static struct tableentry mbtable[]= { {MBTABLE, 0xf, 10, 64}, {MBTABLE, 0xc8, 12, 128}, {MBTABLE, 0xc9, 12, 192}, {MBTABLE, 0x5b, 12, 256}, {MBTABLE, 0x33, 12, 320}, {MBTABLE, 0x34, 12, 384}, {MBTABLE, 0x35, 12, 448}, {MBTABLE, 0x6c, 13, 512}, {MBTABLE, 0x6d, 13, 576}, {MBTABLE, 0x4a, 13, 640}, {MBTABLE, 0x4b, 13, 704}, {MBTABLE, 0x4c, 13, 768}, {MBTABLE, 0x4d, 13, 832}, {MBTABLE, 0x72, 13, 896}, {MBTABLE, 0x73, 13, 960}, {MBTABLE, 0x74, 13, 1024}, {MBTABLE, 0x75, 13, 1088}, {MBTABLE, 0x76, 13, 1152}, {MBTABLE, 0x77, 13, 1216}, {MBTABLE, 0x52, 13, 1280}, {MBTABLE, 0x53, 13, 1344}, {MBTABLE, 0x54, 13, 1408}, {MBTABLE, 0x55, 13, 1472}, {MBTABLE, 0x5a, 13, 1536}, {MBTABLE, 0x5b, 13, 1600}, {MBTABLE, 0x64, 13, 1664}, {MBTABLE, 0x65, 13, 1728}, }; static struct tableentry extable[]= { {EXTABLE, 0x8, 11, 1792}, {EXTABLE, 0xc, 11, 1856}, {EXTABLE, 0xd, 11, 1920}, {EXTABLE, 0x12, 12, 1984}, {EXTABLE, 0x13, 12, 2048}, {EXTABLE, 0x14, 12, 2112}, {EXTABLE, 0x15, 12, 2176}, {EXTABLE, 0x16, 12, 2240}, {EXTABLE, 0x17, 12, 2304}, {EXTABLE, 0x1c, 12, 2368}, {EXTABLE, 0x1d, 12, 2432}, {EXTABLE, 0x1e, 12, 2496}, {EXTABLE, 0x1f, 12, 2560}, }; #endif /* _G3_H_ */ void skiptoeol (void); FILE * pm_openr (name) char *name; { FILE *f; if (strcmp (name, "-") == 0) f = stdin; else { f = fopen (name, "r"); if (f == NULL) { perror (name); exit (1); } } return f; } int pm_keymatch (str, keyword, minchars) char *str; char *keyword; int minchars; { register int len; len = strlen (str); if (len < minchars) return 0; while (--len >= 0) { register char c1, c2; c1 = *str++; c2 = *keyword++; if (c2 == '\0') return 0; if (isupper (c1)) c1 = tolower (c1); if (isupper (c2)) c1 = tolower (c2); if (c1 != c2) return 0; } return 1; } static int dpi = 300; static int doubleheight = 1; static hscale = 100; static vscale = 100; static int cmode = 0; /* compression mode, 1=rll, 2=tiff */ static void putinit (), putbit (), putrest (), putitem (); static int item, bitsperitem; static char *line; static int bytecnt; #define TABSIZE(tab) (sizeof(tab)/sizeof(struct tableentry)) #define MAXCOLS 1728 #define MAXROWS 43000 /* up to 20 pages long */ #define MAXHIST 500 int eof = 0; int eols; int rawzeros; int shdata; int kludge; int reversebits; int stretch; #define WHASHA 3510 #define WHASHB 1178 #define BHASHA 293 #define BHASHB 2695 #define HASHSIZE 1021 tableentry *whash[HASHSIZE]; tableentry *bhash[HASHSIZE]; static FILE *ifp; static int shbit = 0; static int eof_err = 0; static inline int rawgetbit () { int b; if (eof_err) { rawzeros = 20; return (1); } if ((shbit & 0xff) == 0) { shdata = getc (ifp); if (shdata == EOF) { eof_err++; pm_error ("EOF / read error at line %d", eols, 0, 0, 0, 0); } shbit = reversebits ? 0x01 : 0x80; } if (shdata & shbit) { rawzeros = 0; b = 1; } else { rawzeros++; b = 0; } if (reversebits) shbit <<= 1; else shbit >>= 1; return b; } addtohash (hash, te, n, a, b) tableentry *hash[]; tableentry *te; int n, a, b; { unsigned int pos; while (n--) { pos = ((te->length + a) * (te->code + b)) % HASHSIZE; if (hash[pos] != 0) pm_error ( "internal error: addtohash fatal hash collision", 0, 0, 0, 0, 0); hash[pos] = te; te++; } } static inline tableentry * hashfind (hash, length, code, a, b) tableentry *hash[]; int length, code; int a, b; { unsigned int pos; tableentry *te; pos = ((length + a) * (code + b)) % HASHSIZE; if (pos < 0 || pos >= HASHSIZE) pm_error ( "internal error: bad hash position, length %d code %d pos %d", length, code, pos, 0, 0); te = hash[pos]; return ((te && te->length == length && te->code == code) ? te : 0); } getfaxrow (row, bitrow) int row; bit *bitrow; { int col; bit *bP; int curlen, curcode, nextbit; int count, color; tableentry *te; for (col = 0, bP = bitrow; col < MAXCOLS; ++col, ++bP) *bP = PBM_WHITE; col = 0; rawzeros = 0; curlen = 0; curcode = 0; color = 1; count = 0; while (!eof) { if (col >= MAXCOLS) { skiptoeol (); return (col); } do { if (rawzeros >= 11) { nextbit = rawgetbit (); if (nextbit) { if (col == 0) /* XXX should be 6 */ eof = (++eols == 3); else eols = 0; #ifdef notdef if (col && col < 1728) pm_message ( "warning, row %d short (len %d)", row, col, 0, 0, 0); #endif /* notdef */ return (col); } } else nextbit = rawgetbit (); curcode = (curcode << 1) + nextbit; curlen++; } while (curcode <= 0); if (curlen > 13) { pm_message ( "bad code word at row %d, col %d (len %d code 0x%x), skipping to EOL", row, col, curlen, curcode, 0); skiptoeol (); return (col); } if (color) { if (curlen < 4) continue; te = hashfind (whash, curlen, curcode, WHASHA, WHASHB); } else { if (curlen < 2) continue; te = hashfind (bhash, curlen, curcode, BHASHA, BHASHB); } if (!te) continue; switch (te->tabid) { case TWTABLE: case TBTABLE: count += te->count; if (col + count > MAXCOLS) count = MAXCOLS - col; if (count > 0) { if (color) { col += count; count = 0; } else { for (; count > 0; --count, ++col) bitrow[col] = PBM_BLACK; } } curcode = 0; curlen = 0; color = !color; break; case MWTABLE: case MBTABLE: count += te->count; curcode = 0; curlen = 0; break; case EXTABLE: count += te->count; curcode = 0; curlen = 0; break; default: pm_error ("internal bad poop", 0, 0, 0, 0, 0); } } return (0); } void skiptoeol () { while (rawzeros < 11) (void) rawgetbit (); for (;;) { if (rawgetbit ()) break; } } static void putinit () { /* Printer reset. */ printf ("\033E"); printf ("\033*rB"); printf ("\033*t%dR", dpi); /* Set raster graphics resolution */ /* move to top left of page & set current position */ printf ("\033&l26A"); /* A4 size */ printf ("\033&l0L"); /* Don't skip perforation */ printf ("\033&l0E"); /* Top margin 0 */ printf ("\033*p0x0Y"); printf ("\033*r1A"); /* Start raster graphics, relative adressing */ /* printf("\033*b2M"); */ printf ("\033*b%dM", cmode);/* set compression mode, 1=rll */ } int o_item = -1; int oo_item = -1; char *cb; /* command byte */ static void putitem () { if (cmode == 1) { if (item == o_item && ((unsigned char) (line[bytecnt - 2]) < 255)) { ++line[bytecnt - 2]; bitsperitem = item = 0; return; } line[bytecnt++] = 0; /* repeat count of one */ line[bytecnt++] = o_item = item; bitsperitem = 0; item = 0; return; } if (cmode == 2) { /* if running repeat, continue if same char again */ if (item == o_item && cb != NULL && *cb < 1 && *cb > -127) { --*cb; bitsperitem = item = 0; return; } /* if running literal see last two same as next and switch to repeat */ if (cb != NULL && *cb > 0 && o_item == oo_item && o_item == item) { *cb -= 2; cb = &line[bytecnt - 2]; *cb = -2; bitsperitem = item = 0; return; } /* if running literal add next byte to string */ if (cb != NULL && *cb >= 0 && *cb < 127) { ++*cb; oo_item = o_item; line[bytecnt++] = o_item = item; bitsperitem = item = 0; return; } /* start new literal */ cb = &line[bytecnt]; line[bytecnt++] = 0; /* repeat count of one */ line[bytecnt++] = o_item = item; oo_item = -1; bitsperitem = 0; item = 0; return; } line[bytecnt++] = item; bitsperitem = 0; item = 0; } static void putbit (b) bit b; { if (b == PBM_BLACK) item += 1 << (7 - bitsperitem); bitsperitem++; if (bitsperitem == 8) { putitem (); } } static void putrest () { /* end raster graphics */ printf ("\033*rB"); /* Printer reset. */ printf ("\033E"); } static struct { int bytecnt; char *line; } hist[MAXHIST]; static int maxhist = MAXHIST; static int histidx = 0; static int lncnt = 0; static int maxline = 11 * 300; newpage (FILE * fd) { int i; putrest (); putinit (); lncnt = 0; for (i = 0; i < maxhist; i++) { fprintf (fd, "\033*b%dW", hist[histidx].bytecnt); fwrite (hist[histidx].line, sizeof (char), hist[histidx].bytecnt, fd); histidx++; if (histidx >= maxhist) histidx = 0; lncnt++; } } static void lj_writerow (FILE * fd, bit * writerow, int wcols) { int i; oo_item = o_item = -1; cb = NULL; item = 0; bytecnt = 0; bitsperitem = 0; for (i = 0; i < wcols; i++) putbit (writerow[i]); if (bitsperitem > 0) putitem (); fprintf (fd, "\033*b%dW", bytecnt); fwrite (line, sizeof (char), bytecnt, fd); hist[histidx].bytecnt = bytecnt; histidx++; if (histidx >= maxhist) histidx = 0; line = hist[histidx].line; lncnt++; if (lncnt > maxline) newpage (fd); }; int main (argc, argv) int argc; char *argv[]; { int argn, rows, wrows, cols, wcols, row, wrow, col, wcol, i; int vval, hval; bit *readrow, *writerow, *bP, *wbP, bitval; float aspect, scale, pagelength, duplength; int format; register int nzcol; char *usage = " g3tolj [-kludge] [-reversebits] [-scale N] [-aspect N]" "\n\t[-resolution 75|100|150|300] [-compress 0|1|2] [-pagelength N]" "\n\t[-duplength N] [g3file]" "\n\tDefaults -sc 1.4 -as 1.0 -re 300 -co 0 -pa 10.95 -du 0.7"; argn = 1; kludge = 0; reversebits = 0; aspect = 1.0; scale = 1.4; pagelength = 10.95; duplength = 0.7; /* Check for flags. */ while (argn < argc && argv[argn][0] == '-' && argv[argn][1] != '\0') { if (pm_keymatch (argv[argn], "-kludge", 2)) kludge = 1; else if (pm_keymatch (argv[argn], "-reversebits", 2)) reversebits = 1; else if (pm_keymatch (argv[argn], "-resolution", 2)) { ++argn; if (argn == argc || sscanf (argv[argn], "%d", &dpi) != 1) pm_usage (usage); } else if (pm_keymatch (argv[argn], "-aspect", 2)) { ++argn; if (argn == argc || sscanf (argv[argn], "%f", &aspect) != 1) pm_usage (usage); } else if (pm_keymatch (argv[argn], "-scale", 2)) { ++argn; if (argn == argc || sscanf (argv[argn], "%f", &scale) != 1) pm_usage (usage); } else if (pm_keymatch (argv[argn], "-compress", 2)) { ++argn; if (argn == argc || sscanf (argv[argn], "%d", &cmode) != 1) pm_usage (usage); if ((cmode < 0) || (cmode > 2)) pm_usage (usage); } else if (pm_keymatch (argv[argn], "-duplength", 2)) { ++argn; if (argn == argc || sscanf (argv[argn], "%f", &duplength) != 1) pm_usage (usage); } else if (pm_keymatch (argv[argn], "-pagelength", 2)) { ++argn; if (argn == argc || sscanf (argv[argn], "%f", &pagelength) != 1) pm_usage (usage); } else pm_usage (usage); argn++; } if (argn < argc) { ifp = pm_openr (argv[argn]); argn++; } else ifp = stdin; if (argn != argc) pm_usage (usage); vscale = aspect * scale * 100; hscale = scale * 100; eols = 0; maxhist = duplength * dpi; if (maxhist > MAXHIST) maxhist = MAXHIST; for (i = 0; i < maxhist; i++) { hist[i].line = (char *) malloc (2 * (dpi * 10 * hscale) / 100); } histidx = 0; lncnt = 0; maxline = pagelength * dpi; line = hist[histidx].line; putinit (); if (kludge) { /* Skip extra lines to get in sync. */ skiptoeol (); skiptoeol (); skiptoeol (); } skiptoeol (); for (i = 0; i < HASHSIZE; ++i) whash[i] = bhash[i] = (tableentry *) 0; addtohash (whash, twtable, TABSIZE (twtable), WHASHA, WHASHB); addtohash (whash, mwtable, TABSIZE (mwtable), WHASHA, WHASHB); addtohash (whash, extable, TABSIZE (extable), WHASHA, WHASHB); addtohash (bhash, tbtable, TABSIZE (tbtable), BHASHA, BHASHB); addtohash (bhash, mbtable, TABSIZE (mbtable), BHASHA, BHASHB); addtohash (bhash, extable, TABSIZE (extable), BHASHA, BHASHB); wcols = (MAXCOLS * hscale) / 100; wrows = 99999; writerow = pbm_allocrow (wcols); readrow = pbm_allocrow (MAXCOLS); vval = wrow = row = 0; while (row < MAXROWS) { for (col = 0, bP = writerow; col < (MAXCOLS * hscale) / 100; ++col, ++bP) *bP = PBM_WHITE; cols = 1; while (vval < 100) { if (row < MAXROWS) { hval = wcol = 0; bP = readrow; wbP = writerow; col = getfaxrow (row, readrow); col--; while ((col > 0) && (readrow[col] == PBM_WHITE)) col--; col++; if (col > cols) cols = col; wcols = (cols * hscale) / 100; col = 0; while (col < cols) { bitval = *wbP; while (hval < 100) { if (col++ < cols) if (*bP++ == PBM_BLACK) bitval = PBM_BLACK; hval += hscale; } while (hval >= 100) { if (wcol++ < wcols) *wbP++ = bitval; hval -= 100; } } /* while(col */ } /* if(row */ vval += vscale; row++; } /* while vval */ while (vval >= 100) { if (wrow < wrows) { lj_writerow (stdout, writerow, wcols); wrow++; } vval -= 100; } if (eof) break; } putrest (); return 0; } mgetty-1.2.1/contrib/g3tops.c000066400000000000000000000357611334553713100160700ustar00rootroot00000000000000From labinfo.iet.unipi.it!luigi Thu Nov 10 15:19:22 1994 Return-Path: Received: by greenie.muc.de (/\==/\ Smail3.1.24.1 #24.2) id ; Thu, 10 Nov 94 15:19 MET Received: from labinfo.iet.unipi.it ([131.114.9.5]) by colin.muc.de with SMTP id <25590(1)>; Thu, 10 Nov 1994 15:19:01 +0100 Received: from localhost (luigi@localhost) by labinfo.iet.unipi.it (8.6.5/8.6.5) id PAA01788 for gert@greenie.muc.de; Thu, 10 Nov 1994 15:15:36 +0100 From: Luigi Rizzo Message-Id: <199411101415.PAA01788@labinfo.iet.unipi.it> Subject: Re: mgetty+sendfax To: gert@greenie.muc.de (Gert Doering) Date: Thu, 10 Nov 1994 15:15:36 +0100 In-Reply-To: from "Gert Doering" at Nov 8, 94 11:13:18 pm X-Mailer: ELM [version 2.4 PL23] Content-Type: text Content-Length: 14459 Status: RO Gert, here is what I have so far. It is a simple converter based on your g3topbm.c (which resembles very closely). Just use it as g3tops < g3file > /tmp/psfile ; gs /tmp/psfile I find it faster than converting to pbm and using xv. Feel free to modify it/incorporate it into the existing g3toxx programs. Luigi -------------------------------------------------------- #define G3PS #ident "@(#)g3topbm.c 1.18 94/10/31 (c) Gert Doering" #include #include #include "syslibs.h" #include #include #include "ugly.h" #include "g3.h" char psheader[]= "%!\n0 72 25.4 div 297 mul translate\n" "72 204 div 72 98 div scale\n" "1 -1 scale\n" "/L { 0 rmoveto 0 rlineto} def\n" "/P { 1 exch L} def\n" "/N { currentpoint stroke 1 add exch pop 0 exch moveto} def\n" "/M { currentpoint exch pop add stroke 0 exch moveto} def\n" "0 0 moveto\n"; int lastx=0, lastblack= -1; int whitelines=0; int pixblock _PROTO((char *start, char *end)); int nullscan _PROTO((char *start, char *end)); void emitlj _PROTO((int resolution, int numx, int numy, char *image)); void emitpbm _PROTO((int hcol, int row, char *bitmap, int bperrow )); #ifdef DEBUG void putbin _P1( (d), unsigned long d ) { unsigned long i = 0x80000000; while ( i!=0 ) { putc( ( d & i ) ? '1' : '0', stderr ); i >>= 1; } putc( '\n', stderr ); } #endif static int byte_tab[ 256 ]; static int o_stretch; /* -stretch: double each line */ static int o_lj; /* -l: LJ output */ static int o_turn; /* -t: turn 90 degrees right */ struct g3_tree * black, * white; #define CHUNK 2048; static char rbuf[2048]; /* read buffer */ static int rp; /* read pointer */ static int rs; /* read buffer size */ #define MAX_ROWS 4300 #define MAX_COLS 1728 /* !! FIXME - command line parameter */ #define BASERES 200 /* resolution of G3 */ #define MVTYPE int /* scale the bitmap */ char *scalebm _P5( (res, cols, rows, map, bperrow), int res, int *cols, int *rows, char *map, int *bperrow) { int nc, nr, i, newbperrow; register char *orp, *nrp; char *newmap; MVTYPE *mulvec; if ( res == BASERES ) /* don't do anything of not scaled */ { return map; } /* do scaling, from "BASERES" to "res" dpi */ nr = (*rows * res) / BASERES; nc = (((*cols * res) / BASERES) + 7) & ~7; newbperrow = (nc + 7) >> 3; newmap = malloc(nr * newbperrow ); if (!newmap) { fprintf (stderr, "g3topbm: cannot allocate %d bytes for scale raster\n", nr * newbperrow ); exit(1); } memset( newmap, 0, nr * newbperrow ); { int max = *cols > *rows ? *cols: *rows; MVTYPE *mv; mulvec = (MVTYPE *) malloc(max * sizeof(MVTYPE)); if (!mulvec) { fprintf (stderr, "g3topbm: cannot allocate multiplier vector\n"); exit(1); } for (mv = mulvec, i = 0; i < max; i++) { *mv++ = (i * res) / BASERES; } } orp = map; for (i = 0; i < *rows; i++) { register MVTYPE *mv; register int j; nrp = newmap + (mulvec[i] * newbperrow); for (j = 0, mv = mulvec; j < *cols; j++, mv++) { if (!(j & 0x7) && !orp[j >> 3]) { j += 8; mv += 8; continue; } if (orp[j >> 3] & (0x80 >> (j & 0x7))) nrp[(*mv) >> 3] |= (0x80 >> ((*mv) & 0x7)); } orp += *bperrow; } free (map); *rows = nr; *cols = nc; *bperrow = newbperrow; return (newmap); } /* turn the bitmap */ char * turnbm _P4 (( cols, rows, map, bperrow ), int * cols, int * rows, char * map, int * bperrow ) { char * newmap; int newbperrow, nr, nc, nx, ny; register int obit; register char * newbp, * obyte; char * oldbp; int byte, bit; o_turn &= 3; if ( o_turn == 0 ) return map; /* turn right */ nc = *rows; /* new columns */ nr = *cols; /* new rows */ newbperrow = ( nc+7 ) / 8; newmap = malloc( nr * newbperrow ); if ( newmap == NULL ) { fprintf( stderr, "g3topbm: cannot allocate %d bytes for turn bitmap", nr * newbperrow ); exit(1); } memset( newmap, 0, nr * newbperrow ); for( nx = 0; nx> (nx&7); byte = nx >> 3; oldbp = &map[ (*rows - nx - 1) * *bperrow ]; for ( ny = nr, newbp= &newmap[byte], /* new y */ obyte = oldbp, obit=0x80; ny>0; ny--, newbp += newbperrow ) { if ( (*obyte) & obit ) { *newbp |= bit; } obit >>= 1; if ( obit == 0 ) { obit=0x80; obyte++; } } } free( map ); *rows = nr; *cols = nc; *bperrow = newbperrow; return newmap; } int main _P2( (argc, argv), int argc, char ** argv ) { int data; int hibit; struct g3_tree * p; int nr_pels; int fd; int color; int i; int cons_eol; int bperrow = MAX_COLS/8; /* bytes per bit row */ char * bitmap; /* MAX_ROWS by (bperrow) bytes */ char * bp; /* bitmap pointer */ int row; int max_rows; /* max. rows allocated */ int col, hcol; /* column, highest column ever used */ extern int optind; extern char *optarg; int resolution = BASERES; /* initialize lookup trees */ build_tree( &white, t_white ); build_tree( &white, m_white ); build_tree( &black, t_black ); build_tree( &black, m_black ); init_byte_tab( 0, byte_tab ); while((i = getopt(argc, argv, "rsld:t")) != EOF) { switch (i) { case 'r': init_byte_tab( 1, byte_tab ); break; case 's': o_stretch=1; break; case 'l': o_lj=1; break; case 'd': resolution = atoi(optarg); if ( resolution != 75 && resolution != 150 && resolution != 300 ) { fprintf( stderr, "g3topbm: only supports 75, 150, or 300 dpi\n"); exit(1); } break; case 't': o_turn++; break; case '?': fprintf( stderr, "usage: g3topbm [-l|-r|-s|-d |-t] [g3 file]\n"); exit(1); } } if (o_lj && resolution == BASERES) resolution = 150; if ( optind < argc ) /* read from file */ { fd = open( argv[optind], O_RDONLY ); if ( fd == -1 ) { perror( argv[optind] ); exit( 1 ); } } else fd = 0; hibit = 0; data = 0; cons_eol = 0; /* consecutive EOLs read - zero yet */ color = 0; /* start with white */ rs = read( fd, rbuf, sizeof(rbuf) ); if ( rs < 0 ) { perror( "read" ); close( rs ); exit(8); } /* skip GhostScript header */ rp = ( rs >= 64 && strcmp( rbuf+1, "PC Research, Inc" ) == 0 ) ? 64 : 0; /* initialize bitmap */ row = col = hcol = 0; bitmap = (char *) malloc( ( max_rows = MAX_ROWS ) * MAX_COLS / 8 ); if ( bitmap == NULL ) { fprintf( stderr, "cannot allocate %d bytes for bitmap", max_rows * MAX_COLS/8 ); close( fd ); exit(9); } memset( bitmap, 0, max_rows * MAX_COLS/8 ); bp = &bitmap[ row * MAX_COLS/8 ]; #ifdef G3PS fprintf(stdout,"%s",psheader); #endif /* G3PS */ while ( rs > 0 && cons_eol < 4 ) /* i.e., while (!EOF) */ { #ifdef DEBUG fprintf( stderr, "hibit=%2d, data=", hibit ); putbin( data ); #endif while ( hibit < 20 ) { data |= ( byte_tab[ (int) (unsigned char) rbuf[ rp++] ] << hibit ); hibit += 8; if ( rp >= rs ) { rs = read( fd, rbuf, sizeof( rbuf ) ); if ( rs < 0 ) { perror( "read2"); break; } rp = 0; if ( rs == 0 ) { goto do_write; } } #ifdef DEBUG fprintf( stderr, "hibit=%2d, data=", hibit ); putbin( data ); #endif } if ( color == 0 ) /* white */ p = white->nextb[ data & BITM ]; else /* black */ p = black->nextb[ data & BITM ]; while ( p != NULL && ! ( p->nr_bits ) ) { data >>= BITS; hibit -= BITS; p = p->nextb[ data & BITM ]; } if ( p == NULL ) /* invalid code */ { fprintf( stderr, "invalid code, row=%d, col=%d, file offset=%lx, skip to eol\n", row, col, (unsigned long) lseek( fd, 0, 1 ) - rs + rp ); while ( ( data & 0x03f ) != 0 ) { data >>= 1; hibit--; if ( hibit < 20 ) { data |= ( byte_tab[ (int) (unsigned char) rbuf[ rp++] ] << hibit ); hibit += 8; if ( rp >= rs ) /* buffer underrun */ { rs = read( fd, rbuf, sizeof( rbuf ) ); if ( rs < 0 ) { perror( "read4"); break; } rp = 0; if ( rs == 0 ) goto do_write; } } } nr_pels = -1; /* handle as if eol */ } else /* p != NULL <-> valid code */ { data >>= p->nr_bits; hibit -= p->nr_bits; nr_pels = ( (struct g3_leaf *) p ) ->nr_pels; #ifdef DEBUG fprintf( stderr, "PELs: %d (%c)\n", nr_pels, '0'+color ); #endif } /* handle EOL (including fill bits) */ if ( nr_pels == -1 ) { #ifdef G3PS whitelines++; /*fprintf(stdout,"N\n"); */ lastx=0; lastblack= -1; #endif #ifdef DEBUG fprintf( stderr, "hibit=%2d, data=", hibit ); putbin( data ); #endif /* skip filler 0bits -> seek for "1"-bit */ while ( ( data & 0x01 ) != 1 ) { if ( ( data & 0xf ) == 0 ) /* nibble optimization */ { hibit-= 4; data >>= 4; } else { hibit--; data >>= 1; } /* fill higher bits */ if ( hibit < 20 ) { data |= ( byte_tab[ (int) (unsigned char) rbuf[ rp++] ] << hibit ); hibit += 8; if ( rp >= rs ) /* buffer underrun */ { rs = read( fd, rbuf, sizeof( rbuf ) ); if ( rs < 0 ) { perror( "read3"); break; } rp = 0; if ( rs == 0 ) goto do_write; } } #ifdef DEBUG fprintf( stderr, "hibit=%2d, data=", hibit ); putbin( data ); #endif } /* end skip 0bits */ hibit--; data >>=1; color=0; if ( col == 0 ) cons_eol++; /* consecutive EOLs */ else { if ( col > hcol && col <= MAX_COLS ) hcol = col; row++; /* bitmap memory full? make it larger! */ if ( row >= max_rows ) { char * p = realloc( bitmap, ( max_rows += 500 ) * MAX_COLS/8 ); if ( p == NULL ) { perror( "realloc() failed, page truncated" ); rs = 0; } else { bitmap = p; memset( &bitmap[ row * MAX_COLS/8 ], 0, ( max_rows - row ) * MAX_COLS/8 ); } } col=0; bp = &bitmap[ row * MAX_COLS/8 ]; cons_eol = 0; } } else /* not eol */ { if ( col+nr_pels > MAX_COLS ) nr_pels = MAX_COLS - col; if ( color == 0 ) /* white */ col += nr_pels; else /* black */ { register int bit = ( 0x80 >> ( col & 07 ) ); register char *w = & bp[ col>>3 ]; for ( i=nr_pels; i > 0; i-- ) { *w |= bit; bit >>=1; if ( bit == 0 ) { bit = 0x80; w++; } col++; } } if ( nr_pels < 64 ) { color = !color; /* terminating code */ #ifdef G3PS if (color) { /* black begins */ lastblack= col; } else { /* black ends */ int black=col- lastblack; int move=lastblack - lastx; if (lastblack > -1) { if (whitelines>1) fprintf(stdout,"%d M\n",whitelines); else if (whitelines==1) fprintf(stdout,"N\n"); whitelines=0; fprintf(stdout,"%d %d L\n",black, move); } lastx=col; lastblack= -1; } #endif } } } /* end main loop */ do_write: /* write pbm (or whatever) file */ #ifdef G3PS fprintf(stdout,"showpage\n"); exit(0); #endif if( fd != 0 ) close(fd); /* close input file */ #ifdef DEBUG fprintf( stderr, "consecutive EOLs: %d, max columns: %d\n", cons_eol, hcol ); #endif bitmap = scalebm(resolution, &hcol, &row, bitmap, &bperrow ); bitmap = turnbm( &hcol, &row, bitmap, &bperrow ); if (o_lj) emitlj(resolution, hcol, row, bitmap); else emitpbm(hcol, row, bitmap, bperrow ); return 0; } /* hcol is the number of columns, row the number of rows * bperrow is the number of bytes actually used by hcol, which may * be greater than (hcol+7)/8 [in case of an unscaled g3 image less * than 1728 pixels wide] */ void emitpbm _P4(( hcol, row, bitmap, bperrow), int hcol, int row, char *bitmap, int bperrow ) { register int i; sprintf( rbuf, "P4\n%d %d\n", hcol, ( o_stretch? row*2 : row ) ); write( 1, rbuf, strlen( rbuf )); if ( hcol == (bperrow*8) && !o_stretch ) write( 1, bitmap, row * bperrow ); else { if ( !o_stretch ) for ( i=0; i ESCLEN) return(cur - start); else cur += numnulls; } return(end - start); } void emitlj _P4((resolution, numx, numy, image), int resolution, int numx, int numy, char *image) { int bperline; int resmult = 300/resolution; register char *ip, *lineanch, *nip; register currow, bcount; bperline = ((numx + 7) / 8); /* some spoolers use a "cut" to do printer-type selection (eg: "%!" processing). The newline is to prevent cut (or other line-length-limited UNIX utilities) dying. */ printf("\033*t%dR\n", resolution); for(currow = 0; currow < numy; currow++) { lineanch = ip = &image[bperline * currow]; nip = ip + bperline; while (ip < nip && !*ip) ip++; if (ip >= nip) continue; /* line has no pixels */ while (!*(nip - 1)) nip--; /* truncate trailing nulls */ while (ip < nip) { /* inv: !*ip && !*nip */ bcount = pixblock(ip, nip); printf("\033*p%dx%dY\033*r1A\033*b%dW", (ip - lineanch) * 8 * resmult, (currow * resmult) << o_stretch, bcount); fwrite(ip, 1, bcount, stdout); if (o_stretch) { printf("\033*b%dW", bcount); fwrite(ip, 1, bcount, stdout); } fputs("\033*rB", stdout); for(ip += bcount; ip < nip && !*ip; ip++); } } putchar('\f'); } /****** end of file **********/ mgetty-1.2.1/contrib/g3toxwd.1000066400000000000000000000035621334553713100161600ustar00rootroot00000000000000.TH g3toxwd 1 "22 may 94" "Chel" "mgetty+sendfax manual" .IX g3toxwd .SH NAME g3toxwd \- converts a Group 3 fax file into a displayable xwd file .SH SYNOPSIS .B g3toxwd .RB [ -kludge ] .RB [ -reversebits ] .RB [ -scale\ N ] .RB [ -aspect\ N ] .RB [ -skiprows\ N ] .RB [ -name\ xwdname ] .RI [ g3file ] .SH DESCRIPTION Reads a Group 3 fax file (raw or digifax) as input. If no filename is given, stdin is used. .IX "Group 3 fax" .IX fax Produces a displayable xwd file as output. .SH OPTIONS .TP .B -kludge Tells .I g3toxwd to skip the first lines for synchronisation. .TP .B -reversebits Tells .I g3toxwd to interpret bits least-significant first, instead of the default most-significant first. Apparently some fax modems do it one way and others do it the other way. If you get a whole bunch of "invalid code" messages, try using this flag. .TP .B -scale N Scale the output to match the printer resolution and paper size, the default of 0.58 will do in most cases. .TP .B -aspect N Scale the output to match the printer resolution and paper size, the default of 1.0 will do for high resolution faxes, 2.0 will do for low resolution faxes. .TP .B -skiprows N N faxrows of the input file will be skipped. .TP .B -name The name will be put in the output file for xwd. .TP .SH REFERENCES The standard for Group 3 fax is defined in CCITT Recommendation T.4. .SH BUGS Long fax files are not handled properly. Output size fixed 1000x1350 pixels defined at compile time. Please report bugs to chel@vangennip.nl .SH "SEE ALSO" pbmtog3(1), pbm(5), g3cat(1), sendfax(8), mgetty(1) .SH AUTHOR .I g3toxwd is Copyright (C) 1994 by Chel van Gennip, . Sources of .I g3topbm and .I pbmtoxwd programs in Jef Poskanzers .I pbmplus package have been used, but al lot of code has been changed or added to simplify its use for displaying faxes. Value added: low use of memory, fast scaling. mgetty-1.2.1/contrib/g3toxwd.c000066400000000000000000000527361334553713100162510ustar00rootroot00000000000000/* g3topbm.c - read a Group 3 FAX file and produce a portable bitmap * * * Copyright (C) 1989 by Paul Haeberli . * * * pnmtoxwd.c - read a portable anymap and produce a color X11 window dump * * Copyright (C) 1989, 1991 by Jef Poskanzer. * * gcc -g -o g3toxwd -O2 g3toxwd.c * * Permission to use, copy, modify, and distribute this software and its * * documentation for any purpose and without fee is hereby granted, provided * * that the above copyright notice appear in all copies and that both that * * copyright notice and this permission notice appear in supporting * * documentation. This software is provided "as is" without express or * * implied warranty. * * * Update aug 31,1993, Chel van Gennip, combined two programs, delated large * array and added simple scaling to improve speed. * * Update 22 may 1994, better EOF handling by transmission errors chel. Added * -skiprows for long faxes. * * $Log: g3toxwd.c,v $ * Revision 1.2 2003/10/03 11:36:03 gert * fix some return types and prototypes (Debian/ABA) * * Revision 1.1 2003/10/03 11:34:56 gert * G3 -> X11 xwd, initial checkin * * */ #include #include #include #include #include typedef unsigned char bit; #define PBM_WHITE 0 #define PBM_BLACK 1 #define pm_error(a,b,c,d,e,f) {fprintf(stderr,a,b,c,d,e,f);fprintf(stderr,"\n");} #define pm_message(a,b,c,d,e,f) {fprintf(stderr,a,b,c,d,e,f);fprintf(stderr,"\n");} #define pm_usage(a) { fprintf(stderr,"usage: %s\n",a); exit(7); } #define pbm_allocrow(a) (bit*)malloc(a) /* x11wd.h - the following defs are taken from various X.V11R2 header files */ #ifndef _X11WD_H_ #define _X11WD_H_ #define LSBFirst 0 #define MSBFirst 1 #define XYBitmap 0 #define XYPixmap 1 #define ZPixmap 2 #define StaticGray 0 #define GrayScale 1 #define StaticColor 2 #define PseudoColor 3 #define TrueColor 4 #define DirectColor 5 typedef unsigned long xwdval; #define X11WD_FILE_VERSION 7 typedef struct { xwdval header_size; /* Size of the entire file header (bytes). */ xwdval file_version; /* X11WD_FILE_VERSION */ xwdval pixmap_format; /* Pixmap format */ xwdval pixmap_depth; /* Pixmap depth */ xwdval pixmap_width; /* Pixmap width */ xwdval pixmap_height; /* Pixmap height */ xwdval xoffset; /* Bitmap x offset */ xwdval byte_order; /* MSBFirst, LSBFirst */ xwdval bitmap_unit; /* Bitmap unit */ xwdval bitmap_bit_order; /* MSBFirst, LSBFirst */ xwdval bitmap_pad; /* Bitmap scanline pad */ xwdval bits_per_pixel; /* Bits per pixel */ xwdval bytes_per_line; /* Bytes per scanline */ xwdval visual_class; /* Class of colormap */ xwdval red_mask; /* Z red mask */ xwdval green_mask; /* Z green mask */ xwdval blue_mask; /* Z blue mask */ xwdval bits_per_rgb; /* Log base 2 of distinct color values */ xwdval colormap_entries; /* Number of entries in colormap */ xwdval ncolors; /* Number of Color structures */ xwdval window_width; /* Window width */ xwdval window_height; /* Window height */ long window_x; /* Window upper left X coordinate */ long window_y; /* Window upper left Y coordinate */ xwdval window_bdrwidth; /* Window border width */ } X11WDFileHeader; typedef struct { unsigned long pixel; unsigned short red, green, blue; char flags; /* do_red, do_green, do_blue */ char pad; } X11XColor; #endif /* _X11WD_H_ */ /* g3.h - header file for group 3 FAX compression filters from pm package */ #ifndef _G3_H_ #define _G3_H_ typedef struct tableentry { int tabid; int code; int length; int count; } tableentry; #define TWTABLE 23 #define MWTABLE 24 #define TBTABLE 25 #define MBTABLE 26 #define EXTABLE 27 #define VRTABLE 28 static struct tableentry twtable[]= { {TWTABLE, 0x35, 8, 0}, {TWTABLE, 0x7, 6, 1}, {TWTABLE, 0x7, 4, 2}, {TWTABLE, 0x8, 4, 3}, {TWTABLE, 0xb, 4, 4}, {TWTABLE, 0xc, 4, 5}, {TWTABLE, 0xe, 4, 6}, {TWTABLE, 0xf, 4, 7}, {TWTABLE, 0x13, 5, 8}, {TWTABLE, 0x14, 5, 9}, {TWTABLE, 0x7, 5, 10}, {TWTABLE, 0x8, 5, 11}, {TWTABLE, 0x8, 6, 12}, {TWTABLE, 0x3, 6, 13}, {TWTABLE, 0x34, 6, 14}, {TWTABLE, 0x35, 6, 15}, {TWTABLE, 0x2a, 6, 16}, {TWTABLE, 0x2b, 6, 17}, {TWTABLE, 0x27, 7, 18}, {TWTABLE, 0xc, 7, 19}, {TWTABLE, 0x8, 7, 20}, {TWTABLE, 0x17, 7, 21}, {TWTABLE, 0x3, 7, 22}, {TWTABLE, 0x4, 7, 23}, {TWTABLE, 0x28, 7, 24}, {TWTABLE, 0x2b, 7, 25}, {TWTABLE, 0x13, 7, 26}, {TWTABLE, 0x24, 7, 27}, {TWTABLE, 0x18, 7, 28}, {TWTABLE, 0x2, 8, 29}, {TWTABLE, 0x3, 8, 30}, {TWTABLE, 0x1a, 8, 31}, {TWTABLE, 0x1b, 8, 32}, {TWTABLE, 0x12, 8, 33}, {TWTABLE, 0x13, 8, 34}, {TWTABLE, 0x14, 8, 35}, {TWTABLE, 0x15, 8, 36}, {TWTABLE, 0x16, 8, 37}, {TWTABLE, 0x17, 8, 38}, {TWTABLE, 0x28, 8, 39}, {TWTABLE, 0x29, 8, 40}, {TWTABLE, 0x2a, 8, 41}, {TWTABLE, 0x2b, 8, 42}, {TWTABLE, 0x2c, 8, 43}, {TWTABLE, 0x2d, 8, 44}, {TWTABLE, 0x4, 8, 45}, {TWTABLE, 0x5, 8, 46}, {TWTABLE, 0xa, 8, 47}, {TWTABLE, 0xb, 8, 48}, {TWTABLE, 0x52, 8, 49}, {TWTABLE, 0x53, 8, 50}, {TWTABLE, 0x54, 8, 51}, {TWTABLE, 0x55, 8, 52}, {TWTABLE, 0x24, 8, 53}, {TWTABLE, 0x25, 8, 54}, {TWTABLE, 0x58, 8, 55}, {TWTABLE, 0x59, 8, 56}, {TWTABLE, 0x5a, 8, 57}, {TWTABLE, 0x5b, 8, 58}, {TWTABLE, 0x4a, 8, 59}, {TWTABLE, 0x4b, 8, 60}, {TWTABLE, 0x32, 8, 61}, {TWTABLE, 0x33, 8, 62}, {TWTABLE, 0x34, 8, 63}, }; static struct tableentry mwtable[]= { {MWTABLE, 0x1b, 5, 64}, {MWTABLE, 0x12, 5, 128}, {MWTABLE, 0x17, 6, 192}, {MWTABLE, 0x37, 7, 256}, {MWTABLE, 0x36, 8, 320}, {MWTABLE, 0x37, 8, 384}, {MWTABLE, 0x64, 8, 448}, {MWTABLE, 0x65, 8, 512}, {MWTABLE, 0x68, 8, 576}, {MWTABLE, 0x67, 8, 640}, {MWTABLE, 0xcc, 9, 704}, {MWTABLE, 0xcd, 9, 768}, {MWTABLE, 0xd2, 9, 832}, {MWTABLE, 0xd3, 9, 896}, {MWTABLE, 0xd4, 9, 960}, {MWTABLE, 0xd5, 9, 1024}, {MWTABLE, 0xd6, 9, 1088}, {MWTABLE, 0xd7, 9, 1152}, {MWTABLE, 0xd8, 9, 1216}, {MWTABLE, 0xd9, 9, 1280}, {MWTABLE, 0xda, 9, 1344}, {MWTABLE, 0xdb, 9, 1408}, {MWTABLE, 0x98, 9, 1472}, {MWTABLE, 0x99, 9, 1536}, {MWTABLE, 0x9a, 9, 1600}, {MWTABLE, 0x18, 6, 1664}, {MWTABLE, 0x9b, 9, 1728}, }; static struct tableentry tbtable[]= { {TBTABLE, 0x37, 10, 0}, {TBTABLE, 0x2, 3, 1}, {TBTABLE, 0x3, 2, 2}, {TBTABLE, 0x2, 2, 3}, {TBTABLE, 0x3, 3, 4}, {TBTABLE, 0x3, 4, 5}, {TBTABLE, 0x2, 4, 6}, {TBTABLE, 0x3, 5, 7}, {TBTABLE, 0x5, 6, 8}, {TBTABLE, 0x4, 6, 9}, {TBTABLE, 0x4, 7, 10}, {TBTABLE, 0x5, 7, 11}, {TBTABLE, 0x7, 7, 12}, {TBTABLE, 0x4, 8, 13}, {TBTABLE, 0x7, 8, 14}, {TBTABLE, 0x18, 9, 15}, {TBTABLE, 0x17, 10, 16}, {TBTABLE, 0x18, 10, 17}, {TBTABLE, 0x8, 10, 18}, {TBTABLE, 0x67, 11, 19}, {TBTABLE, 0x68, 11, 20}, {TBTABLE, 0x6c, 11, 21}, {TBTABLE, 0x37, 11, 22}, {TBTABLE, 0x28, 11, 23}, {TBTABLE, 0x17, 11, 24}, {TBTABLE, 0x18, 11, 25}, {TBTABLE, 0xca, 12, 26}, {TBTABLE, 0xcb, 12, 27}, {TBTABLE, 0xcc, 12, 28}, {TBTABLE, 0xcd, 12, 29}, {TBTABLE, 0x68, 12, 30}, {TBTABLE, 0x69, 12, 31}, {TBTABLE, 0x6a, 12, 32}, {TBTABLE, 0x6b, 12, 33}, {TBTABLE, 0xd2, 12, 34}, {TBTABLE, 0xd3, 12, 35}, {TBTABLE, 0xd4, 12, 36}, {TBTABLE, 0xd5, 12, 37}, {TBTABLE, 0xd6, 12, 38}, {TBTABLE, 0xd7, 12, 39}, {TBTABLE, 0x6c, 12, 40}, {TBTABLE, 0x6d, 12, 41}, {TBTABLE, 0xda, 12, 42}, {TBTABLE, 0xdb, 12, 43}, {TBTABLE, 0x54, 12, 44}, {TBTABLE, 0x55, 12, 45}, {TBTABLE, 0x56, 12, 46}, {TBTABLE, 0x57, 12, 47}, {TBTABLE, 0x64, 12, 48}, {TBTABLE, 0x65, 12, 49}, {TBTABLE, 0x52, 12, 50}, {TBTABLE, 0x53, 12, 51}, {TBTABLE, 0x24, 12, 52}, {TBTABLE, 0x37, 12, 53}, {TBTABLE, 0x38, 12, 54}, {TBTABLE, 0x27, 12, 55}, {TBTABLE, 0x28, 12, 56}, {TBTABLE, 0x58, 12, 57}, {TBTABLE, 0x59, 12, 58}, {TBTABLE, 0x2b, 12, 59}, {TBTABLE, 0x2c, 12, 60}, {TBTABLE, 0x5a, 12, 61}, {TBTABLE, 0x66, 12, 62}, {TBTABLE, 0x67, 12, 63}, }; static struct tableentry mbtable[]= { {MBTABLE, 0xf, 10, 64}, {MBTABLE, 0xc8, 12, 128}, {MBTABLE, 0xc9, 12, 192}, {MBTABLE, 0x5b, 12, 256}, {MBTABLE, 0x33, 12, 320}, {MBTABLE, 0x34, 12, 384}, {MBTABLE, 0x35, 12, 448}, {MBTABLE, 0x6c, 13, 512}, {MBTABLE, 0x6d, 13, 576}, {MBTABLE, 0x4a, 13, 640}, {MBTABLE, 0x4b, 13, 704}, {MBTABLE, 0x4c, 13, 768}, {MBTABLE, 0x4d, 13, 832}, {MBTABLE, 0x72, 13, 896}, {MBTABLE, 0x73, 13, 960}, {MBTABLE, 0x74, 13, 1024}, {MBTABLE, 0x75, 13, 1088}, {MBTABLE, 0x76, 13, 1152}, {MBTABLE, 0x77, 13, 1216}, {MBTABLE, 0x52, 13, 1280}, {MBTABLE, 0x53, 13, 1344}, {MBTABLE, 0x54, 13, 1408}, {MBTABLE, 0x55, 13, 1472}, {MBTABLE, 0x5a, 13, 1536}, {MBTABLE, 0x5b, 13, 1600}, {MBTABLE, 0x64, 13, 1664}, {MBTABLE, 0x65, 13, 1728}, }; static struct tableentry extable[]= { {EXTABLE, 0x8, 11, 1792}, {EXTABLE, 0xc, 11, 1856}, {EXTABLE, 0xd, 11, 1920}, {EXTABLE, 0x12, 12, 1984}, {EXTABLE, 0x13, 12, 2048}, {EXTABLE, 0x14, 12, 2112}, {EXTABLE, 0x15, 12, 2176}, {EXTABLE, 0x16, 12, 2240}, {EXTABLE, 0x17, 12, 2304}, {EXTABLE, 0x1c, 12, 2368}, {EXTABLE, 0x1d, 12, 2432}, {EXTABLE, 0x1e, 12, 2496}, {EXTABLE, 0x1f, 12, 2560}, }; #endif /* _G3_H_ */ void skiptoeol (void); FILE * pm_openr (name) char *name; { FILE *f; if (strcmp (name, "-") == 0) f = stdin; else { f = fopen (name, "r"); if (f == NULL) { perror (name); exit (1); } } return f; } int pm_keymatch (str, keyword, minchars) char *str; char *keyword; int minchars; { register int len; len = strlen (str); if (len < minchars) return 0; while (--len >= 0) { register char c1, c2; c1 = *str++; c2 = *keyword++; if (c2 == '\0') return 0; if (isupper (c1)) c1 = tolower (c1); if (isupper (c2)) c1 = tolower (c2); if (c1 != c2) return 0; } return 1; } int pm_writebigshort (out, s) FILE *out; short s; { if (putc ((s >> 8) & 0xff, out) == EOF) return -1; if (putc (s & 0xff, out) == EOF) return -1; return 0; } int pm_writebiglong (out, l) FILE *out; long l; { if (putc ((l >> 24) & 0xff, out) == EOF) return -1; if (putc ((l >> 16) & 0xff, out) == EOF) return -1; if (putc ((l >> 8) & 0xff, out) == EOF) return -1; if (putc (l & 0xff, out) == EOF) return -1; return 0; } static int doubleheight = 1; static hscale = 100; static vscale = 100; static void putinit (), putbit (), putrest (), putitem (); static int item, bitsperitem; static char *line; static int bytecnt; #define TABSIZE(tab) (sizeof(tab)/sizeof(struct tableentry)) #define MAXCOLS 1728 #define MAXROWS 4300 /* up to two pages long */ #define XWDCOLS 1000 #define XWDROWS XWDCOLS*290/215 int eof = 0; int eols; int rawzeros; int shdata; int kludge; int reversebits; int stretch; #define WHASHA 3510 #define WHASHB 1178 #define BHASHA 293 #define BHASHB 2695 #define HASHSIZE 1021 tableentry *whash[HASHSIZE]; tableentry *bhash[HASHSIZE]; static FILE *ifp; static int shbit = 0; static int eof_err = 0; static inline int rawgetbit () { int b; if (eof_err) { rawzeros = 20; return (1); } if ((shbit & 0xff) == 0) { shdata = getc (ifp); if (shdata == EOF) { eof_err++; pm_error ("EOF / read error at line %d", eols, 0, 0, 0, 0); } shbit = reversebits ? 0x01 : 0x80; } if (shdata & shbit) { rawzeros = 0; b = 1; } else { rawzeros++; b = 0; } if (reversebits) shbit <<= 1; else shbit >>= 1; return b; } addtohash (hash, te, n, a, b) tableentry *hash[]; tableentry *te; int n, a, b; { unsigned int pos; while (n--) { pos = ((te->length + a) * (te->code + b)) % HASHSIZE; if (hash[pos] != 0) pm_error ( "internal error: addtohash fatal hash collision", 0, 0, 0, 0, 0); hash[pos] = te; te++; } } static inline tableentry * hashfind (hash, length, code, a, b) tableentry *hash[]; int length, code; int a, b; { unsigned int pos; tableentry *te; pos = ((length + a) * (code + b)) % HASHSIZE; if (pos < 0 || pos >= HASHSIZE) pm_error ( "internal error: bad hash position, length %d code %d pos %d", length, code, pos, 0, 0); te = hash[pos]; return ((te && te->length == length && te->code == code) ? te : 0); } getfaxrow (row, bitrow) int row; bit *bitrow; { int col; bit *bP; int curlen, curcode, nextbit; int count, color; tableentry *te; for (col = 0, bP = bitrow; col < MAXCOLS; ++col, ++bP) *bP = PBM_WHITE; col = 0; rawzeros = 0; curlen = 0; curcode = 0; color = 1; count = 0; while (!eof) { if (col >= MAXCOLS) { skiptoeol (); return (col); } do { if (rawzeros >= 11) { nextbit = rawgetbit (); if (nextbit) { if (col == 0) /* XXX should be 6 */ eof = (++eols == 3); else eols = 0; #ifdef notdef if (col && col < 1728) pm_message ( "warning, row %d short (len %d)", row, col, 0, 0, 0); #endif /* notdef */ return (col); } } else nextbit = rawgetbit (); curcode = (curcode << 1) + nextbit; curlen++; } while (curcode <= 0); if (curlen > 13) { pm_message ( "bad code word at row %d, col %d (len %d code 0x%x), skipping to EOL", row, col, curlen, curcode, 0); skiptoeol (); return (col); } if (color) { if (curlen < 4) continue; te = hashfind (whash, curlen, curcode, WHASHA, WHASHB); } else { if (curlen < 2) continue; te = hashfind (bhash, curlen, curcode, BHASHA, BHASHB); } if (!te) continue; switch (te->tabid) { case TWTABLE: case TBTABLE: count += te->count; if (col + count > MAXCOLS) count = MAXCOLS - col; if (count > 0) { if (color) { col += count; count = 0; } else { for (; count > 0; --count, ++col) bitrow[col] = PBM_BLACK; } } curcode = 0; curlen = 0; color = !color; break; case MWTABLE: case MBTABLE: count += te->count; curcode = 0; curlen = 0; break; case EXTABLE: count += te->count; curcode = 0; curlen = 0; break; default: pm_error ("internal bad poop", 0, 0, 0, 0, 0); } } return (0); } void skiptoeol () { while (rawzeros < 11) (void) rawgetbit (); for (;;) { if (rawgetbit ()) break; } } static X11WDFileHeader h11; static char *dumpname; static void putinit () { int i; X11XColor color; /* Init outfil. */ /* Set up the header. */ h11.header_size = sizeof (h11) + strlen (dumpname) + 1; h11.file_version = X11WD_FILE_VERSION; h11.pixmap_format = ZPixmap; h11.pixmap_width = XWDCOLS; h11.pixmap_height = XWDROWS; h11.xoffset = 0; h11.byte_order = MSBFirst; h11.bitmap_bit_order = MSBFirst; h11.window_width = XWDCOLS; h11.window_height = XWDROWS; h11.window_x = 0; h11.window_y = 0; h11.window_bdrwidth = 0; h11.pixmap_depth = 1; h11.bits_per_pixel = 1; h11.colormap_entries = 2; h11.ncolors = 2; h11.bytes_per_line = (XWDCOLS + 7) / 8; h11.bitmap_unit = 8; h11.bitmap_pad = 8; h11.visual_class = StaticGray; h11.red_mask = 0; h11.green_mask = 0; h11.blue_mask = 0; h11.bits_per_rgb = h11.pixmap_depth; /* Write out the header in big-endian order. */ pm_writebiglong (stdout, h11.header_size); pm_writebiglong (stdout, h11.file_version); pm_writebiglong (stdout, h11.pixmap_format); pm_writebiglong (stdout, h11.pixmap_depth); pm_writebiglong (stdout, h11.pixmap_width); pm_writebiglong (stdout, h11.pixmap_height); pm_writebiglong (stdout, h11.xoffset); pm_writebiglong (stdout, h11.byte_order); pm_writebiglong (stdout, h11.bitmap_unit); pm_writebiglong (stdout, h11.bitmap_bit_order); pm_writebiglong (stdout, h11.bitmap_pad); pm_writebiglong (stdout, h11.bits_per_pixel); pm_writebiglong (stdout, h11.bytes_per_line); pm_writebiglong (stdout, h11.visual_class); pm_writebiglong (stdout, h11.red_mask); pm_writebiglong (stdout, h11.green_mask); pm_writebiglong (stdout, h11.blue_mask); pm_writebiglong (stdout, h11.bits_per_rgb); pm_writebiglong (stdout, h11.colormap_entries); pm_writebiglong (stdout, h11.ncolors); pm_writebiglong (stdout, h11.window_width); pm_writebiglong (stdout, h11.window_height); pm_writebiglong (stdout, h11.window_x); pm_writebiglong (stdout, h11.window_y); pm_writebiglong (stdout, h11.window_bdrwidth); /* Write out the dump name. */ fwrite (dumpname, 1, strlen (dumpname) + 1, stdout); /* Write out the colormap, big-endian order. */ color.flags = 7; color.pad = 0; for (i = 0; i < 2; ++i) { color.pixel = i; /* Stupid hack because xloadimage and xwud disagree on * how to * interpret bitmaps. */ if (1) color.red = (long) (2 - 1 - i) * 65535 / (2 - 1); else color.red = (long) i *65535 / (2 - 1); color.green = color.red; color.blue = color.red; pm_writebiglong (stdout, color.pixel); pm_writebigshort (stdout, color.red); pm_writebigshort (stdout, color.green); pm_writebigshort (stdout, color.blue); putc (color.flags, stdout); putc (color.pad, stdout); } } static void putrest () { } static void xwd_writerow (FILE * fd, bit * writerow, int wcols) { register int bitshift; unsigned char byte; register int s, col; bitshift = 7; byte = 0; for (col = 0; col < XWDCOLS; col++) { s = writerow[col] & 1; byte |= s << bitshift; bitshift -= h11.bits_per_pixel; if (bitshift < 0) { putchar (byte); bitshift = 7; byte = 0; } } if (bitshift < 7) putchar (byte); }; int main (argc, argv) int argc; char *argv[]; { int argn, rows, wrows, cols, wcols, row, wrow, col, wcol, i; int vval, hval, skiprows; bit *readrow, *writerow, *bP, *wbP, bitval; float aspect, scale; int format; register int nzcol; char *usage = "g3toxwd [-kludge] [-reversebits] [-scale N] [-aspect N] [-skiprows N] [g3file]"; argn = 1; kludge = 0; reversebits = 0; aspect = 1.0; scale = (1.0 * XWDCOLS) / (1.0 * MAXCOLS); skiprows = 0; dumpname = ""; /* Check for flags. */ while (argn < argc && argv[argn][0] == '-' && argv[argn][1] != '\0') { if (pm_keymatch (argv[argn], "-kludge", 2)) kludge = 1; else if (pm_keymatch (argv[argn], "-reversebits", 2)) reversebits = 1; else if (pm_keymatch (argv[argn], "-aspect", 2)) { ++argn; if (argn == argc || sscanf (argv[argn], "%f", &aspect) != 1) pm_usage (usage); } else if (pm_keymatch (argv[argn], "-scale", 2)) { ++argn; if (argn == argc || sscanf (argv[argn], "%f", &scale) != 1) pm_usage (usage); } else if (pm_keymatch (argv[argn], "-skiprows", 2)) { ++argn; if (argn == argc || sscanf (argv[argn], "%d", &skiprows) != 1) pm_usage (usage); } else if (pm_keymatch (argv[argn], "-name", 2)) { ++argn; dumpname = argv[argn]; if (argn == argc) pm_usage (usage); } else pm_usage (usage); argn++; } if (argn < argc) { if (dumpname[0] == '\0') dumpname = argv[argn]; ifp = pm_openr (argv[argn]); argn++; } else { if (dumpname[0] == '\0') dumpname = "stdin"; ifp = stdin; } if (argn != argc) pm_usage (usage); vscale = aspect * scale * 100; hscale = scale * 100; eols = 0; putinit (); if (kludge) { /* Skip extra lines to get in sync. */ skiptoeol (); skiptoeol (); skiptoeol (); } skiptoeol (); for (i = 0; i < HASHSIZE; ++i) whash[i] = bhash[i] = (tableentry *) 0; addtohash (whash, twtable, TABSIZE (twtable), WHASHA, WHASHB); addtohash (whash, mwtable, TABSIZE (mwtable), WHASHA, WHASHB); addtohash (whash, extable, TABSIZE (extable), WHASHA, WHASHB); addtohash (bhash, tbtable, TABSIZE (tbtable), BHASHA, BHASHB); addtohash (bhash, mbtable, TABSIZE (mbtable), BHASHA, BHASHB); addtohash (bhash, extable, TABSIZE (extable), BHASHA, BHASHB); wcols = (MAXCOLS * hscale) / 100; writerow = pbm_allocrow (wcols); readrow = pbm_allocrow (MAXCOLS); vval = wrow = row = 0; while (skiprows > 0) { hval = wcol = 0; bP = readrow; wbP = writerow; col = getfaxrow (row, readrow); skiprows--; } while (row < MAXROWS) { for (col = 0, bP = writerow; col < (MAXCOLS * hscale) / 100; ++col, ++bP) *bP = PBM_WHITE; cols = 1; while (vval < 100) { if (row < MAXROWS) { hval = wcol = 0; bP = readrow; wbP = writerow; col = getfaxrow (row, readrow); col--; while ((col > 0) && (readrow[col] == PBM_WHITE)) col--; col++; if (col > cols) cols = col; wcols = (cols * hscale) / 100; col = 0; while (col < cols) { bitval = *wbP; while (hval < 100) { if (col++ < cols) if (*bP++ == PBM_BLACK) bitval = PBM_BLACK; hval += hscale; } while (hval >= 100) { if (wcol++ < wcols) *wbP++ = bitval; hval -= 100; } } /* while(col */ } /* if(row */ vval += vscale; row++; } /* while vval */ while (vval >= 100) { if (wrow < XWDROWS) { xwd_writerow (stdout, writerow, wcols); wrow++; } vval -= 100; } if (eof) break; } for (col = 0, bP = writerow; col < (MAXCOLS * hscale) / 100; ++col, ++bP) *bP = PBM_WHITE; while (wrow < XWDROWS) { xwd_writerow (stdout, writerow, wcols); wrow++; } return 0; } mgetty-1.2.1/contrib/gs-security.fix000066400000000000000000000052241334553713100174620ustar00rootroot00000000000000From owner-mgetty Thu Aug 24 11:13:35 1995 Return-Path: Received: by greenie.muc.de (/\==/\ Smail3.1.24.1 #24.2) id ; Thu, 24 Aug 95 11:13 MEST Return-Path: Received: by greenie.muc.de (/\==/\ Smail3.1.24.1 #24.2) id ; Thu, 24 Aug 95 11:13 MEST Received: from tarsier.cv.nrao.edu ([192.33.115.50]) by vogon.muc.de with SMTP id <93325-1>; Thu, 24 Aug 1995 11:13:04 +0200 Received: (from juphoff@localhost) by tarsier.cv.nrao.edu (8.6.12/8.6.9) id FAA07826; Thu, 24 Aug 1995 05:12:23 -0400 Date: Thu, 24 Aug 1995 11:12:23 +0200 Message-Id: <199508240912.FAA07826@tarsier.cv.nrao.edu> From: Jeff Uphoff To: mgetty@muc.de Subject: Ghostscript problem. X-Spook: Mossad NORML Mossad X-Mailer: VM 5.94 (beta); GNU Emacs 19.29.1 X-Attribution: Up Status: RO Here's the description of the hole that I mentioned in my previous e-mail, which was a CC of a message that I was posting to the Linux security list. I CC'd the 'mgetty' list because we were discussing, and trying to compile a list of, software that calls Ghostscript (both "safely" and "unsafely") and I had mentioned that 'faxspool' calls it (safely) to do file-conversions. Since there may be people out there FAXing files that they have received from the outside--thus opening themselves up to this vulnerability--this is of interest here as well. (Any users of the WWW that view remote Postscript files are of course *very* vulnerable!) The easiest way to demonstrate the problem is to view the following Postscript file with either Ghostview or Ghostscript. Even the "-dSAFER" option (which Ghostview v1.5 passes to Ghostscript by default) does not prevent the file-write: %!PS- (%pipe%echo hacker@rogue.site >> /tmp/foo) (r) file quit Replace /tmp/foo with /.rhosts (or use Postscript's getenv capabilites to write to ~/.rhosts) and you quickly see the dangers... One fix (thanks go out to Olaf Kirch for this) is to patch the gs_init.ps file in your Ghostscript library area in the following manner: --- gs_init.ps.orig Sun Aug 20 23:22:01 1995 +++ gs_init.ps Sun Aug 20 23:22:46 1995 @@ -302,7 +302,8 @@ % If we want a "safer" system, disable some obvious ways to cause havoc. SAFER not { (%END SAFER) .skipeof } if /file - { dup (r) eq + { exch dup /..fname exch def exch + dup (r) eq ..fname (%pipe%*) .stringmatch not and { file } { /invalidfileaccess signalerror } ifelse --Up. -- Jeff Uphoff - systems/network admin. | juphoff@nrao.edu National Radio Astronomy Observatory | jeff.uphoff@linux.org Charlottesville, VA, USA | http://linux.nrao.edu/~juphoff/ mgetty-1.2.1/contrib/logparse.c000066400000000000000000000055341334553713100164600ustar00rootroot00000000000000/* Analyse der Fax-Logdatei: Liste aller ausgehenden erfolgreichen */ /* Verbindungen mit Dauer und Kosten. */ /* Das optionale erste Argument gibt die Dauer einer Telefoneinheit an */ /* 24.11.94 Roland Meier */ #include #include #include #include #define STRSIZ 100 int main(int argc, char *argv[]) { FILE *fin; char *ptr; char str[STRSIZ],id[STRSIZ]; double einheit=0, gpreis=0; int amon,atag,astd,amin,asek; int bmon,btag,bstd,bmin,bsek; int anz, stat, geschw=0, ende=0, endeerk=1; if (argc>1) { einheit = atoi(argv[1]); if ((!einheit) || (argc>2)) { fprintf(stderr,"usage: %s [Dauer einer Einheit]\n\n", argv[0]); exit(1); } } if (!einheit) einheit = 360; if ( !(fin=fopen("/var/spool/fax/Faxlog","r"))) { fprintf(stderr,"Logdatei nicht gefunden!\n\n"); exit(2); } printf("Dauer einer Telefoneinheit: %1.0f Sekunden\n", einheit); printf("empfangene ID\t\tDatum\t\tSeiten Dauer Kosten Geschw. OK=0\n"); while (fgets(str,STRSIZ,fin)) { if (strstr(str,"+FCON")) { sscanf(str,"%d/%d %d:%d:%d", &amon, &atag, &astd, &amin, &asek); if (!endeerk) fprintf(stderr, "Fehler: FCON ohne vorheriges hangup!\n"); endeerk=0; /* Flag Ende erkannt */ } else if ((ptr=strstr(str,"fax_id: '+FCSI: "))) { strcpy(id,ptr+17); id[strlen(id)-3]=0; } else if ((ptr=strstr(str,"checking f"))) { sscanf(ptr+10,"%d", &anz); } else if ((ptr=strstr(str,"transmission par"))) { sscanf(ptr+29, "%d", &geschw); } else if (!endeerk && (ptr=strstr(str,"hangup: '+FHNG:"))) { sscanf(str,"%d/%d %d:%d:%d", &bmon, &btag, &bstd, &bmin, &bsek); sscanf(ptr+16, "%d", &stat); ende=endeerk=1; } else if (!endeerk && strstr(str,"##### failed transmitting")) { sscanf(str,"%d/%d %d:%d:%d", &bmon, &btag, &bstd, &bmin, &bsek); ptr=strstr(str,"+FHS:"); sscanf(ptr+5, "%d", &stat); ende=endeerk=1; } if (ende) { double preis; int atime, btime; if (amon != bmon) { /* ich gehe mal vom naechsten Monat aus... */ switch (amon) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: btag += 31; break; default: btag += 30; } } atime = atag*24*3600+astd*3600+amin*60+asek; btime = btag*24*3600+bstd*3600+bmin*60+bsek; preis = ceil((btime-atime)/einheit)*0.23; gpreis += preis; printf("%s\t%2d.%2d %2d:%2d:%2d\t%2d S,%3d Sek,%5.2f DM, G.%d,St %d\n", id, atag,amon,astd,amin,asek, #if 0 btag,bmon,bstd,bmin,bsek, \t%2d.%2d %2d:%2d:%2d #endif anz, btime-atime, preis, geschw, stat); ende=anz=geschw=0; /* falls Fehler beim naechsten Mal */ strcpy(id,"(FEHLER!) "); } } printf("Gesamtkosten: %1.2f DM\n", gpreis); fclose(fin); return(0); } mgetty-1.2.1/contrib/lp-fax000077500000000000000000000031101334553713100156010ustar00rootroot00000000000000: # @(#) FaxPrinter 1.0 # # modelled to resemble the SCO printer drivers as closely # as possible # # install this as /usr/spool/lp/model/fax, then add a printer # (via sysadmsh) with printer interface "fax" (name it what you # want, e.g. "fax"). Then send faxes from your applications with # # lp -d -o to= " # e.g.: # lp -dfax -oto=0893243328 /tmp/fax1.ps # # works only if "faxspool" can be found in the command path PATH=/usr/local/bin:$PATH export PATH # return everything to the right of the first "=" parse () { echo "`expr \"$1\" : \"^[^=]*=\(.*\)\"`" } # general error handling LP_ERR_LABEL="UX:lp" errmsg () { case $1 in ERROR ) sev=" ERROR"; ;; WARNING ) sev="WARNING"; ;; esac echo "${LP_ERR_LABEL}: ${sev}: $2 TO FIX: $3" >&2 } printer=`basename $0` request=$1 name=$2 title=$3 copies=$4 options=$5 shift; shift; shift; shift; shift # resolution normal_res=no # fax number fax_no="" for i in $options do case $i in n|normal|low) normal_res=yes ;; to=*) fax_no=`parse ${i}` ;; esac done # user = fifth field of /etc/passwd user=`sed -n "s/^$name:.*:.*:.*:\(.*\):.*:.*$/\1/p" /etc/passwd` if [ -z "$fax_no" ] then errmsg ERROR "no fax telephone number given" \ "set option \"-o to=\"" exit 1 fi # for the sake of faxq umask 022 # send the file(s) to the standard out $copies times while [ "$copies" -gt 0 ] do /usr/local/bin/faxspool -u $name -f "$name ($user)" $fax_no $* # for file # do # 0<${file} eval ${FILTER} 2>&1 # echo "\033E\c" # done copies=`expr $copies - 1` done exit 0 mgetty-1.2.1/contrib/mgetty-to-flexfax.sh000066400000000000000000000043221334553713100204120ustar00rootroot00000000000000From quack.kfu.com!nsayer Tue Aug 9 00:05:12 1994 Return-Path: Received: by greenie.muc.de (/\==/\ Smail3.1.24.1 #24.2) id ; Tue, 9 Aug 94 00:05 MEST Received: from quack.kfu.com ([192.216.60.254]) by colin.muc.de with SMTP id <135962(2)>; Tue, 9 Aug 1994 00:04:35 +0200 Received: by quack.kfu.com id AA17510 (5.65c8/IDA-1.4.4 for gert@greenie.muc.de); Mon, 8 Aug 1994 15:04:20 -0700 From: Nick Sayer Message-Id: <199408082204.AA17510@quack.kfu.com> Subject: g3 to tiff To: gert@greenie.muc.de (Gert Doering) Date: Tue, 9 Aug 1994 00:04:20 +0200 In-Reply-To: from "Gert Doering" at Aug 8, 94 09:40:18 pm X-Mailer: ELM [version 2.4 PL22] Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Length: 1371 Status: RO I've done it. It's just fax2tiff from the tiff distribution. The trick is to add -M to the parameters because the faxes come in little endian. I also modified it to allow me to add an IMAGEDESCRIPTION tag which contains the TSI of the sender. This matches what flexfax does, and let's faxinfo work right. After that, it's just like this: --- new_fax --- #! /bin/sh PATH=/usr/local/bin:/usr/ucb:/bin:/usr/local/lib/mgetty+sendfax:$PATH export PATH FILE=/var/spool/fax/recvq/mgetty.$$ hangup=$1 ; shift id="$1" ; shift nump=$1 ; shift if [ $hangup -eq 0 ]; then hangup="" fi fax2tiff -d "$id" -M -o $FILE $* >/dev/null 2>&1 rm -f $* chown uucp.uucp $FILE chmod 600 $FILE /var/spool/fax/bin/faxrcvd $FILE '?' '?' '?' "$hangup" ttym9 exit 0 --- Normally 'mgetty.$$' would be a bad choice for a filename, but my faxrcvd script (for flexfax) moves that to a different name anyway. BTW: You might pass this on to Klaus (his e-mail seems to be /dev/null, so far as I can tell :-) ): If answer_mode == ANSWER_VOICE (_not_ ANSWER_VOICE | ANSWER_{DATA,FAX} ), it seems silly to even bother doing "AT+FCLASS=0 A". Might as well just hang up. -- Nick Sayer | "Don't worry, they'll ride up with N6QQQ @ N0ARY.#NOCAL.CA.USA.NOAM | wear." +1 408 249 9630, log in as 'guest' | URL: http://www.kfu.com/~nsayer/ | -- Are You Being Served? mgetty-1.2.1/contrib/mvlog000066400000000000000000000027201334553713100155410ustar00rootroot00000000000000#!/bin/ksh # # rotate mgetty log files # (this needs manual adaption of all relevant paths, otherwise it won't work) # # run this once per week from crontab # # $Log: mvlog,v $ # Revision 1.4 2012/07/18 09:53:42 gert # do not rotate empty mgetty files (leftover from now-unused ttys) # # Revision 1.3 2005/03/13 17:41:32 gert # change mgetty default logfile name (log.tty -> mgetty.tty) # # Revision 1.2 2004/11/13 09:16:48 gert # faxrunqd pid file lives in FAX_SPOOL_OUT (non-root user) # # Revision 1.1 2003/01/19 21:28:10 gert # mgetty log file rotator (base script) # # # where the "mgetty.$tty" files can be found... #LOG=/var/log/mgetty LOG=/var/log cd $LOG || exit 1 # faxrunqd will rotate its log file itself - tell it to kill -USR1 `cat /var/spool/fax/outgoing/faxrunqd.pid` # which ttys are in use here? TTYS=`ls -l mgetty.tty* | sed -e 's/.* mgetty\.//'` # rotate mgetty logs for d in $TTYS do # no point in rotating empty files, just erase them if [ ! -s mgetty.$d ] then rm -f mgetty.$d continue fi cd OLD || exit 1 for i in 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 do im1=$(( $i - 1 )) test -f mgetty.$d.$im1 && mv mgetty.$d.$im1 mgetty.$d.$i done cd .. cp mgetty.$d OLD/mgetty.$d.1 > mgetty.$d done cd OLD || exit 1 for i in 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 do im1=$(( $i - 1 )) test -f sendfax.$im1 && mv sendfax.$im1 sendfax.$i done cd .. cp sendfax.log OLD/sendfax.1 > sendfax.log mgetty-1.2.1/contrib/next-login/000077500000000000000000000000001334553713100165555ustar00rootroot00000000000000mgetty-1.2.1/contrib/next-login/.files000066400000000000000000000000551334553713100176600ustar00rootroot00000000000000Makefile README login.c pathnames.h setenv.c mgetty-1.2.1/contrib/next-login/Makefile000066400000000000000000000025561334553713100202250ustar00rootroot00000000000000# # Copyright (c) 1988 Regents of the University of California. # All rights reserved. # # Redistribution and use in source and binary forms are permitted # provided that the above copyright notice and this paragraph are # duplicated in all such forms and that any documentation, advertising # materials, and other materials related to such redistribution and # use acknowledge that the software was developed by the University # of California, Berkeley. The name of the University may not be # used to endorse or promote products derived from this software # without specific prior written permission. THIS SOFTWARE IS PROVIDED # ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, # WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND # FITNESS FOR A PARTICULAR PURPOSE. # # from @(#)Makefile 5.3 (Berkeley) 5/9/89 # CFLAGS= -O -bsd -DORIGINAL -DFIX8BIT LIBC= /lib/libsys_s.a SRCS= login.c setenv.c OBJS= login.o setenv.o MAN= login.0 DESTDIR= /usr/local all: login login: ${LIBC} ${OBJS} ${CC} -object -o $@ -s ${OBJS} setenv.o: setenv.c ${CC} ${CFLAGS} -DLIBC_SCCS -c $< clean: rm -f ${OBJS} core login cleandir: clean rm -f ${MAN} tags .depend depend: ${SRCS} mkdep -p ${CFLAGS} ${SRCS} install: install -s -o root -g bin -m 4755 login ${DESTDIR}/bin/modem-login lint: ${SRCS} lint ${CFLAGS} ${SRCS} tags: ${SRCS} ctags ${SRCS} mgetty-1.2.1/contrib/next-login/README000066400000000000000000000104641334553713100174420ustar00rootroot00000000000000This is a replacement for NEXTSTEP's /bin/login. It has been patched by Ingo Paschke to provide 8-bit clean login's with mgetty's sgtty NEXTSTEP port. To use, just "make install". This will install modem-login in /usr/local/bin. Then, in mgetty's login.config, replace `/bin/login' with `/usr/local/bin/modem-login' or change DEFAULT_LOGIN_PROGRAM in policy.h to `/usr/local/bin/modem-login'. For more information on NEXTSTEP and mgetty, consult the `Operating Systems' section on NEXTSTEP in the mgetty manual. Gregor Hoffleit This is the README of the original jsh-login as found on peanuts.leo.org as Patches/jsh-login.s.tar.gz: --- This is a replacement for /bin/login in NeXT Software Release 2.0 and 2.1 that enables job control for /bin/sh users. /bin/sh and /bin/jsh are hard links to the same file; job control is enabled if argv[0][0]=='j' or the -J flag is set. Shells started from login have a '-' prepended to their basename to indicate that .profile should be sourced, so if you specify /bin/jsh as your login shell, its sees its name as -jsh, and doesn't activate job control. This has been reported to BUG_NEXT. This version of login passes the "-J" flag if the login shell is /bin/sh. Everything else still thinks you're running "regular" sh, so you don't have to muck with /etc/shells or anything. Inferior shells will *not* have job control enabled; use jsh instead if that's what you want (most of the time it isn't). --- This is Ingo's patch: --- Sun, 14 Apr 1996 23:23:25 de.comp.sys.next Thread 12 of 15 Lines 92 mgetty fuer NSfIP? - Teilerfolg... No responses ipaschke@xlan.hil.de Ingo Paschke at private Hallo! ipaschke@xlan.hil.de (Ingo Paschke) writes: >Das Problem ist nur, dass /bin/login offenbar die Verbindung wieder auf >7-Bit, gerade Paritaet zuruecksetzt: Issue und login-Prompt werden von >mgetty korrekt in 8-Bit ausgegeben, das Passwort-Prompt ist dann nicht mehr >lesbar, weil es in 7-Bit ausgegeben wird. Man nehme jsh-login.s.tar.gz von peanuts (/Patches), wende folgendes diff an (NeXT_repair_line ist von mgetty-0.99 geklaut): ------------------------------------------------------------------- diff -burN jsh-login.orig/Makefile jsh-login/Makefile --- jsh-login.orig/Makefile Fri Apr 26 11:51:56 1991 +++ jsh-login/Makefile Sun Apr 14 22:43:42 1996 @@ -17,11 +17,12 @@ # from @(#)Makefile 5.3 (Berkeley) 5/9/89 # -CFLAGS= -O -bsd +CFLAGS= -O -bsd -DORIGINAL -DFIX8BIT LIBC= /lib/libsys_s.a SRCS= login.c setenv.c OBJS= login.o setenv.o MAN= login.0 +DESTDIR= /usr/local all: login @@ -40,9 +41,8 @@ depend: ${SRCS} mkdep -p ${CFLAGS} ${SRCS} -install: ${MAN} - install -s -o root -g bin -m 4755 login ${DESTDIR}/bin/login - install -c -o bin -g bin -m 444 login.0 ${DESTDIR}/usr/man/cat1 +install: + install -s -o root -g bin -m 4755 login ${DESTDIR}/bin/modem-login lint: ${SRCS} lint ${CFLAGS} ${SRCS} diff -burN jsh-login.orig/login.c jsh-login/login.c --- jsh-login.orig/login.c Fri Apr 26 12:00:26 1991 +++ jsh-login/login.c Sun Apr 14 22:37:10 1996 @@ -180,6 +180,10 @@ (void)ioctl(0, TIOCSETC, &tc); (void)ioctl(0, TIOCSETP, &sgttyb); +#if defined(NeXT) && defined(FIX8BIT) + NeXT_repair_line(0); +#endif + for (cnt = getdtablesize(); cnt > 2; cnt--) close(cnt); @@ -705,5 +709,16 @@ (void)write(fd, (char *)ut, sizeof(struct utmp)); (void)close(fd); } +} +#endif + +#if defined(NeXT) && defined(FIX8BIT) +NeXT_repair_line(int fd) +{ + int bitset = LPASS8 | LPASS8OUT; + int bitclr = LNOHANG; + + ioctl(fd, TIOCLBIS, &bitset); + ioctl(fd, TIOCLBIC, &bitclr); } #endif -------------------------------------------------------------- ... und kann sich ganz auf das naechste Problem konzentrieren. Dummerweise funktioniert naemlich das "LNOHANG"-Bit-Loeschen nicht (d.h. ich denke schon, dass das Loeschen funktioniert, das scheint NEXTSTEP jedoch wenig zu stoeren). Legt der Anrufer also einfach auf, haengt die Kiste ewiglich :(. Ideen? Aaargh! Jemand erwecke mich bitte aus diesem NEXTSTEP-tty-Alptraum! ;). Ciao, Ingo. -- Ingo Paschke Braunschweig, Germany [MIME, Nextmail welcome.] mgetty-1.2.1/contrib/next-login/login.c000066400000000000000000000415151334553713100200370ustar00rootroot00000000000000/* * Copyright (c) 1980, 1987, 1988 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms are permitted * provided that the above copyright notice and this paragraph are * duplicated in all such forms and that any documentation, * advertising materials, and other materials related to such * distribution and use acknowledge that the software was developed * by the University of California, Berkeley. The name of the * University may not be used to endorse or promote products derived * from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ #ifndef lint char copyright[] = "@(#) Copyright (c) 1980, 1987, 1988 The Regents of the University of California.\n\ All rights reserved.\n"; #endif /* not lint */ #ifndef lint static char sccsid[] = "@(#)login.c 5.40 (Berkeley) 5/9/89"; #endif /* not lint */ /* * login [ name ] * login -h hostname (for telnetd, etc.) * login -f name (for pre-authenticated login: datakit, xterm, etc.) */ #include #ifdef NeXT #include #else #include #endif #include #include #include #include #include #include #ifdef NeXT #include #ifndef UT_NAMESIZE #define UT_NAMESIZE 8 #endif #endif #include #include #include #include #include #include #include #include #include #include #include "pathnames.h" #ifdef KERBEROS #include #include char realm[REALM_SZ]; int kerror = KSUCCESS, notickets = 1; #endif #define TTYGRPNAME "tty" /* name of group to own ttys */ /* * This bounds the time given to login. Not a define so it can * be patched on machines where it's too small. */ int timeout = 300; struct passwd *pwd; int failures; char term[64], *hostname, *username, *tty; struct sgttyb sgttyb; struct tchars tc = { CINTR, CQUIT, CSTART, CSTOP, CEOT, CBRK }; struct ltchars ltc = { CSUSP, CDSUSP, CRPRNT, CFLUSH, CWERASE, CLNEXT }; #ifndef NeXT /* NeXT doesn't ifdef this out for some reason */ char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; #endif main(argc, argv) int argc; char **argv; { extern int errno, optind; extern char *optarg, **environ; struct timeval tp; struct tm *ttp; struct group *gr; register int ch; register char *p; int ask, fflag, hflag, pflag, cnt; int quietlog, passwd_req, ioctlval, timedout(); char *domain, *salt, *envinit[1], *ttyn, *pp; char tbuf[MAXPATHLEN + 2], tname[sizeof(_PATH_TTY) + 10]; char *ctime(), *ttyname(), *stypeof(), *crypt(), *getpass(); time_t time(); off_t lseek(); (void)signal(SIGALRM, timedout); (void)alarm((u_int)timeout); (void)signal(SIGQUIT, SIG_IGN); (void)signal(SIGINT, SIG_IGN); (void)setpriority(PRIO_PROCESS, 0, 0); #ifndef NeXT (void)quota(Q_SETUID, 0, 0, 0); #endif /* * -p is used by getty to tell login not to destroy the environment * -f is used to skip a second login authentication * -h is used by other servers to pass the name of the remote * host to login so that it may be placed in utmp and wtmp */ (void)gethostname(tbuf, sizeof(tbuf)); domain = index(tbuf, '.'); fflag = hflag = pflag = 0; passwd_req = 1; while ((ch = getopt(argc, argv, "fh:p")) != EOF) switch (ch) { case 'f': fflag = 1; break; case 'h': if (getuid()) { (void)fprintf(stderr, "login: -h for super-user only.\n"); exit(1); } hflag = 1; if (domain && (p = index(optarg, '.')) && strcasecmp(p, domain) == 0) *p = 0; hostname = optarg; break; case 'p': pflag = 1; break; case '?': default: (void)fprintf(stderr, "usage: login [-fp] [username]\n"); exit(1); } argc -= optind; argv += optind; if (*argv) { username = *argv; ask = 0; } else ask = 1; ioctlval = 0; (void)ioctl(0, TIOCLSET, &ioctlval); (void)ioctl(0, TIOCNXCL, 0); (void)fcntl(0, F_SETFL, ioctlval); (void)ioctl(0, TIOCGETP, &sgttyb); sgttyb.sg_erase = CERASE; sgttyb.sg_kill = CKILL; (void)ioctl(0, TIOCSLTC, <c); (void)ioctl(0, TIOCSETC, &tc); (void)ioctl(0, TIOCSETP, &sgttyb); #if defined(NeXT) && defined(FIX8BIT) NeXT_repair_line(0); #endif for (cnt = getdtablesize(); cnt > 2; cnt--) close(cnt); ttyn = ttyname(0); if (ttyn == NULL || *ttyn == '\0') { (void)sprintf(tname, "%s??", _PATH_TTY); ttyn = tname; } if (tty = rindex(ttyn, '/')) ++tty; else tty = ttyn; openlog("login", LOG_ODELAY, LOG_AUTH); for (cnt = 0;; ask = 1) { ioctlval = 0; (void)ioctl(0, TIOCSETD, &ioctlval); if (ask) { fflag = 0; getloginname(); } /* * Note if trying multiple user names; * log failures for previous user name, * but don't bother logging one failure * for nonexistent name (mistyped username). */ if (failures && strcmp(tbuf, username)) { if (failures > (pwd ? 0 : 1)) badlogin(tbuf); failures = 0; } (void)strncpy(tbuf, username, sizeof(tbuf)-1); tbuf[sizeof(tbuf)-1] = '\0'; if (pwd = getpwnam(username)) salt = pwd->pw_passwd; else salt = "xx"; /* if user not super-user, check for disabled logins */ if (pwd == NULL || pwd->pw_uid) checknologin(); /* * Disallow automatic login to root; if not invoked by * root, disallow if the uid's differ. */ if (fflag && pwd) { int uid = getuid(); passwd_req = pwd->pw_uid == 0 || (uid && uid != pwd->pw_uid); } #ifdef NeXT if (pwd->pw_uid == 0 && !rootterm(tty)) { fprintf(stderr, "%s login refused on this terminal.\n", pwd->pw_name); if (hostname) syslog(LOG_NOTICE, "LOGIN %s REFUSED FROM %s ON TTY %s", pwd->pw_name, hostname, tty); else syslog(LOG_NOTICE, "LOGIN %s REFUSED ON TTY %s", pwd->pw_name, tty); continue; } #endif /* * If no pre-authentication and a password exists * for this user, prompt for one and verify it. */ if (!passwd_req || (pwd && !*pwd->pw_passwd)) break; setpriority(PRIO_PROCESS, 0, -4); pp = getpass("Password:"); p = crypt(pp, salt); setpriority(PRIO_PROCESS, 0, 0); #ifdef KERBEROS /* * If not present in pw file, act as we normally would. * If we aren't Kerberos-authenticated, try the normal * pw file for a password. If that's ok, log the user * in without issueing any tickets. */ if (pwd && !krb_get_lrealm(realm,1)) { /* * get TGT for local realm; be careful about uid's * here for ticket file ownership */ (void)setreuid(geteuid(),pwd->pw_uid); kerror = krb_get_pw_in_tkt(pwd->pw_name, "", realm, "krbtgt", realm, DEFAULT_TKT_LIFE, pp); (void)setuid(0); if (kerror == INTK_OK) { bzero(pp, strlen(pp)); notickets = 0; /* user got ticket */ break; } } #endif (void) bzero(pp, strlen(pp)); if (pwd && !strcmp(p, pwd->pw_passwd)) break; (void)printf("Login incorrect\n"); failures++; /* we allow 10 tries, but after 3 we start backing off */ if (++cnt > 3) { if (cnt >= 10) { badlogin(username); (void)ioctl(0, TIOCHPCL, (struct sgttyb *)NULL); sleepexit(1); } sleep((u_int)((cnt - 3) * 5)); } } /* committed to login -- turn off timeout */ (void)alarm((u_int)0); /* paranoia... */ endpwent(); #ifndef NeXT /* * If valid so far and root is logging in, see if root logins on * this terminal are permitted. */ if (pwd->pw_uid == 0 && !rootterm(tty)) { if (hostname) syslog(LOG_NOTICE, "ROOT LOGIN REFUSED FROM %s", hostname); else syslog(LOG_NOTICE, "ROOT LOGIN REFUSED ON %s", tty); (void)printf("Login incorrect\n"); sleepexit(1); } if (quota(Q_SETUID, pwd->pw_uid, 0, 0) < 0 && errno != EINVAL) { switch(errno) { case EUSERS: (void)fprintf(stderr, "Too many users logged on already.\nTry again later.\n"); break; case EPROCLIM: (void)fprintf(stderr, "You have too many processes running.\n"); break; default: perror("quota (Q_SETUID)"); } sleepexit(0); } #endif if (chdir(pwd->pw_dir) < 0) { (void)printf("No directory %s!\n", pwd->pw_dir); if (chdir("/")) exit(0); pwd->pw_dir = "/"; (void)printf("Logging in with home = \"/\".\n"); } quietlog = access(_PATH_HUSHLOGIN, F_OK) == 0; #ifdef KERBEROS if (notickets && !quietlog) (void)printf("Warning: no Kerberos tickets issued\n"); #endif #ifndef NeXT #define TWOWEEKS (14*24*60*60) if (pwd->pw_change || pwd->pw_expire) (void)gettimeofday(&tp, (struct timezone *)NULL); if (pwd->pw_change) if (tp.tv_sec >= pwd->pw_change) { (void)printf("Sorry -- your password has expired.\n"); sleepexit(1); } else if (tp.tv_sec - pwd->pw_change < TWOWEEKS && !quietlog) { ttp = localtime(&pwd->pw_change); (void)printf("Warning: your password expires on %s %d, %d\n", months[ttp->tm_mon], ttp->tm_mday, TM_YEAR_BASE + ttp->tm_year); } if (pwd->pw_expire) if (tp.tv_sec >= pwd->pw_expire) { (void)printf("Sorry -- your account has expired.\n"); sleepexit(1); } else if (tp.tv_sec - pwd->pw_expire < TWOWEEKS && !quietlog) { ttp = localtime(&pwd->pw_expire); (void)printf("Warning: your account expires on %s %d, %d\n", months[ttp->tm_mon], ttp->tm_mday, TM_YEAR_BASE + ttp->tm_year); } #endif /* nothing else left to fail -- really log in */ { #ifdef NeXT void login(); #endif struct utmp utmp; bzero((char *)&utmp, sizeof(utmp)); (void)time(&utmp.ut_time); strncpy(utmp.ut_name, username, sizeof(utmp.ut_name)); if (hostname) strncpy(utmp.ut_host, hostname, sizeof(utmp.ut_host)); strncpy(utmp.ut_line, tty, sizeof(utmp.ut_line)); login(&utmp); } dolastlog(quietlog); if (!hflag) { /* XXX */ static struct winsize win = { 0, 0, 0, 0 }; (void)ioctl(0, TIOCSWINSZ, &win); } (void)chown(ttyn, pwd->pw_uid, (gr = getgrnam(TTYGRPNAME)) ? gr->gr_gid : pwd->pw_gid); (void)chmod(ttyn, 0620); (void)setgid(pwd->pw_gid); initgroups(username, pwd->pw_gid); #ifndef NeXT quota(Q_DOWARN, pwd->pw_uid, (dev_t)-1, 0); #endif if (*pwd->pw_shell == '\0') pwd->pw_shell = _PATH_BSHELL; /* turn on new line discipline for the csh */ else if (!strcmp(pwd->pw_shell, _PATH_CSHELL)) { ioctlval = NTTYDISC; (void)ioctl(0, TIOCSETD, &ioctlval); } /* real NeXT source diverges here */ /* destroy environment unless user has requested preservation */ #ifdef NeXT if (!pflag){ envinit[0]=(char *)NULL; environ = envinit; } #else if (!pflag) environ = envinit; #endif (void)setenv("HOME", pwd->pw_dir, 1); (void)setenv("SHELL", pwd->pw_shell, 1); if (term[0] == '\0') strncpy(term, stypeof(tty), sizeof(term)); (void)setenv("TERM", term, 0); (void)setenv("USER", pwd->pw_name, 1); (void)setenv("PATH", _PATH_DEFPATH, 0); /* real NeXT source merges here */ if (tty[sizeof("tty")-1] == 'd') syslog(LOG_INFO, "DIALUP %s, %s", tty, pwd->pw_name); if (pwd->pw_uid == 0) if (hostname) syslog(LOG_NOTICE, "ROOT LOGIN ON %s FROM %s", tty, hostname); else syslog(LOG_NOTICE, "ROOT LOGIN ON %s", tty); if (!quietlog) { struct stat st; motd(); (void)sprintf(tbuf, "%s/%s", _PATH_MAILDIR, pwd->pw_name); if (stat(tbuf, &st) == 0 && st.st_size != 0) (void)printf("You have %smail.\n", (st.st_mtime > st.st_atime) ? "new " : ""); } (void)signal(SIGALRM, SIG_DFL); (void)signal(SIGQUIT, SIG_DFL); (void)signal(SIGINT, SIG_DFL); (void)signal(SIGTSTP, SIG_IGN); tbuf[0] = '-'; strcpy(tbuf + 1, (p = rindex(pwd->pw_shell, '/')) ? p + 1 : pwd->pw_shell); #ifndef NeXT if (setlogname(pwd->pw_name, strlen(pwd->pw_name)) < 0) syslog(LOG_ERR, "setlogname() failure: %m"); #endif /* discard permissions last so can't get killed and drop core */ (void)setuid(pwd->pw_uid); #if defined(NeXT) && !defined(ORIGINAL) execlp(pwd->pw_shell, tbuf, /* enable job control! */ strcmp(pwd->pw_shell, _PATH_BSHELL) ? 0 : "-J", 0); #else execlp(pwd->pw_shell, tbuf, 0); #endif (void)fprintf(stderr, "login: no shell: %s.\n", strerror(errno)); exit(0); } getloginname() { register int ch; register char *p; static char nbuf[UT_NAMESIZE + 1]; for (;;) { (void)printf("login: "); for (p = nbuf; (ch = getchar()) != '\n'; ) { if (ch == EOF) { badlogin(username); exit(0); } if (p < nbuf + UT_NAMESIZE) *p++ = ch; } if (p > nbuf) if (nbuf[0] == '-') (void)fprintf(stderr, "login names may not start with '-'.\n"); else { *p = '\0'; username = nbuf; break; } } } timedout() { (void)fprintf(stderr, "Login timed out after %d seconds\n", timeout); exit(0); } rootterm(ttyn) char *ttyn; { struct ttyent *t; return((t = getttynam(ttyn)) && t->ty_status&TTY_SECURE); } jmp_buf motdinterrupt; motd() { register int fd, nchars; int (*oldint)(), sigint(); char tbuf[8192]; if ((fd = open(_PATH_MOTDFILE, O_RDONLY, 0)) < 0) return; oldint = signal(SIGINT, sigint); if (setjmp(motdinterrupt) == 0) while ((nchars = read(fd, tbuf, sizeof(tbuf))) > 0) (void)write(fileno(stdout), tbuf, nchars); (void)signal(SIGINT, oldint); (void)close(fd); } sigint() { longjmp(motdinterrupt, 1); } checknologin() { register int fd, nchars; char tbuf[8192]; if ((fd = open(_PATH_NOLOGIN, O_RDONLY, 0)) >= 0) { while ((nchars = read(fd, tbuf, sizeof(tbuf))) > 0) (void)write(fileno(stdout), tbuf, nchars); sleepexit(0); } } dolastlog(quiet) int quiet; { struct lastlog ll; int fd; char *ctime(); if ((fd = open(_PATH_LASTLOG, O_RDWR, 0)) >= 0) { (void)lseek(fd, (off_t)pwd->pw_uid * sizeof(ll), L_SET); if (!quiet) { if (read(fd, (char *)&ll, sizeof(ll)) == sizeof(ll) && ll.ll_time != 0) { (void)printf("Last login: %.*s ", 24-5, (char *)ctime(&ll.ll_time)); if (*ll.ll_host != '\0') (void)printf("from %.*s\n", sizeof(ll.ll_host), ll.ll_host); else (void)printf("on %.*s\n", sizeof(ll.ll_line), ll.ll_line); } (void)lseek(fd, (off_t)pwd->pw_uid * sizeof(ll), L_SET); } bzero((char *)&ll, sizeof(ll)); (void)time(&ll.ll_time); strncpy(ll.ll_line, tty, sizeof(ll.ll_line)); if (hostname) strncpy(ll.ll_host, hostname, sizeof(ll.ll_host)); (void)write(fd, (char *)&ll, sizeof(ll)); (void)close(fd); } } badlogin(name) char *name; { if (failures == 0) return; if (hostname) syslog(LOG_NOTICE, "%d LOGIN FAILURE%s FROM %s, %s", failures, failures > 1 ? "S" : "", hostname, name); else syslog(LOG_NOTICE, "%d LOGIN FAILURE%s ON %s, %s", failures, failures > 1 ? "S" : "", tty, name); } #undef UNKNOWN #define UNKNOWN "su" char * stypeof(ttyid) char *ttyid; { struct ttyent *t; return(ttyid && (t = getttynam(ttyid)) ? t->ty_type : UNKNOWN); } /* NeXT has their version of setenv here */ getstr(buf, cnt, err) char *buf, *err; int cnt; { char ch; do { if (read(0, &ch, sizeof(ch)) != sizeof(ch)) exit(1); if (--cnt < 0) { (void)fprintf(stderr, "%s too long\r\n", err); sleepexit(1); } *buf++ = ch; } while (ch); } sleepexit(eval) int eval; { sleep((u_int)5); exit(eval); } #ifdef NeXT /* * Copyright (c) 1988 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms are permitted * provided that the above copyright notice and this paragraph are * duplicated in all such forms and that any documentation, * advertising materials, and other materials related to such * distribution and use acknowledge that the software was developed * by the University of California, Berkeley. The name of the * University may not be used to endorse or promote products derived * from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)login.c 5.1 (Berkeley) 9/27/88"; #endif /* LIBC_SCCS and not lint */ #ifdef NOTDEF /* included above */ #include #include #include #include #endif #define UTMPFILE "/etc/utmp" #define WTMPFILE "/usr/adm/wtmp" void login(ut) struct utmp *ut; { register int fd; int tty; off_t lseek(); tty = ttyslot(); if (tty > 0 && (fd = open(UTMPFILE, O_WRONLY, 0)) >= 0) { (void)lseek(fd, (long)(tty * sizeof(struct utmp)), L_SET); (void)write(fd, (char *)ut, sizeof(struct utmp)); (void)close(fd); } if ((fd = open(WTMPFILE, O_WRONLY|O_APPEND, 0)) >= 0) { (void)write(fd, (char *)ut, sizeof(struct utmp)); (void)close(fd); } } #endif #if defined(NeXT) && defined(FIX8BIT) NeXT_repair_line(int fd) { int bitset = LPASS8 | LPASS8OUT; int bitclr = LNOHANG; ioctl(fd, TIOCLBIS, &bitset); ioctl(fd, TIOCLBIC, &bitclr); } #endif mgetty-1.2.1/contrib/next-login/pathnames.h000066400000000000000000000025541334553713100207140ustar00rootroot00000000000000/* * Copyright (c) 1989 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms are permitted * provided that the above copyright notice and this paragraph are * duplicated in all such forms and that any documentation, * advertising materials, and other materials related to such * distribution and use acknowledge that the software was developed * by the University of California, Berkeley. The name of the * University may not be used to endorse or promote products derived * from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * @(#)pathnames.h 5.3 (Berkeley) 5/9/89 */ #ifdef NeXT #define _PATH_BSHELL "/bin/sh" #define _PATH_CSHELL "/bin/csh" #define _PATH_LASTLOG "/usr/adm/lastlog" #define _PATH_TTY "/dev/tty" #define _PATH_DEFPATH ":/usr/ucb:/bin:/usr/bin:/usr/local/bin" #define _PATH_HUSHLOGIN ".hushlogin" #define _PATH_MAILDIR "/usr/spool/mail" #else #include #define _PATH_DEFPATH "/bin:/usr/bin:/usr/games:" #define _PATH_HUSHLOGIN ".hushlogin" #define _PATH_MAILDIR "/var/spool/mail" #endif #define _PATH_MOTDFILE "/etc/motd" #define _PATH_NOLOGIN "/etc/nologin" mgetty-1.2.1/contrib/next-login/setenv.c000066400000000000000000000072011334553713100202250ustar00rootroot00000000000000/* * Copyright (c) 1987 Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms are permitted * provided that the above copyright notice and this paragraph are * duplicated in all such forms and that any documentation, * advertising materials, and other materials related to such * distribution and use acknowledge that the software was developed * by the University of California, Berkeley. The name of the * University may not be used to endorse or promote products derived * from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid1[] = "@(#)setenv.c 5.3 (Berkeley) 5/16/90"; #ifndef NeXT static char sccsid2[] = "@(#)getenv.c 5.6 (Berkeley) 5/16/90"; #endif #endif /* LIBC_SCCS and not lint */ /* * setenv -- * Set the value of the environmental variable "name" to be * "value". If rewrite is set, replace any current value. */ setenv(name, value, rewrite) register char *name, *value; int rewrite; { extern char **environ, *malloc(); static int alloced; /* if allocated space before */ register char *C; int l_value, offset; static char *_findenv(); if (*value == '=') /* no `=' in value */ ++value; l_value = strlen(value); if ((C = _findenv(name, &offset))) { /* find if already exists */ if (!rewrite) return(0); if (strlen(C) >= l_value) { /* old larger; copy over */ while (*C++ = *value++); return(0); } } else { /* create new slot */ register int cnt; register char **P; for (P = environ, cnt = 0; *P; ++P, ++cnt); if (alloced) { /* just increase size */ environ = (char **)realloc((char *)environ, (sizeof(char *) * (cnt + 2))); if (!environ) return(-1); } else { /* get new space */ alloced = 1; /* copy old entries into it */ P = (char **)malloc((sizeof(char *) * (cnt + 2))); if (!P) return(-1); bcopy(environ, P, cnt * sizeof(char *)); environ = P; } environ[cnt + 1] = 0; offset = cnt; } for (C = name; *C && *C != '='; ++C); /* no `=' in name */ if (!(environ[offset] = /* name + `=' + value */ malloc(((int)(C - name) + l_value + 2)))) return(-1); for (C = environ[offset]; (*C = *name++) && *C != '='; ++C); for (*C++ = '='; *C++ = *value++;); return(0); } /* * unsetenv(name) -- * Delete environmental variable "name". */ void unsetenv(name) char *name; { extern char **environ; register char **P; int offset; static char *_findenv(); while (_findenv(name, &offset)) /* if set multiple times */ for (P = &environ[offset];; ++P) if (!(*P = *(P + 1))) break; } #ifndef NeXT /* * getenv -- * Returns ptr to value associated with name, if any, else NULL. */ char * getenv(name) char *name; { int offset; static char *_findenv(); return(_findenv(name, &offset)); } #endif /* * _findenv -- * Returns pointer to value associated with name, if any, else NULL. * Sets offset to be the offset of the name/value combination in the * environmental array, for use by setenv(3) and unsetenv(3). * Explicitly removes '=' in argument name. */ static char * _findenv(name, offset) register char *name; int *offset; { extern char **environ; register int len; register char **P, *C; for (C = name, len = 0; *C && *C != '='; ++C, ++len); for (P = environ; *P; ++P) if (!strncmp(*P, name, len)) if (*(C = *P + len) == '=') { *offset = P - environ; return(++C); } return(0); } mgetty-1.2.1/contrib/pbm2styl800.tar.gz000066400000000000000000000075171334553713100176360ustar00rootroot00000000000000‹wLN0íksÚH2_£_1&›l ÆØ±Mî°_ÖÂÎån½®­ 0FJ¿¶’ß~Ý=’ØÞì%{uEïƒ4ÓÓïéî™q×®ùÁ½µU©”{/¾T+•F£Î^0Æ6ô·ZW¿ñëFe³ÆX£R[¯×á¾Wkðþ«|'z2ú÷{HËæÎcã„çÿ‚~,¬­hl…±qÚ à =,î—ØÛµêÛ·삤Ã>†b<+*iýþX²8ƒ²Ûв)Jñܶt¼+¶™˜ÒÑY+ô“ßnÀ˜5McÚÚ ëìŸGNßõñ(#=Ö‚Nà…Ƀ˫fá§ÀT¤d­òv­²É*ÕíÚæöÆû©°“Ÿä‰šÔ7Ò—®ËÈò#á'<GX‚ûÂ$¤Ò0Ž…e†Î©{eоtÛ?=ûwçèý‡ Vøù+éô¬Ðlä–‡ïˆC‹Ôü:ìÆu”ø˜Ž%|x:&¹öØA عðizaoïH¦7®4ã'EéÌâ€^~×ÐÙð‰Ô¯õ‘níЈ™_6ê[•«\¯WØ/BZ€ÒæÛ¬Ö¶Ø™¼âO怣yÕÆV}KM< u=“¨ãŠ8vìú4¦5 BaY‚¹¾ @=LÚ±u-Ïã÷é™\¦™<žIÄeF]6 ¶wŸõCP@}‹„$µÔP›û#z _„¸'ãTÆ‘œìp'´¬ßznè4é~ÂnGhð‹¡•Ö÷„€i–¯=øM_ Á¡'¤ -i µ8æVJ`ô%â·YÙQ¿éãvë£W»‘rÕ«ß“é°PòœÑg· ²¶á‰‚“s@Õ¡‰ ÄÄÈlL˜AÆAWíeÄ a Ð廈D°árÄAEçð)…‡Þƒž,¥M˜í»^ñ¸¼Þ]‡ÕÕÒ„ø K$Ù~žñÌëìàHm¤HLìNîÄRT$Ôx‚›Å7E²íë•ZµqUÒ«:üÕÉK;™)_Xæ§°|ñ ¢|æƒÔXW€9>È.¶j‡™ tÉbuܺ¤ºY´‚ä$HNîy;D75dzýˆ%TsdÔ}r®™ë <䪒¬95è‹6ÿW¤¶ÕÕÉ´/3WI mËÿÁC lKQG¼©QˆI6ñÝôÓŒÙe…Gá U¡‚.èÅ+†^ohñ°Ÿ]5+]eÈ›;×ïŠFµ´sm)”¨gÄèGØ ²GK:#ÜøØFƒa«YÝݽž–;®:>F»QÄÅ$ô 'ðÇ^9‰Œ3´;ÛD¬¦\­T+[ »y6¡€m(Ön¥g"´ {}‘\Ô@ïÁ<£â—£«fQùšuõ¹,½{w]Z©¾­ÍµÕxÂ*šbjR}ësêëµôœçL1=¥ñŒ)[zjÊ| ªØ¯¶¡h÷d¡Góý‚`1Ù{#«_]½j¢(KÍfe: ÌÖ1ÂÄKÒÞ™†Ùž:éþÈR³â-™Ž.(-0u6š%˜YAöƒëÉ× ²Q¹\ž…À¿•AoX¼~níAžÈªÛóßÕ¶g½šKo2¯þÎÆ#ï6g¿›¯ Ì4çìòqRRÕYMgu¦›¸»›.$¸–£?ŠÀ,³!üJ(§Ф`ïCO8åG0̶~„|À›;p>óßä}1|›>0„§½2†Ç÷ѹ^ú-¤ÌóÚ„”øËÜQ³‰ý2ÇÝ•SæU‘D‚ë̾™<–S‰4¼ü,H¦¸»“©Ò-Τè*«í g)=´<á~— ‰b³’ˤÜà¿„½¡°± Htæv1åncÙ`&ÉE‹(HyhOá¸q½!w(u÷!ß>°«{j·udo°¨ö€öÜì¬Ü’š¤9ái­AU ¸|L`nþ¤’iÖ¶*[F‚P˜HX‚"ª6â:•-'¹)¦:Ÿö?¶;ÆÑÉÑÅ6dË=xh3§ÊœÚ´”íææºráõF…™c©ÃÈU§¶RÛh4#‚øÐz\8Ä]¿¨ºzáuoåuÿ+èµM}s}:Ö± .'Ry ë•ô©Çkø8ŸÌàY%¹ Fešª†æ]¿7”h¨°o=ÎÀ­'‘Ä$¨X&$¬Pé¯J3Óï´œˆ[ óìty–ͯN!ÂC.G)Žÿ¢Z&Ô¿øÀÃq0öÜi`ª1as©ºÜôtê#¬Àכ˫’ö{LJèøràSõºaÿ²V‰:g”²û$él2qw±¨º*UÏ¡k ߇݇ê+3V›}ÕƒRŒÿSbõCe»à´°-\ ‡Š[³°<•]Ï£”Ü û^Øßf…'ùb—ÆÍ ¾tzå*þûÄlHMü¨¾<Û;6ùI8hËTô/Sió˜ ¿‚ùuÉ“uº“'\µºžÂ¥((¶Ç>qÜ[PjmU*%æpØ—•3.—'ΘÑXmccJgê3¶wj1ÝqŸeZ!äVEp:œ.éxÄÖÙ4¾.œÕqñ%°èí§Cn$ÀÕhØ–mÌ *ÄnzI(¬@–²ÚLq”ŸÞÜë¢×cÇÎ#-Fêx±³ºqH¨sâʉŠÒ—$ üLგÞ= (¬+|פDå÷¸C4HLP²×² ¿‰¢Ï›¨Cµó<©ZÂÁ× Îêÿ8'ö<*±{›µ­|°Ì/É{©Ép´ê=ëì,ÚNx· ž4\Ê.Þ #Ï"jÒ¯6:à‰<§S( hÔ#$ñtÕ±ƒ=:À}Õ å¸gÊD¦p­FÈ “Ì"Sû?%vqÚ”ä¢q??±©Ù `^ÛÂŒDá?ÆNÂ^­ÅšÈOå ñ ‡ØÌ$”$ûÁí¯>¹ZÀŽùHôÁŒ¿çŸÿ²ju£ž;ÿ­Ö«•Åùï€W,¶•V/§N‚—µWÚ«o;ƉÚâëÜù,>š:ˆÕàé¾k>o[ÛßÙd½^ú¡qhñ¯n½?‡×ÆiŸ¹eá¨VèS«©Ë=Ø<ãd[K1¹9ûvµ—?÷cø$Œ%f¸é¹Ñ°Æi÷’UÊ×2ˆËîvîX}u/7‚ä–BHéÇ10˘8Û0¦â±i/=›ý,IYŒ_õ~evëà¸ý53 úU­yÑê-jÍfÐI¼×ØÖ^¢ƒ<ôn² ÁÃòà!»ÚÄ–ÔZÙ¥;Æÿ (E}ß5žˆÿõJ½š‹ÿ•F­±ˆÿ?”þUz dÚcµ¯óAÓ26'©DŽC¬În…E P1Äõƒï²‘ëÐø§3“û¾æKÁxاÜfùš—ùX8Ñù´™¾€7G®pÙ=ÏòãT¨Å%@ôP¸` ÛÄ(ÎkaÂvª(›œŸhŽÜÂl9ˆE¬Úmà©>õ…Oa©ª(ÏRÙÇöÑ ì1hõ‘*Ÿ-£¾°Ç`Œ‰²âvÞòÓðBI’αá!±W¥3(?Ò¥"R¡ÎУ‚ …ú™‡©ºÎaZ1–»pJ lH-¼ïúÐ~o±ýmR´í=ˆp@çHªž^PC–À Øò`=pÙe#¶G:ª6Á¸–m(ŃûUdØçw0¶¬€H{|²ìÖ€˜AÀS< ß‹²ƒˆé¬»Ò!–X ?â›ûqÓP«–«[JK1]eÖ¦¼¤±(œµ˜R3C¡ö!‘ÁëLÎï&IahJÚ6"X¶§Î°?œS°jkaû2ºŒgæn•eúU>ZtËÑÐU1XÆî1mbÈäé˜îp-7ËèÂPÓ ´8ð D,À¿ wÄ«ï„t 4’ˆAaQ—Pð`ÜLûˆÆ¤hh“F¢¦}B‡Ê÷!êë&2ô‰]y1)NÂÏúVÿ[[_7ÎöABØ…üY:áÞ¤¸ÅV¼…מ(@8cN]ešÌ'à/}9“»d(ãŽè ‘ßµ,ê+“cƒ?u-a[®Ï4ÛÊvPRÊÒÞÈØ3Ì‘ëNìmÙ¦¥¡aÑ|QDW2Lî8d<• GŒ²rˆò>àŽiÚ¾;¾÷ä`hsåfr¯Qõ\‚µ’-¼?ù®œB˜< »@ˆ®'Ÿî„aÔ DƒŸª!Gð2›NJ‰ƒåµ¬ñçn?¸EâÉ5c“8Õ»=òUE$)† †df¨X;hëó¡Wf§H¬2`‡}v½ 2íXÀº VLÇ‚Ò6[>VÁ”=¨Jèº ðâA ã¿wA_CŽÒ–þ÷4C³92yƒ„ë ¯/Hô%znºÃ!€[´.é ë^½Šl£¼¬ýåØ_ ,à»B¦BûNk<‘ÿ×6+ùü¿VYßXäÿ?Ê2í*+@œ8ã@ؘ\`ð(hå£e*ƒòùvÒ:n§ûÌÈžžQ7:NÅçg÷Úë©{°u ÞÖ§ÃΧC­¼—]±³Ç.™qîhÐ^û|ÿC§}´÷éä=P—úØq^2ŸÕ*ùã:mþiݼÓ8Nã *Q*”aãÌÑò]ë"*„Ô9q®bßVi3+!ö*!íÉRˆ=U iÏ-…ØÌR(¯9µÐ =MC…'‹¡ÂkûÚŸ¯…´¨ú3µ–9§‹J¡BTr¦K¡B¶*D¥–¯…ØcµP^OVCI1”P–TÚój ùê‚ÃY«±é¢ÝÑÊgHŒªX)–³ ‘È¢ù…Ïí#˜ÝfG'‡§ãÖÅÑéIû¤€Á®¸QÒ¢(uqÚѾ)5ÓÊ¿fçfë•íê&ä\4 ŸÑÃE~¶€,` XÀ°€,` XÀ°€,` XÀž„ÿØ> iPmgetty-1.2.1/contrib/pbmscale.c000066400000000000000000000074711334553713100164340ustar00rootroot00000000000000/* pbmscale.c - scale a portable bitmap ** ** Copyright (C) 1989 by Paul Haeberli . ** Copyright (C) 1993 by Chel van Gennip ** ** Permission to use, copy, modify, and distribute this software and its ** documentation for any purpose and without fee is hereby granted, provided ** that the above copyright notice appear in all copies and that both that ** copyright notice and this permission notice appear in supporting ** documentation. This software is provided "as is" without express or ** implied warranty. ** ** Update jun 11,1993, Chel van Gennip, ** added simple scaling to improve speed ** */ #include "pbm.h" void main( argc, argv ) int argc; char *argv[]; { FILE *ifp; int argn, rows, wrows, cols, wcols, row, wrow, col, wcol, i,format; int vval,vscale,hval,hscale; bit *readrow, *writerow, *bP, *wbP,bitval; float aspect,scale; char *usage = "[-scale N] [-aspect N] [-stretch] [pbmfile]"; pbm_init( &argc, argv ); argn = 1; aspect=1.0; scale=1.0; /* Check for flags. */ while ( argn < argc && argv[argn][0] == '-' && argv[argn][1] != '\0' ) { if ( pm_keymatch( argv[argn], "-stretch", 2 ) ) aspect=2.0; else if ( pm_keymatch( argv[argn], "-aspect", 2 ) ) { ++argn; if ( argn == argc || sscanf( argv[argn], "%f", &aspect ) != 1 ) pm_usage( usage ); } else if ( pm_keymatch( argv[argn], "-scale", 2 ) ) { ++argn; if ( argn == argc || sscanf( argv[argn], "%f", &scale ) != 1 ) pm_usage( usage ); } else pm_usage( usage ); argn++; } if ( argn < argc ) { ifp = pm_openr( argv[argn] ); argn++; } else ifp = stdin; if ( argn != argc ) pm_usage( usage ); vscale=aspect*scale*100; hscale=scale*100; pbm_readpbminit( ifp, &cols, &rows, &format ); readrow= pbm_allocrow( cols ); wcols=(cols*hscale)/100; wrows=(rows*vscale)/100; writerow= pbm_allocrow( wcols ); pbm_writepbminit( stdout, wcols, wrows, 0 ); vval=wrow=row=0; while(row=100){ if(wcol++=100){ if(wrow Received: by greenie.muc.de (/\==/\ Smail3.1.24.1 #24.2) id ; Wed, 4 Jan 95 14:05 MET Received: from ben.britain.eu.net ([192.91.199.254]) by colin.muc.de with SMTP id <25577-1>; Wed, 4 Jan 1995 14:05:27 +0100 Received: from durham.ac.uk by ben.britain.eu.net via JANET with NIFTP (PP) id ; Wed, 4 Jan 1995 13:04:32 +0000 Received: from gauss.dur.ac.uk by durham.ac.uk; Wed, 4 Jan 95 13:03:52 GMT From: Tony Scholl Date: Wed, 4 Jan 1995 14:03:50 +0100 Message-Id: Received: from germain.durham.ac.uk (germain.dur) by uk.ac.durham.gauss; Wed, 4 Jan 95 13:03:50 GMT Received: by germain.durham.ac.uk (4.1/SMI-4.1) id AA14688; Wed, 4 Jan 95 13:03:35 GMT To: gert@greenie.muc.de Subject: pbmsplit Status: RO Hi, A promised, here's a late Christmas present (and a pretty crummy one, too --- _my_ Christmas present was a ZyXEL...) but I've found it useful at times. Tony ---------------------------------cut here------------------------------------ /* pbmsplit.c: split a pbm file into pieces of specified size, with overlapping/breaking on blank rows. Usage: pbmsplit [-w rows|-o rows] [-n rows] {-|infile} [outfile] Optional argument -n is number of rows for each output file (default 2400). Optional argument -w is number of rows by which it is permissible to shorten an output file to search for a whitespace-only row to break (default 0). Optional argument -o is number of rows to overlap (default 0). You cannot specify both -o and -w. Argument - means read from stdin (in which case outfile MUST be given) Output is written to outfile.001, etc; outfile defaults to infile. This was put together by Tony Scholl (a.j.scholl@durham.ac.uk). I've tested it a little, and it seems to work. But the code is far from brilliant, so if you can write a better/working one please do..... */ #define MAXROWS 2400 #include #include #include #include #include int row_len; void usage () { fprintf (stderr, "Usage: pbmsplit [-w rows|-o rows] [-n rows] {-|infile} [outfile]\n"); exit (-1); } void fatal (char *s) { fprintf (stderr, s); fprintf (stderr, "\n"); exit (-1); } void copy_rows (FILE *inf, FILE *outf, int r) { int c, n; n = r * row_len; while ((n-- > 0) && ((c = getc(inf)) != EOF)) putc(c, outf); if (n > 0) { fclose (inf); fclose (outf); fatal ("Unexpected EOF"); } } void copy_saved_rows (FILE *outf, char *buf, int r) { int n; n = r * row_len; while (n-- > 0) putc (*(buf++), outf); } void copy_and_save_rows (FILE *inf, FILE *outf, char *buf, int r) { int c, n; n = r * row_len; while ((n-- > 0) && ((c = getc (inf)) != EOF)) { putc (c, outf); *(buf++) = c; } if (n > 0) { fclose (inf); fclose (outf); fatal ("Unexpected EOF"); } } /* function to copy characters and return the OR of them */ int copy_row2 (FILE *inf, FILE *outf) { int c, n; int d = 0; n = row_len; while ((n-- > 0) && ((c = getc (inf)) != EOF)) { putc (c, outf); d |= c; } if (n > 0) { fclose (inf); fclose (outf); fatal ("Unexpected EOF"); } return (d); } int put_white (FILE *outf, int r) { int n; n = r * row_len; while (n-- > 0) putc ('\0', outf); } main (int argc, char *argv[]) { int count = 0; int over_rows = 0; int max_rows = MAXROWS; int min_rows = 0; int frows, fcols; int rows_remaining; char header[64]; FILE *in_f; FILE *out_f; char *in_fname; char *out_fbasename; char out_fname[256]; char *over_buf; /* parse arguments */ if (argc == 1) usage (); while ((**++argv == '-') && (*++*argv != '\0') && (argc-- > 3)) { switch (**(argv++)) { case 'o': over_rows = atoi (*argv); break; case 'w': min_rows = - atoi (*argv); break; case 'n': max_rows = atoi (*argv); break; default: fprintf (stderr, "Invalid option \"-%s\"\n", *(--argv)); usage (); } argc--; } min_rows += max_rows; in_fname = *argv; switch (argc) { case 3: argv++; case 2: out_fbasename = *argv; break; default: usage (); } if ( out_fbasename[0] == '\0' ) usage (); if ((over_rows > 0) && (min_rows != max_rows)) fprintf (stderr, "Warning: you cannot use both -o and -w! I'm ignoring -w.\n"); if (over_rows > max_rows/2) fatal ("You have specified an excessive overlap!"); if (*in_fname != '\0') in_f = fopen (in_fname, "r"); else in_f = stdin; if (in_f == NULL) { fprintf (stderr, "Cannot open %s for reading\n", in_fname); exit (-1); } fgets (header, 62, in_f); if (strcmp (header, "P4\n") != 0) fatal ("Wrong magic number"); fgets (header, 63, in_f); fcols = atoi (strtok (header, " ")); frows = rows_remaining = atoi (strtok (NULL, " ")); row_len = (fcols + 7) / 8; if (over_rows == 0) /* no overlapping */ { while (rows_remaining > 0) { sprintf (out_fname, "%s.%03d", out_fbasename, ++count); if ((out_f = fopen (out_fname, "w")) == (FILE *)NULL) { close (in_f); fatal ("Cannot open output file"); } if (rows_remaining < max_rows) /* put the lot */ { fprintf (out_f, "P4\n%d %d\n", fcols, rows_remaining); copy_rows (in_f, out_f, rows_remaining); rows_remaining = 0; } else /* first put min_rows */ { int j = min_rows; fprintf (out_f, "P4\n%d %d\n", fcols, max_rows); copy_rows (in_f, out_f, min_rows); /* now look for white rows */ while ((j < max_rows) && (j++) && copy_row2 (in_f, out_f)) ; rows_remaining -= j; put_white (out_f, max_rows-j); } /* now close outfile */ fclose (out_f); } } else /* do overlapping */ { if ((over_buf = (char *)malloc (over_rows * row_len + 1)) == NULL) fatal ("Cannot allocate memory"); while (rows_remaining > 0) { sprintf (out_fname, "%s.%03d", out_fbasename, ++count); if ((out_f = fopen (out_fname, "w")) == (FILE *)NULL) { close (in_f); fatal ("Cannot open output file"); } if (count == 1) { if (rows_remaining <= max_rows) /* put the lot */ { fprintf (out_f, "P4\n%d %d\n", fcols, rows_remaining); copy_rows (in_f, out_f, rows_remaining); rows_remaining = 0; } else /* put a page, saving overlap */ { fprintf (out_f, "P4\n%d %d\n", fcols, max_rows); copy_rows (in_f, out_f, max_rows - over_rows); copy_and_save_rows (in_f, out_f, over_buf, over_rows); rows_remaining -= max_rows; } } else /* count > 1 */ { if (rows_remaining <= max_rows - over_rows) /* put the lot */ { fprintf (out_f, "P4\n%d %d\n", fcols, rows_remaining + over_rows); copy_saved_rows (out_f, over_buf, over_rows); copy_rows (in_f, out_f, rows_remaining); rows_remaining = 0; } else { fprintf (out_f, "P4\n%d %d\n", fcols, max_rows); copy_saved_rows (out_f, over_buf, over_rows); copy_rows (in_f, out_f, max_rows - 2 * over_rows); copy_and_save_rows (in_f, out_f, over_buf, over_rows); rows_remaining -= max_rows - over_rows; } } /* now close outfile */ fclose (out_f); } } fclose (in_f); } /******************************* end ****************************************/ mgetty-1.2.1/contrib/pgx.c000066400000000000000000000057721334553713100154460ustar00rootroot00000000000000#if 0 From ursa-major.spdcc.com!uucp Tue Oct 18 22:28:02 1994 Return-Path: Received: by greenie.muc.de (/\==/\ Smail3.1.24.1 #24.2) id ; Tue, 18 Oct 94 22:28 MET Received: from ursa-major.spdcc.com ([140.186.80.3]) by colin.muc.de with SMTP id <25577(1)>; Tue, 18 Oct 1994 22:27:47 +0100 Received: by ursa-major.spdcc.com with sendmail-5.65/4.7 id ; Tue, 18 Oct 94 17:12:35 -0400 Received: by crucible Tue, 18 Oct 94 17:09:47 EDT; id AA26935 Date: Tue, 18 Oct 1994 22:09:00 +0100 From: Winston Edmond Subject: Mgetty contribution, part 11 of 11 To: gert@greenie.muc.de Message-Id: <9410181712.AA26017@spdcc.com> Status: RO part 11: contrib/pgx.c Count pages / extract page Compiles with: gcc -O2 -o pgx pgx.c Installation: I put it in /usr/local/bin/. --------------------------------------------------------------------------- #endif /* Count pages or extract a page from a file */ /* Usage: pgx [-] [] Without the page number, counts pages and prints result on stdout. With the page number, copy that one page from stdin to stdout. 94Oct15 WBE initial version */ #include #define false 0 #define true 1 int main (int argc, char *argv[]) { int lines_per_page = 60; int curpage, curline; /* current page and line numbers */ int c, i; int onpage = false; /* (bool) true when requested page reached */ int wanted_page = 0; /* page to extract (0 if just counting) */ int empty; /* true if no chars on page yet */ /* process command line arguments */ if (argc > 3) { usage: fprintf (stderr, "Usage: %s [-] []\n", argv[0]); exit (1); } i = 1; if (argc > 1 && argv[1][0] == '-') { c = argv[1][1]; if (! isdigit (c)) goto usage; lines_per_page = atoi (argv[i]+1); i += 1; } if (i < argc) { c = argv[i][0]; if (! isdigit (c)) goto usage; wanted_page = atoi (argv[i]); if (wanted_page <= 0) { /* non-numeric or bad argument */ fprintf (stderr, "Page numbers must be > 0.\n"); goto usage; } } /* continues */ /* main continued */ curpage = 0, empty = true; while ( (c = getchar()) != EOF ) { if (empty) { /* there's at least 1 more char in file */ empty = false; not_empty: onpage = (++curpage == wanted_page); curline = 1; } if (c == '\f') { if (onpage) exit (0); c = getchar (); if (c == '\n') c = getchar (); /* ignore LF after FF */ if (c == EOF) break; /* ignore page breaks that end document */ goto not_empty; } if (onpage) putchar (c); if (c == '\n' && ++curline > lines_per_page) { if (onpage) exit (0); empty = true; } } if (onpage) exit (0); if (wanted_page > 0) { fprintf (stderr, "No page %d in input\n", wanted_page); exit (2); } printf ("%d", curpage); /* page count */ exit (0); /* normal exit */ } mgetty-1.2.1/contrib/ptylogin/000077500000000000000000000000001334553713100163365ustar00rootroot00000000000000mgetty-1.2.1/contrib/ptylogin/.files000066400000000000000000000000451334553713100174400ustar00rootroot00000000000000Makefile TESTS ptylogin.1 ptylogin.c mgetty-1.2.1/contrib/ptylogin/Makefile000066400000000000000000000012341334553713100177760ustar00rootroot00000000000000# /* Makefile -- ptylogin makefile # * Marc SCHAEFER # * Creation: 10/01/98 # * Update: 10/01/98 # * V1.0 PV001 # * DESCRIPTION # * This makes ptylogin. # * NOTES # * BUGS # * TODO # * COPYING-POLICY # * (C) Marc SCHAEFER, under the GPL # * BASED-ON # * Original code. # * MODIFICATION-HISTORY # * 10/01/99 schaefer Created this file. # * $Id: Makefile,v 1.1 1999/01/16 17:17:05 gert Exp $ # */ CFLAGS=-Wall LDFLAGS= LIBS=-lbsd CC=gcc SOURCE=ptylogin.c EXECUTABLE=ptylogin all: $(EXECUTABLE) clean: rm -f $(EXECUTABLE) $(EXECUTABLE): $(SOURCE) $(CC) $(SOURCE) $(CFLAGS) $(LDFLAGS) $(LIBS) -o $(EXECUTABLE)mgetty-1.2.1/contrib/ptylogin/TESTS000066400000000000000000000010511334553713100171600ustar00rootroot00000000000000- tested that it hangups when user's program exits: DONE - tested that it closes the pty when user hangups: DONE - tested binary SEND and CPU usage: file ok, CPU usage is quite high. DONE - tested binary RECEIVE and CPU usage: file ok, CPU usage is far lower than before. DONE (so maybe a problem in the selection loop when a lot of data goes TO the modem through ptylogin, ie write). - tested lastlog/utmp: - in exit case: *BUG*: not updated - in hangup case: not tested - tested correct mode/owner on tty: yes. DONE mgetty-1.2.1/contrib/ptylogin/ptylogin.1000066400000000000000000000060421334553713100202670ustar00rootroot00000000000000.TH ptylogin 1 "10 january 1999" .IX ptylogin .SH NAME ptylogin \-\ replacement for mgetty's login.config rlogin hack fixing security and denial of service problems with ownership of tty. .SH SYNOPSIS .B ptylogin login-name .SH DESCRIPTION This manual page documents .BR ptylogin . .B ptylogin is launched from mgetty's login.config configuration file with root priviledges. It opens a pty slave/master pair, and forks /bin/login. It ensures data stream is 8 bit. This means that the user which logs in will not be connected to the tty of the modem, but to a pty. The pty slave will be owned (because of /bin/login) by the logged-on user. The modem tty will be owned by root, and permissions will be rw access for root only. That tty doesn't need, by the way, to be logged-in. When the modem disconnects, the master pty is closed and a SIGHUP is transmitted to the other side. The worse that the user can then do is leave their process on if they disabled the SIGHUP. However they can't access the modem device nor reopen it. For enhanced security we assume the escape sequence of the modem is disabled, and that a modem hangup from the user calling our local modem causes a SIGHUP to the ptylogin process. Please look at the .B Paranoid Secure Port Implementation RCS revision SPEC,v 1.6 1999/01/05 08:41:46 or later for all details of the problem ptylogin fixes (it's quite tricky). .SS OPTIONS .I "\login-name" This must be a 8 char maximum login name to launch login into, must exist, and may not contain \- or spaces. As .B /bin/login is not launched through system() but instead with exec(), common attacks like semicolons or other separators cannot happen. .SH EXAMPLES The login.config could be configured like this: .I "* root dialin /usr/bin/ptylogin @" Note that if you specify users which bypass this default, for example for PPP, FTN or UUCP, you would enter something like .I "uu* \- \- /bin/login.one @" .B WARNING: You must use a login program which doesn't allow more than one retry. Else interactive users can bypass the default ptylogin restricted login. .SH AUTHOR Marc SCHAEFER .SH VERSION Manual version 1.0 PV001 documents ptylogin version 1.0 .SH NOTES .SH BUGS Please look at the source. .SH TODO .SH BASED\-ON \- An idea to simplify rlogin and still fix the problems from Theodore Y. Ts'o \- rlogind and rlogin code from Linux NetKit-0.09 \- virtual_connection from Marc SCHAEFER .SH HISTORY .SH COPYRIGHT This work is (C) Marc SCHAEFER 1999 and has been done in my free time. However, it is placed under the GPL and thus any use is authorized as long as you do not prevent others from using it and accessing the original source code or your extensions. .SH DISCLAIMER The author hereby disclaims any warranty, either expressed or implied, regarding this software and documentation. The fact that this software attempts to fix a security vulnerability doesn't mean that it doesn't have any vulnerability, some which could be more serious than the one it tries to fix. mgetty-1.2.1/contrib/ptylogin/ptylogin.c000066400000000000000000000221661334553713100203560ustar00rootroot00000000000000/* ptylogin.c -- links the current tty to a /bin/login process through * a pty pair * Marc SCHAEFER * Creation: 10/01/98 * Update: 10/01/98 * V1.0 PV001 * DESCRIPTION * This emulates a rlogin -8E -l USER localhost from mgetty's login.conf * without the need for two sockets, two processes, and networking * running. * This allows to prevent direct control of the modem tty by a * malicious user, work-arounding many Denial of Service or even * security problems. Please look at the ``Paranoid Secure Port * Implementation'', RCS revision SPEC,v 1.6 1999/01/05 08:41:46 or * later for all details. * USAGE * See manpage. * RESULT * 0 everything fine * 1 couldn't exec() /bin/login or allocate pty. * 2 missing argument, illegal login name or not running as root. * NOTES * - This should NOT be suid as it is not necessary and it has not * been designed to be run outside of mgetty's login.config. * BUGS * TODO * - Test * - Do we need to ensure running as root for pty security ? * - Do we need to change tty permission and owner or is it done by * mgetty ? * - Alternative pty allocation code not needing root ? (there is * code floating around for Linux). * - Ask people to review the code and the specification. * ASSUMPTIONS * - This is called with root priviledges since this is more secure * in term of tty ownership and pty allocation. * COPYING-POLICY * (C) Marc SCHAEFER, under the GPL * parts Copyright (c) 1983, 1988, 1989 * The Regents of the University of California * BASED-ON * - A problem described by Marc SCHAEFER in the above Paranoid * specification. * - An idea to simplify rlogin and still fix the problems from * "Theodore Y. Ts'o" * - rlogind and rlogin code from Linux NetKit-0.09, BSD license. * - virtual_connection from Marc SCHAEFER , GPL. * MODIFICATION-HISTORY * 10/01/99 schaefer Created this file. * $Id: ptylogin.c,v 1.1 1999/01/16 17:17:08 gert Exp $ */ #include #include #include #include #include #include #include #include #include #include /* Macro and definitions */ #define MAXIMUM_LOGIN_NAME_LENGTH 8 #define PTS_NAME_SIZE 20 #define _PATH_LOGIN "/bin/login" #define BUFFER_LENGTH 4096 #undef MGETTY_HAS_SET_OWNER_AND_MODE /* ptylogin does it */ /* Public function definitions and hacks */ /* BUGS * - Should be in libbsd.h or similar include file. */ pid_t forkpty(int *, char *, struct termios *, struct winsize *); /* Private type definitions */ #ifndef fd_t typedef int fd_t; #endif /* !fd_t */ /* Private function definitions */ /* NAME * connect_login * DESCRIPTION * Connects this process to the /bin/login process through a pty * pair. Do any local tty initialization (including chmod()/chown()). * RESULT * exit code * 0 session terminated normally (hangup or exit) * 1 couldn't spawn child or open ptys. * NOTES * BUGS * TODO */ static int connect_login(char *login_name); /* NAME * reject_login_name * DESCRIPTION * Verify the constraints on the login name, which are that it doesn't * dashes (-) or spaces (only normal spaces), and it 8 characters * long or less. * RESULT * 0 if the constraint DO apply and the login name should be * accepted, else different of zero and the login should be rejected. * NOTES * - We tested this function with 7, 8 and 9 characters. We also tested * one hash at the end and beginning and one space at the end. In all * case the function answered as expected. * BUGS * TODO * - Theoretically those constraints are already mostly handled by * mgetty. Check this. Until then we do it here. */ static int reject_login_name(char *login_name); /* NAME * set_raw * DESCRIPTION * Sets the stdin tty to raw (if mode == 1), else cooked. * RESULT * NONE * NOTES * - Each call to set_raw(0) must have been after a corresponding * and unnested call to set_raw(1) because of internal state. * BUGS * TODO */ static void set_raw(int mode); /* Public constants */ char rcsid[] = "$Id: ptylogin.c,v 1.1 1999/01/16 17:17:08 gert Exp $"; /* Private constants */ /* Private variables */ static struct winsize win = { 0, 0, 0, 0 }; static struct termio saved; /* Internal state for set_raw() */ /* Function implementation */ int main(int argc, char **argv) { if (argc == 2) { if ((getuid() == 0) && (geteuid() == 0)) { if (!reject_login_name(argv[1])) { exit(connect_login(argv[1])); } else { fprintf(stderr, "%s: illegal length or character(s) in login name.\n", argv[0]); exit(2); } /* NOT REACHED */ } else { fprintf(stderr, "%s: not running as root.\n", argv[0]); exit(2); } /* NOT REACHED */ } else { fprintf(stderr, "%s login-name\n%s: bad args.\n", argv[0], argv[0]); exit(2); } /* NOT REACHED */ } static int reject_login_name(char *login_name) { return (strlen(login_name) > MAXIMUM_LOGIN_NAME_LENGTH) || (strchr(login_name, ' ')) || (strchr(login_name, '-')); } static int connect_login(char *login_name) { pid_t pid; fd_t master_fd; char line[PTS_NAME_SIZE]; #ifndef MGETTY_HAS_SET_OWNER_AND_MODE if (fchown(0, 0, 0)) { perror("fchown()"); return 1; } else if (fchmod(0, 0600)) { perror("fchmod()"); return 1; } #endif /* !MGETTY_HAS_SET_OWNER_AND_MODE */ switch (pid = forkpty(&master_fd, line, NULL, &win)) { case 0: /* Child. Setup slave and exec /bin/login */ /* ASSUMPTIONS * - No other open file except slave pty, which is on 0/1/2. * - Controlling tty set. */ /* NOTES * - Keeping whole environment. */ execl(_PATH_LOGIN, "login", login_name, NULL); return 1; /* if arriving here, something wrong */ break; default: /* Parent */ if (pid < 0) { if (errno == ENOENT) { perror("Out of ptys"); } else { perror("forkpty()"); } return 1; } else { int ok = 1; int nfound; fd_set readfds; fd_set writefds; char from[BUFFER_LENGTH]; char to[BUFFER_LENGTH]; int infrom = 0; int into = 0; int temp; /* Transfer bytes transparently until SIGHUP or EOF */ set_raw(1); while (ok) { FD_ZERO(&readfds); FD_ZERO(&writefds); FD_SET(0, &readfds); FD_SET(master_fd, &readfds); if (infrom) { FD_SET(1, &writefds); } if (into) { FD_SET(master_fd, &writefds); } /* from: buffer used to store data from remote site to be output * to stdout (1). (read from master_fds) * to: buffer used to store data from `modem' to be output to * socket. (read from 0). */ nfound = select(master_fd + 1, &readfds, &writefds, NULL, NULL); if (nfound) { if (FD_ISSET(0, &readfds)) { if (into < BUFFER_LENGTH) { temp = read(0, to + into, BUFFER_LENGTH - into); if (temp == -1 || temp == 0 ) { ok = 0; } else { into += temp; } } /* else we will do it later. */ } if (FD_ISSET(master_fd, &readfds)) { if (infrom < BUFFER_LENGTH) { temp = read(master_fd, from + infrom, BUFFER_LENGTH - infrom); if (temp == -1 || temp == 0) { ok = 0; } else { infrom += temp; } } /* else we will do it later. */ } if (FD_ISSET(1, &writefds)) { if (infrom > 0) { temp = write(1, from, infrom); if (temp == -1 ) { ok = 0; } else { infrom -= temp; } } } if (FD_ISSET(master_fd, &writefds)) { if (into > 0) { temp = write(master_fd, to, into); if (temp == -1 ) { ok = 0; } else { into -= temp; } } } } } set_raw(0); return 0; } break; } printf("connect"); return 0; } void set_raw(int mode) { struct termio tty; /* ASSUMPTION * - Doing it for 0 also does it for 1 (device-wide). */ if (!mode) { ioctl(0, TCSETAW, &saved); } else { ioctl(0, TCGETA, &tty); ioctl(0, TCGETA, &saved); tty.c_iflag = (IGNBRK); /* No echo, crlf mapping, INTR, QUIT, delays, no erase/kill */ tty.c_lflag &= ~(ECHO | ICANON | ISIG); tty.c_oflag = 0; /* Transparent output */ tty.c_cflag &= ~PARENB; /* Same baud rate, disable parity */ tty.c_cflag |= CS8; /* Set character size = 8 */ /* NOTES * - We assume mgetty set crtscts. */ tty.c_cc[VMIN] = 1; /* This many chars satisfies reads */ tty.c_cc[VTIME] = 1; /* or in this many tenths of seconds */ ioctl(0, TCSETAW, &tty); } } mgetty-1.2.1/contrib/readme.supra000066400000000000000000000077641334553713100170200ustar00rootroot00000000000000From sashimi.wwa.com!pshrink!veck Sat Jul 9 21:16:51 1994 Return-Path: Received: by greenie.muc.de (/\==/\ Smail3.1.24.1 #24.2) id ; Sat, 9 Jul 94 21:16 MEST Received: from newton.Space.NET ([194.45.12.1]) by colin.muc.de with SMTP id <135943(2)>; Sat, 9 Jul 1994 21:19:20 +0200 Received: from sashimi.wwa.com ([198.49.174.1]) by newton.Space.NET with SMTP id <375029-3>; Sat, 9 Jul 1994 21:14:39 +0200 Received: from pshrink by sashimi.wwa.com with uucp (Smail3.1.28.1 #8) id m0qMhtQ-000bmFC; Sat, 9 Jul 94 14:16 CDT Date: Sat, 9 Jul 1994 11:55:12 +0200 From: "Steven King [Really!]" Subject: Re: MGETTY: Can't do RTS/CTS? To: Gert Doering In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Status: RO On Fri, 1 Jul 1994, Gert Doering wrote: > Should do. I'm using it with a ZyXEL and H/W flow control, and it works. I found my problem with mgetty not playing nicely with my Supra. Turned out to be a Supra problem. (Oooh, big surprise there!) Here's the synopsis I posted to comp.os.linux.help. Since there *is* a work-around possible in mgetty, I figured you might want to consider it for future releases. Thanks for your help! (And your excellent program!) Newsgroups: comp.os.linux.help From: veck@pshrink.chi.il.us (Steven King [Really!]) Subject: Re: MGETTY: Can't do RTS/CTS? Message-ID: <1994Jul9.154954.547@pshrink.chi.il.us> Date: Sat, 9 Jul 1994 15:49:54 GMT veck@pshrink.chi.il.us publicly declared: >Well, one problem. I just discovered that mgetty doesn't enable RTS/CTS >handshaking properly. This is most noticable when a low-speed modem dials >in to my Supra 14k4 modem. I do an "ls -l" and the whole thing is sent to >the Supra at 38400 bps. Unfortunately, the Supra is only spooling out to >the remote modem at 2400 bps, and the text gets very garbled. I found the problem. You're gonna love it. First, after mgetty initted the modem, I connected with kermit and checked the settings. AT&V showed me that RTS/CTS was turned off, despite the fact that it's turned on in the non-volatile RAM and I set mgetty's init string to just "ATZ" to load the stored settings. So I cranked up mgetty's debugging level to the point where I could see everything it sent to the modem. No obvious problems. It sent the "ATZ" then a bunch of fax commands. Howinthehell did flow control get nuked? I connected with kermit again and started issuing the commands one by one, just as mgetty did. In between I checked the settings to see where I lost flow control. ATQ0V1H0 Hard-coded into mgetty to make sure it can talk to the modem, no problems here ATZ Okay, &K3 is set, we have flow control AT+FCLASS=0 Bingo! A side effect is that this turns off flow control, as shown by AT&V reporting &K0. So, apparently Supra modems (both my 14k4 and my 28k8 models have this behavior) turn flow control *OFF* as a side-effect of "AT+FCLASS=0". Supra probably thinks this is a feature of some sort. Who know what evil lurks in the hearts of firmware programmers? The fix was too easy. Now that I knew where flow control was being disabled, it was simply a matter of hacking a line into mgetty to re-enable it. Thanks to Gert's fine programming this simply meant adding a single line to mgetty.c. After line 65, add 65 "AT+FDCC=1,5,0,2,0,0,0", "OK", >>>> 66 "AT&K3", "OK", as the last fax init string. A simple fix, but hard-coded for Supra modems. If your modem isn't a Supra this may not be the proper command. (But if your modem isn't a Supra you probably don't have this problem, eh?) -- ------------------------------------------ "What if there were no beer?" Yep, that's about the only time I'd order a Zima, all right. mgetty-1.2.1/contrib/sun.readme000066400000000000000000000034001334553713100164520ustar00rootroot00000000000000Gert, i am successfully using mgetty-0.15beta on my SUN 3/60 with SUNOS 4.1.0 Please note that i have the sun SYSV libraries installed on my system so the only change required was with respect to the way the SUN zs(4) serial driver handles hardware flow control. I have not tested fax reception yet with this version, but code looks unchanged from version 0.14 There is a problem with this version on my SUN which results in the phone line not being answered. This problem originates after the modem times out awaiting a non existant RING where the mgetty program hangs after the init chat script but before checking for new RINGS. I will look into this later, but i have enclosed a portion of the log file 11/20 12:50:53 got: 16800/ARQ/V42b[0d][0a] ** found ** 11/20 12:50:55 mgetty-0.15 device=cua1, pid=118, calling 'login uulatour'... -- 11/20 12:52:09 check for lockfiles 11/20 12:52:09 locking the line 11/20 12:52:11 lowering DTR to reset Modem 11/20 12:52:12 send: \d\d\d+++\d\d\d[0d]\dATQ0H0\r\n 11/20 12:52:15 waiting for ``OK'' ** found ** [ chat stuff deleted] 11/20 12:52:16 send: AT+FDCC=1,5,0,2,0,0,0\r\n 11/20 12:52:16 waiting for ``OK'' ** found ** 11/20 12:52:18 waiting... 11/20 12:57:05 waiting for ``RING'' 11/20 12:58:25 timeout in chat skript, waiting for `RING': Interrupted system call 11/20 12:58:26 chat failed (timeout or A_FAIL), exiting... 11/20 12:58:26 removing lock file -- 11/20 12:58:26 check for lockfiles 11/20 12:58:26 locking the line 11/20 12:58:26 lowering DTR to reset Modem 11/20 12:58:27 send: \d\d\d+++\d\d\d[0d]\dATQ0H0\r\n 11/20 12:58:30 waiting for ``OK'' ** found ** [ chat stuff deleted] 11/20 12:58:31 send: AT+FDCC=1,5,0,2,0,0,0\r\n 11/20 12:58:31 waiting for ``OK'' ** found ** [this is end of log file] mgetty-1.2.1/contrib/tsfax-0.1.tgz000066400000000000000000000231751334553713100166500ustar00rootroot00000000000000‹:a'/ì[ÝsÛHrwUžÂ*æ9÷6çÍÕJÙH€_¢¯îIÛk¥­µ]?€ÀÄ $h”ÈEô¿ç×=ƒÒòÚ•ûHUêd’ÀÌô×t÷ôtàLíÎRµÎæÞN>ûÛü‰¶ÕëXâ™Âqº|Â6Wþ³„èôl»ÛµÚÝ.ÆlÇj=g‡¿mšy‰Ï–«ß†‹³¥Jžý¿ûËêö§Æ*ÔÙ2ŽïÎUôWâa[V·Ýþ²ý{Žmìß±,÷vÛéXÏ„õûÿÍÿþøGqlõFã$н@<—Û4‘Qì{‘T™/W •eûÈ[ g)<çù)R•}:$ÖÐöýþ$òV³À'§'š‡kuv§öôÊÛˆçÿô¯ÏÅ÷u²_ÿÝøÙ&Q÷¡zø Ú¿|Ž®³ÓÓƒ9÷áÑ:óãÕÊ[4•“p.NÔ'ñ®ƒøá,ݧ™Z‰ïw§âùðâl¡â•Ê’½øÁ¶ðy.ž£ÛÒÄ¿‹ÿ¾—‰³ô9ø²aöñ<Ú$â,x^‡*%Å7ÝÄqt`›Y¸–ÅÀóÓ¿dý‹el¼…:ߤ5ûíõß²Ûjý;NÖ¿Õéücýÿ=þþðûëéÙ ˆgê¬un5øƒ›(/‹“â»y*®§îÍëë·4ö6Ì"õB\†~§ñ<ïâ$gb2x?»ÿy>ºr lo×A¸^ ãÝ a_§óöąݧÑQìoWjý¨T ‚•ÆÛÄWé qâeðÄÓ:Ìt»ÙDá— ®á¨‡=Cµ×ð ±Ib«ˆ¦ÒêŒB?-a7²j;}KtƒxQ›9 r,®€Æ‹®óžÓl¬¶Ñã,*ÈÕÎ_j@FAαÓ4³oFPD\¤øx÷ú> ‹D¥P6w\ÊU|¯²˜îßÈÑKß'« ßr(‰Ð,GA#ñÑáo“ ÍðIâ;&º–kõ°ñ²%¬$´±ò²$ÜQÛ_Ià%гîk6¨s#ý(NU4¸q¥—økº{“w;V*»çéþBI˜_â!"™>á]«ˆ¹†™‚ظ°$QôF8?\¬Is/JU³AºNý¼èÎ7ñF˜ïcn ˜Cí„c®ˆÊÅm»ìj6PK<§Ó!±ø.oÿ˜·ò¢ N!’8еóH²˜ùq'á\Aœâ2#…OÜ|v#f/Ål(RŸô0ws‰† $zé÷¿4ðÊÍ—7bùR, Ð¥›ƒÄ’— ¼,€¯Ý|s#6/Ŧހî†A7 º)@ÓKx ¶#ééZ­ßa잸¾]í&¢´Ú›·ã"è8€ŸÇÚšîHÝca!YC¶^AyÛ¨tž€}}'+l7+Dèµa^ˆôS’iê××5êÓiŽÒÌô'Á+„VP¾H+ÅË ³h0žÔÆÇÎyq5é2~ MLË‹†¿sómª’ ZÞßùñ&Ä”T ?f2žmçð$¬„/탓ñ"Úo–'/…8ÕíÜæyå4/»+4’Ÿ¤ÂÀêik¨fc³Í°Á«äÞ‹Ðgœ“ hÿ~-ôÍ‘ÓË\†7,—ô÷׸@-þîz¡;.ù²£ ›+û0 “"P|g‰µÊÚÔ§œ1XÝÜé¦Èf"‰3 Ng6dcüGa~d°ö‡¶P9(_7D>ÝÎ4³}šÃÈ Ù02Ø$…–ápÕñ&U<ÍŒˆb­×¨Ú‡lËþ/p`-’Îaò]ZøWyõ¹ÓaáÚ߸U s0ÔlŒ……r7`Cÿ9/üMc"UµðØ 9ÄÎ|Gf‡Œ2ØM†Ï’­^3Õzü8}ý“òn6ìîw¶ZV¸µ¥ço3¾u¤bëXÍ#È€vKfaðP[®<ìòkºïÈ2kÅ„º2€b}› õd*¬²0¥Ö…¤uCw}é« Œ"¹Ü®^²]EÞ6c2C/⵺£aWúžá4"ê‘JÓÅëÉOÛ8õõ"b©ºfL£çÊr7âëÔg^ʰ-9G™ðE[C³j¼ƒu¥¢(ÜÒcnÞb¡4ÉžiƒÛ}¹QI¶Œ·)¥éÔ3Sœ…¹ÊÅ6ŒX‚HÍY9®¼³6lͽèy“p±Ô-ÈRXBU2W€°ÅºÑ•\^ºäF¦³*›}J=µòVr€Ý´Ps¿&lEÚ•±Vl"?ÔÍ:°dºñ|ÖÚ mrÏÍ.|¹ÆÚXbÐÃÆîg¡ÑÊàâÀ?p‹x³/Y ä\­Â5RîÑ’EjE~0×Î2pQê,B¬Èu¬ñFr‰È©x2ƒ±LÏQŒ%Š 3˜Ô|whÉ@aÐ3ÚrmSðÛ²@CGfqº…iØ'0ÄXü ¯]-™!yÍjË·]¹ñ¹a•{’qZ…0ËúJö%¼¾ ­Eb¬¼ÔßFF ÚJ] ]Bý´õ’L{èpDK/šk:c-¸ÐÓ›Àƒ°ÂHåY®%e(pm9(gæ"«•ƒÃ€à¶ä  n[êÖt;rP¬w·+ìê.¹¡[›²{!ÇþW r|Än(Çž”ëÊ×òH¾®ÇòõòD¾®‹7²ä8[2™‘-,§1räUIsÔ’W%ÍQ[^Òuä#j2]yuÀ¡Oˆ²pñZ]È+w½þF}y[qÈ[æ¢É åíWÞÉ•Tcùv':>N$BÌ"­¡±%½’ϱ½Ä;ðÚ6ã–ôJ5ŒáÔºwçsŽ»ÒÓP=é׌9¾ªâÖ—ªâ6 ðsÄoˆú¨6­±+à {$à {,à W‹3‘aybI•±j'¶\—Ó˜8ØI š“–ŒKš“6$Š%štd\¡ve|À6³ûÐ ^ȘÉÂLúr[qÈmÅe(·G<\¹= ;’ûÊøZ¦Æš“‰Ü—9Æ^ûœ£ÚNY˜Êש»ô’œv®y¼Î¨ŸVú¦œ©¦b“»5:mÿ—ÞÆÕ9ªÆˆ”b˜ý‰B³ò‹èÉñÚ©`g2E5Ä9©&4âšCäYN UJÙuÇcΛ‘Q1{ƒ>ªWß* vÕóH”èzŒOiÌBæ•jtún„_{+Å5—Qµ› _B… v£8Ù‹:4ëˆõ!ë*ubޤ‹º 0èâ~åí"µ^À+Ë#„úx^T?ròzDÊ&kTºFÆW–G†Œ— 2´EòZ#׉ü“cõ\™jdÓFÚ颰4)åGÖP]!À‡¿õ@Îîôó'½‚8©‡)Vš “b =ˆsÑc&„¢K*ׯ4ÕuéO‚]ãP’bjúø–oõd hʵé0Çb»}fdq:ö ô˜.†?¥Ædg.ÕÄ"C.´äð‘þlÊÈ¥_¡®³öuì¬‚Ž®õ!EYXɽÍPô+pÕ·hïl>ª•ºš4Û•³gB;£e !†Ñ”PUÝÚ䛥`¼0äˆú!¢±¶ öãÒ>=—`W4&„™]’>ò¢r°ÄÐ…T¨À¤I{<_ª¢s3ŽUPà1³Rç·oò‚~°»}RøIV™`Ë0OæÈ5™ÒtøP+¬À’(CyÄ4?Hª2ÎeÓLp™/æÓ+ði6 £éáç Fâø4_d´><úà @²5ƒ”ËR2ùƒœ¿m‘’õ=D*ï1€O÷ü»£~Û:çz9yêQ‹Ž]©G¥>Á‘Q0pƒäΰ´x;Ø›–¹P×í c€…!nêÙ›âš'äÌ™ “тܡ²h1”-P¬ØŸ§;.§{öÊ#B…f>.+{:‰òãµï‡+ïN/n(Ÿ¯G-Q2ÇTt6u@çÏ3˜:hP¨ÅÍëõ<¦ %oQ7óYéuœ†º(©b?í…n¼M°—Ц°ðÛ¨¹eŽ],½nY¾Ru’W¾Þk‰óÖ(-Ó=»Œd—6À@#GŠ“oœßÛeèß¡°Hÿ÷,IÍAH’þ¾˜ ­P¹£7ª…ÞçHlŠÔ4èíÌ`³}6ê^çrNŽ”çóL|ø¨Áèb¾š}+ÍâÍ@Åü#„ÒUq“BcXî{Q¬Éo<­+»v®_ôqÞ@¸h¼Ýo6P>ÑCóR{ÕÏ6{á_>–£ÃaŒ1±»ø|Ô9A¹?N3$ä^”4:Dp’Sœ@×% •ùž¿Tº¹¸¦;F›Ï•ðý˜cáÊ[  Oï0QÚ冒&ŒˆVqfI¬óbÓ'=ÞûÞl’ݵeŽhßÇp³¡Çµz¿eˆ@Ƨ øœ³é‚85Bäæ s3GY‘Ëk/›ð>¯­Äº-ö~¤¿<à`Å{KtÛâ½ ã¼®ø`åǪ—‚r$Þ¡À¨Îð^%Yô¦} ­d°ë”ǯHÎÍ1ðÐl|ÐPï­‚ð{}¦{?BoQReŠCÛìô‚Ør4<1|ü" îJXQéYIºÙÐó=¢Í±òÛÉSªµ8â1¸ÍµÙýûÙŸ0½#)q/)Ù3׫òÄålÃâƒ[ùs ܼ×7(\-sCB0ÒRÛùOXE«w®Ÿº˜£R2©un¶ï¯M¾…ø@&¡¢³8t!‹‡:Ø\ÒPW‹ºf¦‹ÚQ vJ4Q@ò N\>ÌWÂéðÄuÒ‡ÜaâŠ"dÑ”(dñÕ$B&MYA­.?|Ò˜Pe¯Û½fËiW¤åÛÕ¦|ê!xYê*Ÿs̱OÀ6„°üŒ#Û%çG@ÐáµKÆ¥(\–óò]®·¹ª¼ m¬NÀ£XˆŽõô¸¾ ÑfãxxŠ˜Î}ØÆøôÇWÒ•¾ëÒö³ºÙ`<ÊVýyôN¼|w8®‘=a¼ÙhUøâ‹`Ú  *`ÇšŸ&å+á¯8nSÀO((›±::[¢ÕµPµùÂ߈•HWúáàe.SNúRNúðKJmåÆÛŸëçe‡‡ FzÑÒ·¶! JZ4ô`|pã>’¹,hîS";â%¹Kчjæ¸oö ñ³(5]»ªkoÕ¡t>²³>K˜1x aÓ9J(ÚgŽÌa*«{8_1ÈÓÍÆEœ¯šäi"äd˜ãGðòú:ϱ‹@ê¹R|æ`Úƒ·’oʽ®‚yîľzöfª#S›ìxÕeGB=q¦IqœÆPph^ð9Ì/‘ºëÄÊQC{+"èžo‚©e¸æÜèØàó¡ DWð)Ý8I^!¬G*ÉU’Äúñ4?0/ϖئæ~‘ñWƒåœ–²zt-U´9>;õ~}p–fž·¥¼Å'ñF%´³p·(û)ׂ¼Ô¦t,8É–aªËRºÆÅ "ýZxÌå‘—ìù)ùO—,âÉ>ÞŠ%ílÛ˜å¥ÙõhÂÅ¿OÅJ­bvÒr¤Äþ ÛŸxðRè`CO•ß§ù\QM XÄsaf`H„±f®‘oÊx›QÚÉ]"öQN(¤ü9§s¤p.Ž´Iïg°M¸?ÿ7ËCt ¥{eqWˆò½zA¨çèe¤$ž­èŸwù°„¾WfÒðõ¼ ~¨·œ“+L›_«®yWðOâ”XÊâÝA:…㌕#uA@·|öxB›BáÔ¿§—+XæGµS>¤Û³”+R¤¨8yž†"95ÉJ^ä±'â LþD¼0‚‹ôÊPǦ9ðæRSôæ;SÁ”ó0›õ“H|ªiαÈ較0ÛOi`ÊkãO< óJÉ?W˜­ßB(°Ä¦_¶®Ýª—XŒxÆgMéG/»×å{qüâÌ(öË,ÒŒ_#|Å‹ò͸©Ê¨ 8zÏ­Ù¨¢ø"*nÓšÊ9ú%žeáJÅ´”ˆûgPµ `ÖðÉo½(xÊå V|$Ž Ï÷Qðé¹G4ë¼8 ÍF~ PCE”Íßá„D/·| È›8„<RÂdØt#¾.¡×n6þï¥ü¹‘ëÇýçÏûøŠó Gœwq‹r漫ƒ¯-Î-4-Í1‹QOäÃgõ„Ï,&Tö€Í¼©0ÔàEÒZ¼îB½†J­*wjº"«áGæuYôR6@Ø1•—˜‘GA/cÒãFŠüèÁœéc5•ˆjè#$Ý‘cúýD”Vq´å½‡%vØ„tÛ²,þBzÍ‚2+H¿{ú‚˜§^QN鄨B!)Z¶èõºÂ¶»}æ0½DÕâè:ÂÒ_ý¯ßÕöp6„\Í¢ðÓV >…¶Û¢x"&ô¡Ñæn³á8`eµÄEÛ'oémowö£ç/“Ð_f§Ü?–|;üÑÿÚ½WÃÉ9æ„ëÂé‹.ÉÛB=êØ}႞Ýj·¹Aÿ{çdn¢ó³×ëŹxå!–â2Œ~=åAâN/¾þ6¥r8 S¬R= …rœSîù&ôV ÚÆÄNFg-ÛéuĵL2uÊßD^HÇÒ!ž¿8¥Û¯¢uÐChm0?ù¡Ý¸o9+‹ÎîŸòÀ71ïX}úPâdâíˆ;Ý{B|‚}_8‡ìù[-úhóÃ;ÿBówTº}ˆ=ÅzERZ`È'#•Òßy%Z÷N³ÿ r™Z¸þSÆü&ít±|z`Eÿ9âW”ôÓP‰Þу†0Ã7¡”ô'•P˜Ø’޼õúý)ci¡íÐÇ,ëÛ´à´@Çf-ûÚ»¶î¶$½¯ê_Q¡­#2& ‚"%S3™X–d[‰äèØš¬wÌä H6EŒH€]¬ÑoÝ—ý ó´[_5)9‰v7A'¶t£»ºªºn]Ýft­Î&?ð4œ æ½—<âyÁ6ýŒÏ þYʤ_×éåáßX40¯ñ,F¾çÚÜbZ>gšIO¸ÈUÎþ`­¯§ñ)Ñõ PC$ñ†ó|‹€+zÅÖ¼là>ÜçN±~Ñ[é®mº+T´ù-W6?¿‚ûÙ0#lÝj¿‘P¨Y‚ÞN“¹µ b±p¨î[G®7Þ¦ÑäE¤‘hn{—ö€—8j—al†¤fǹIÍN{’n½!iiDÖB$-­¸ÕÕÒŠ ­Í–³­·jz²»Àj[g¿!qÇC€§ø1æ8‚˜eûßÑ»÷™z; ãОw´8,ù²Aƒg·ÞÍk19F’õelÖ4ÌÉŽ…±kÓcÎA–î¸÷ˆÉ/…U´þŒBõo¿ÏrçügöðåŽ>pþËi:leç›-œÿm9­­òü×#žÿœ£ºâWx$— »¤^‚x ±>稭²ï6gÙQõŽv:6ZJȈÿŸŽÝ>Â?ˆ-IôçõÛ¿Òq«¬O‡^_û,xšì‹TÙ±¸JÍV G8¿NVÞ8t’ýtèžèE0ë” ¹™²ÃªùÁÉaLÔkÆ´h8ß@¶Ò”/œ€$Rê?‚„“(&Œ€1ÓQ†^È/YYKl _Û8:d¹Æ ï ’,àbÏ•…{ì²ÁÃB¨F}×gñKæ£å‹GÒij†ÜRjuçøxÿíu+èÒéVh ¿4×ȶy0­ ‡Á'¸éÁ¸g—öuÂ+®¾M') \B˜HÂfUãQ©žFæ|Õ€zWµ•ˆ%ñ¦z cÝ¥¾È*j'› ‹ žx^¡vno¬ñA†w€¡¯6-‘CüC—êîI\Þ´’ã¼w‡Îúª*À.¡7¾âûnÂl4›> ‚›sA$0ò"éqñIél–‚ÑÀ3ìÅÃÊÛ¤ñSC‰$Ü_¸¦å½§°»•?g¿[ØÿK·R#Fžéÿö¹z›åɉ™9ùɤÇb„Y¾¼„¢®,ZÊ—·ˆ†nåüøÐÞîV˜ê4F¤ 5ïò™gá!òxòà u:•êŠÑw=fq§Ã›kuÚ´éN¦cÝí*§¹ÑÊéÝÀæWéSö?ªÛ]îSeа¯¶œv Uøã¨¥¾×WlgíZ}þs©* ÇæÁM²Pt ψQZú’ÅwÄ2R. ¨ d>OÙ †–²5©a-‚y6)æž*EøY¦ßwC¦ð)äNœ„~$/óO…7•¾§ý¾6=Wy)òL«¡fÒºadqë 7P¥ˆ§ê§¯+ä{cŠk”ÞiÀ’'8õÕJLÁ ÿ5~L»°°TÉjâÕ]‚6s´¢¤—« (ÃåÖ¨qÿ¹” VDÃó<4‰Ÿ3:e°@§»°ß4éW+zg uÁj+­ƒ„…¨0:”–׹ќi›à¢èU“(µææy]ú­ÌÆÇÃL’ªQ¦p!Èꈗ²K‡; âÀPÌÌÄšx~ÚÕPL7T¡Êƒ|ôsª9>ÒŒƒîe ìJžÁ«ƒGûÛt¡±-åeV<+×÷â+’]2Bìr[ôjº±6ßEŽÿyk#SÏß.¤x:¹_AñÌÖK|=Ö§F|Û,ßx±zcepÅM¸§^§,ÍÖ)„_\Ž9úSq@•¯YAˆ¯3ijT‰tAZ°¬‰`Ü-àâÚ‚†é'¶B}ª/§TùøsÃêüÄd®,e…åëcÆGùïîe†­"à"qµÈee䱦‹À­UÌ˘ÑÇ Œ MùF ´ÁPö&Su¼ˆÖYkE…’­°[¯—èÀÛ­*díÑZåŽÀ«¬qÕ½]΋µB‡·{ËeÁÃ}v®AºÞ{Q”è‹°’‘jÂJÚEìp1K‡È[Û¦Õh X† ùw„ísØ\¥Ô¤åõ% zŸ;œFbŽØ<‹w‘W”™ÃâV?6É5lÏaFf·[í¿EÝhªû;.¹±±Íᓾd]‡Æê°à#=ØV·.¤Yh®ßö2w[~jÎ_ÿc͉«%æÄoQ¿vá-\Pé»À~1"ÕxÞYßh¶6šÍçFe¶Á5Ï€ÕÉ7÷ßhY¼þFÁpÈBók«Iç³ß7ªûJû¸nDu÷“k³¥_§îH'±æú—H¯Ot º[ 7ãj<3©3|Q@‘§QÈ–p“HòzB¾N´O] Ç[˜Ý“Ǧƒ(V#çw’œh2ù¯ÿô0eåñ}0eû"èñ÷¸¥¿(ÖK£8ªÉ lÁ¼J*8æ7úWÈ­>%‰ÂÚ,æÖǹÝeíéþYoìÆqž¦¿¢U„|¢!BŽÜœÜqD°ÃÔy"Ñ‚Ÿ&n?ÀÈCаºùanÌLß±ê)læè3£sFA$sgý3ì ¤ð¥^™“Ú “þ™öët¡½±ñdªÆÄ7÷šy‹±šÛþ5u¦=_€µ2›ñ¬øcÛª³ .¾•v=7¨ guÁüàëõQ0Ñë£Éº=aF·ùýÍÍlŸ¦"áóuÖ¾ë^4ðù¯©+5[v|³›Ÿ·×óQ½Æc#9euó0[ ÿû¿2¿Œüßjßsÿo»‘ßÿé8Í×µv)ÿ¥<ùJüh¤ÔzQ}R[¼Ñ–Ö}çúÔiß¿ùËmÏ=÷ܹMµ|//Têxçä‘Ä<òvÑ11,ÑfçÝ&ÕÉþ‡—o¿©Ì·©àíñ‡Ã¹·c¯N–ô­õGÇÇï¹>žL×ÿŽû9$7ù©Cˆü%}E)ãuZ=5͹ZåÁ’ì¥R‚«pBÖ0÷{Íÿ02óKÙ÷®ÿ–ÓÈïÿuœ äl67Ëõÿbý#òËW?{·‡¼ÒÂhœ —^p,+R\^VecÓzš½ÌÇ–éJçÕÏ‹ý+sÙv¿¢þ°.kaý¿ÛßÙ;Úÿâc<àÿ5[­|ýo5œ-I ÛÜ(×ÿc”,;Ñ4C~Ù7š\3yO"&â|‡—†¬/‚pÑŸ¬’f}˜M]ÖöÖÎáñ› õXã¾ÍªøÖT2¾j6Íòª$#Çd5íFG¿‡Iߤã;ÛÁeÏL¥ñÙ(4üµXîðR# ²˜…&mK¢j‘‰%#-ĉó"8šf$¤á Yhf˜8TÙ-éìuÐÔ€ËüÙ% ’ø[“ „Ö 8ŠÆ$›šÏc¦ ‹~|¥¤f~£6¢ ÖY,9Ô&OÊ+Æ+«5`H½÷&¸Wi3TÁ}9*Èq ƒ€}27Í„›õ)WgñQ/TiP’½7sš§ÇŽ‹ÜÃl¬3œqAW&¤¼²W„féV´ç÷Ç {ò¿àŸŠÈ3aðoEd)2¶öX7^ãQcL<‹B™8kdòQðŒ=“ ${îì*âh¨­erûq" F‘–‹^$L"Hðã±'LP¯—DWù!TicŽŠCàŒyy–’•¥)e5y–4Ʊk’ ælÜ‘vá\çÉLñ\êØìs•n±G€›±-´³éß„!/<ÈÐ;À2ÄVÇEˆÃ >ŽJ¥»*¹šæ÷eŒ$ü!J»./:Ú=ܵx Ã7q§ÏÔèôå4ü7WøYb¨#9l{Ž ÚúÈŽÃåXèX2*ƒa|ÁœÆ+¨•ä#^*WH¸¨¨7ÀêÌ$cNÉSÉôν ‰†ñ¢4QqœÆqL‰é´Ëþ8sÉÁP*°%Ý“©X§ƒµrBP%Ö¸0ÛE½ä”;Åœ)‡À¡K^½ÉTîâ™Xì ¤Î0ñ¿"y¸ÇžùCéÿ#ÜÊÅÔzäøoËieúÓimHü·Õ,õÿc”÷ß½?øáíÊÊ7¸„N€9É2E$tªs¾Uoߟì¢af­¯§•°áwßj¦fj÷¸ð²?U»oŽ~Ø+¾Däãb‰CwKÎñL[©Ãƒ—{ïòo–)Xþ¦)eMç͹:Zý¯Øo¸Û%| •Îh[­<­¦3®‘5¡­v{qÊÅÓªé¬ö_`—ui{¬[è§U3¡…mo©ç‡ϧ¢[ï×$¢QÍQX[x~Ñ?´#¶` 5_ʇ fMFXÖDXƒ»Ÿ6èÏ”wjØcå6)©RÉÛÓŽÕ„(ƒ€ÄO¼š·*+óŸñ©ÙÇ«ödÛ"¬çþù¬âÑÒé'oJV‡þBqT?­¦Ü_³ãÓOµ?¤XÿEú<žÿ×Èý¿ÍFKþý·ÆVÿy”bYÖý² V^…;c¦#9›ÛíÆû´Ô³gÏè' +'£D"IÌ Î¶³±ÝnšóB/^Å PߢgæÇ‹ŠVÍÞáNLÊö²I— Ù{SDÝiWu§iovj׫HAÀÖM/¸üÿt-Û‘rŸíÍõÜë Ïçg¤¦‰å…‡ƒ›Ueq?rÛu05oøÝ3’XÙ> ·Ä¥4òЕŸÝ¡—·ÚŸL‡®öOçÀ·é¥–$¦„}Gö&:<3xîÔ7ü£ˆêFQ‚#úT6ÒŒc۱뢱…õšíÛÁ'Íæ›ïö˜©/XŸ=Ùî‹iyŸô¤{.‡O®íF«=oºA˜½±»ÝNߙ켦iwL ÏêYŠŽn‡lºË.7í™-ÏÛ¯³ðyS /+›ÃüF&ÞiÖÙ|ÖîlÔ¶L]ñHzhðy=‡tÿäPx¦}&‘ßr:uk˱ÍÚu¹¯U§Þ¨]oÜgMœ­ÍÅmÒžßkݬ‰œ$&Œáà—½æøÆV§UËûk¶¸?gÃnºk “¬> V¡Í2¸²ã’wvì¾Ò;9ærRNÛ Received: by greenie.muc.de (/\==/\ Smail3.1.24.1 #24.3) id ; Sat, 21 May 94 23:02 MEST Received: from mail.Germany.EU.net ([192.76.144.65]) by colin.muc.de with SMTP id <135940(1)>; Sat, 21 May 1994 17:57:30 +0200 Received: by mail.Germany.EU.net with SMTP (8.6.5:29/EUnetD-2.4.3.c) via EUnet id RAA20948; Sat, 21 May 1994 17:57:28 +0200 Received: by ruhr.de (/\88/\ Smail3.1.22.1 #22.6) id ; Sat, 21 May 94 17:55 GMT Received: by hphbbs.E.open.DE (Smail3.1.28.1 #6) id m0q4szj-0004s4C; Sat, 21 May 94 17:29 MET DST Message-Id: From: hph@hphbbs.E.open.DE (H.P.Heidinger) Subject: ttyenable/-disable V1.5 To: oklein@smallo.BO.open.de (Olaf Klein), gert@greenie.muc.de (Gert Doering) Date: Sat, 21 May 1994 17:29:46 +0200 Reply-To: hph@hphbbs.E.open.DE Organization: HPHBBS - UseNet City-Router, Essen (Germany) Phone: +49-201-287433 (data+voice) Voice = 3 times 1 ring, wait on 4th call X-Mailer: ELM [version 2.4 PL23] Content-Type: text Content-Length: 10697 Status: RO Hi, Anbei kommt ttyenable/-disable V1.5. Gegenueber V1.2 sind folgende Maengel behoben: - ein Bug, nachdem zB ttyS2 und ttyS20..29 gleich handelt wurden (in Funktion 'isTTY'): alt: gotcha=`find /dev -type c -follow|grep /dev/$token` &&\ neu: gotcha=`find /dev -type c -follow|grep -w /dev/$token` &&\ Hinweis: das "ange'pipe'te" grep ist absolut notwendig, weil "find" leider IMMER einen Exit-Code von 0 (true) ausspuckt, wenn er nicht SELBST aus irgendwelchen Gruenden kaputt geht. Wenn "ls" nicht so eloquent waere, wenn das gesuchte Device NICHT existiert ("No such blafasel ..."), wuerde sich das zeitaufwendige "find|grep" auch ersetzen lassen. Vorschlaege?? - ein Crosscheck gegen die temporaere 'inittab', um mehrfache gettys auf dem selben Device aber unter verschiedenen Labels auszuschliessen (siehe Programmtext, Funktion: 'crosscheck' --------------------------- 8< schnipp ... schnapp 8< -------------------------- #!/bin/sh #set -x ############################################################################### # /etc/ttyenable (link to /etc/ttydisable as well) -- for LINUX # (C)May-1994, H.P. Heidinger, Essen, Germany -- All rights released! # ----------------------------------------------------------------------------- # Rights: -rwx------ 1 root root 0 May 13 14:29 /etc/ttyenable # ----------------------------------------------------------------------------- # Enable/Disable tty channels in the inittab-file; i.e. change the # entry for a given device from :off: to :respawn: and vice-versa. # # Usage: a){ttyenable|ttydisable} [-D] [ -v] [ -h] # b){ttyenable|ttydisable} [-D] [ -v] [ -h] { -d | -l