Date: Mon, 30 Jun 2008 06:32:48 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 144342 for review Message-ID: <200806300632.m5U6Wm6X098785@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=144342 Change 144342 by jb@freebsd3 on 2008/06/30 06:32:18 IFC Affected files ... .. //depot/projects/dtrace/doc/fr_FR.ISO8859-1/books/handbook/security/chapter.sgml#8 integrate .. //depot/projects/dtrace/doc/zh_TW.Big5/books/handbook/Makefile#8 integrate .. //depot/projects/dtrace/doc/zh_TW.Big5/books/handbook/book.sgml#7 integrate .. //depot/projects/dtrace/doc/zh_TW.Big5/books/handbook/chapters.ent#5 integrate .. //depot/projects/dtrace/doc/zh_TW.Big5/books/handbook/jails/chapter.sgml#1 branch .. //depot/projects/dtrace/ports/MOVED#98 integrate .. //depot/projects/dtrace/src/lib/libc/stdio/Makefile.inc#6 integrate .. //depot/projects/dtrace/src/lib/libc/stdio/printf-pos.c#1 branch .. //depot/projects/dtrace/src/lib/libc/stdio/printflocal.h#1 branch .. //depot/projects/dtrace/src/lib/libc/stdio/vfprintf.c#8 integrate .. //depot/projects/dtrace/src/lib/libc/stdio/vfwprintf.c#8 integrate .. //depot/projects/dtrace/src/lib/libc/sys/socket.2#5 integrate .. //depot/projects/dtrace/src/sys/amd64/include/pmap.h#12 integrate .. //depot/projects/dtrace/src/sys/amd64/include/vmparam.h#7 integrate .. //depot/projects/dtrace/src/sys/dev/sound/pci/atiixp.h#6 integrate .. //depot/projects/dtrace/src/sys/kern/kern_cpuset.c#7 integrate .. //depot/projects/dtrace/src/sys/kern/kern_intr.c#21 integrate .. //depot/projects/dtrace/src/sys/net/if_loop.c#12 integrate .. //depot/projects/dtrace/src/sys/netinet6/ip6_ipsec.c#5 integrate .. //depot/projects/dtrace/src/sys/sys/priv.h#7 integrate .. //depot/projects/dtrace/src/tools/regression/lib/libc/stdio/Makefile#4 integrate .. //depot/projects/dtrace/src/tools/regression/lib/libc/stdio/test-print-positional.c#1 branch .. //depot/projects/dtrace/src/usr.sbin/config/mkmakefile.c#12 integrate .. //depot/projects/dtrace/src/usr.sbin/cron/cron/cron.8#5 integrate .. //depot/projects/dtrace/src/usr.sbin/cron/cron/cron.c#6 integrate .. //depot/projects/dtrace/src/usr.sbin/cron/cron/cron.h#6 integrate .. //depot/projects/dtrace/src/usr.sbin/cron/cron/do_command.c#7 integrate .. //depot/projects/dtrace/src/usr.sbin/pmcstat/pmcstat.8#7 integrate .. //depot/projects/dtrace/www/share/sgml/events.xml#28 integrate .. //depot/projects/dtrace/www/share/sgml/templates.events.xsl#7 integrate Differences ... ==== //depot/projects/dtrace/doc/fr_FR.ISO8859-1/books/handbook/security/chapter.sgml#8 (text+ko) ==== @@ -2,7 +2,7 @@ The FreeBSD Documentation Project The FreeBSD French Documentation Project - $FreeBSD: doc/fr_FR.ISO8859-1/books/handbook/security/chapter.sgml,v 1.16 2008/02/03 10:21:33 blackend Exp $ + $FreeBSD: doc/fr_FR.ISO8859-1/books/handbook/security/chapter.sgml,v 1.17 2008/06/29 20:23:04 blackend Exp $ Original revision: 1.155 --> @@ -1539,50 +1539,254 @@ </sect1> <sect1 id="openssl"> + <sect1info> + <authorgroup> + <author> + <firstname>Tom</firstname> + <surname>Rhodes</surname> + <contrib>Ecrit par </contrib> + </author> + </authorgroup> + </sect1info> <title>OpenSSL</title> <indexterm> <primary>sécurité</primary> <secondary>OpenSSL</secondary> </indexterm> - <indexterm><primary>OpenSSL</primary></indexterm> + + <para>Une des caractéristiques que de nombreux utilisateurs + ignorent souvent est la présence des outils + <application>OpenSSL</application> dans le système &os;. + <application>OpenSSL</application> fournit une couche de + transport des données chiffrée par-dessus la + couche de communication, lui permettant ainsi d'être + liée à de nombreux services et applications + réseau.<para> + + <para>Les applications d'<application>OpenSSL</application> + pourront être l'authentification chiffrée de + clients de messagerie, les transactions via le Web comme les + paiements par carte bancaire et bien plus encore. De nombreux + logiciels portés tels que <filename + role="package">www/apache13-ssl</filename>, et <filename + role="package">mail/sylpheed-claws</filename> offriront un + support pour <application>OpenSSL</application> lors de leur + compilation.</para> + + <note> + <para>Dans la plupart des cas le catalogue des logiciels + portés tentera de compiler le logiciel porté + <filename role="package">security/openssl</filename> à + moins que la variable &man.make.1; + <makevar>WITH_OPENSSL_BASE</makevar> ne soit explicitement + fixée à la valeur <quote>yes</quote>.</para> + </note> + + <para>La version d'<application>OpenSSL</application> fournie avec + &os; supporte les protocoles de sécurité + réseau <emphasis>Secure Sockets Layer v2/v3</emphasis> + (SSLv2/SSLv3), et <emphasis>Transport Layer Security + v1</emphasis> (TLSv1) et peut être utilisée comme + bibliothèque de chiffrement d'usage + général.</para> + + <note> + <para>Bien que <application>OpenSSL</application> supporte + l'algorithme <acronym>IDEA</acronym>, il est + désactivé par défaut en raison des + problèmes de brevets aux USA. Pour l'utiliser, le + texte de la licence devrait être consulté et si + les termes de cette licence sont acceptables, la variable + <makevar>MAKE_IDEA</makevar> doit être activée + dans le fichier <filename>make.conf</filename>.</para> + </note> + + <para>Une des utilisations les plus courantes + d'<application>OpenSSL</application> est de fournir des + certificats utilisables avec des applications logicielles. Ces + certificats assurent que les références de la + société ou d'un individu sont valides et non + frauduleuses. Si le certificat en question n'a pas + été vérifié par une des nombreuses + <quote>autorité de certification</quote> + (<quote>Certificate Authorities</quote>) ou + <acronym>CA</acronym>s, une alerte est + généralement produite. Une autorité de + certification est une société, comme <ulink + url="http://www.verisign.com">VeriSign</ulink>, qui signera les + certificats afin de valider les références + d'individus ou de sociétés. Ce processus a un + coût et n'est pas obligatoire pour utiliser des + certificats, cependant cela pourra mettre plus à l'aise + les utilisateurs les plus paranoïaques.</para> + + <sect2> + <title>Générer des certificats</title> + + <indexterm> + <primary>OpenSSL</primary> + <secondary>génération de certificats</secondary> + </indexterm> + + <para>Pour générer un certificat, la commande + suivante est disponible:</para> + + <screen>&prompt.root; <userinput>openssl req -new -nodes -out req.pem -keyout cert.pem</userinput> +Generating a 1024 bit RSA private key +................++++++ +.......................................++++++ +writing new private key to 'cert.pem' +----- +You are about to be asked to enter information that will be incorporated +into your certificate request. +What you are about to enter is what is called a Distinguished Name or a DN. +There are quite a few fields but you can leave some blank +For some fields there will be a default value, +If you enter '.', the field will be left blank. +----- +Country Name (2 letter code) [AU]:<userinput><replaceable>US</replaceable></userinput> +State or Province Name (full name) [Some-State]:<userinput><replaceable>PA</replaceable></userinput> +Locality Name (eg, city) []:<userinput><replaceable>Pittsburgh</replaceable></userinput> +Organization Name (eg, company) [Internet Widgits Pty Ltd]:<userinput><replaceable>My Company</replaceable></userinput> +Organizational Unit Name (eg, section) []:<userinput><replaceable>Systems Administrator</replaceable></userinput> +Common Name (eg, YOUR name) []:<userinput><replaceable>localhost.example.org</replaceable></userinput> +Email Address []:<userinput><replaceable>trhodes@FreeBSD.org</replaceable></userinput> + +Please enter the following 'extra' attributes +to be sent with your certificate request +A challenge password []:<userinput><replaceable>SOME PASSWORD</replaceable></userinput> +An optional company name []:<userinput><replaceable>Another Name</replaceable></userinput></screen> + + <para>Notez la réponse à la question <quote>Common + Name</quote> qui est un nom de domaine. Cette question + demande l'entrée d'un serveur de noms à des fins + de vérification; entrer autre chose qu'un nom de + domaine produira un certificat inutilisable. D'autres options + sont disponibles comme par exemple: la date d'expiration, des + algorithmes de chiffrement alternatifs, etc. Une liste + complète peut être obtenue en consultant la page + de manuel &man.openssl.1;.</para> + + <para>Deux fichiers doivent maintenant être + présents dans le répertoire dans lequel la + commande a été exécutée. La + demande de certificat, <filename>req.pem</filename>, peut + être envoyée à une autorité de + certification qui validera les références que + vous avez saisies, signera la demande et vous retournera le + certificat. Le deuxième fichier s'appellera + <filename>cert.pem</filename> et sera la clé + privée du certificat et devra être à tout + prix protégée; si ce fichier tombe dans d'autres + mains, il pourra être utilisé pour imiter votre + identité (ou votre serveur).</para> + + <para>Pour les cas où une signature d'une + <acronym>CA</acronym> n'est pas indispensable, un certificat + auto-signé peut être créé. + Générez tout d'abord la clé + <acronym>RSA</acronym>:</para> + + <screen>&prompt.root; <userinput>openssl dsaparam -rand -genkey -out <filename>myRSA.key</filename> 1024</userinput></screen> + + <para>Générez ensuite la clé de la + <acronym>CA</acronym>:</para> - <para>Depuis FreeBSD 4.0, la bibliothèque OpenSSL fait - partie du système de base. <ulink - url="http://www.openssl.org/">OpenSSL</ulink> fournit une - bibliothèque de chiffrement d'usage général, - ainsi que les protocoles de sécurité réseau - <emphasis>Secure Sockets Layer v2/v3</emphasis> (SSLv2/SSLv3) - et <emphasis>Transport Layer Security v1</emphasis> - (TLSv1).</para> + <screen>&prompt.root; <userinput>openssl gendsa -des3 -out <filename>myca.key</filename> <filename>myRSA.key</filename></userinput></screen> - <para>Cependant, un des algorithmes (précisément - IDEA) inclus dans OpenSSL est protégé par des - brevets aux USA et ailleurs, et n'est pas utilisable sans - restriction. IDEA est inclus dans la version &os; d'OpenSSL, - mais n'est pas compilé par défaut. Si vous désirez - l'utiliser, et que vous acceptez les termes de la licence, - activez l'option <makevar>MAKE_IDEA</makevar> dans le fichier - <filename>/etc/make.conf</filename> et recompilez vos sources - en utilisant la commande <command>make world</command>.</para> + <para>Utilisez cette clé pour créer le + certificat:</para> - <para>Aujourd'hui, l'algorithme RSA est libre d'utilisation - aux USA et ailleurs. Il fut protégé par un brevet - dans le passé.</para> + <screen>&prompt.root; <userinput>openssl req -new -x509 -days 365 -key <filename>myca.key</filename> -out <filename>new.crt</filename></userinput></screen> - <indexterm> - <primary>OpenSSL</primary> - <secondary>installation</secondary> - </indexterm> + <para>Deux fichiers devraient être présents + maintenant dans le répertoire: un fichier de signature + de l'autorité de certification, + <filename>myca.key</filename>, et le certificat + lui-même, <filename>new.crt</filename>. Ces fichiers + doivent être placés dans un répertoire, de + préférence sous <filename + class="directory">/etc</filename>, qui est uniquement lisible + que par <username>root</username>. Les permissions 0700 + devraient convenir et peuvent être fixées + à l'aide de l'utilitaire + <command>chmod</command>.</para> + </sect2> <sect2> - <title>Installation du code source</title> + <title>Utilisation des certificats, un exemple</title> + + <para>A quoi peuvent servir ces fichiers? Un bon exemple serait + le chiffrage des connexions au <acronym>MTA</acronym> + <application>sendmail</application>. Cela permettra de faire + disparaître l'utilisation d'une authentification en + clair pour les utilisateurs qui envoient du courrier via le + <acronym>MTA</acronym> local.</para> + + <note> + <para>Ce n'est pas la meilleure utilisation au monde + étant donné que certains clients de messagerie + afficheront une erreur si le certificat n'a pas + été installé localement. Reportez-vous + à la documentation du logiciel pour plus + d'information sur l'installation de certificats.</para> + </note> + + <para>Les lignes suivantes doivent être ajoutées + dans le fichier <filename>.mc</filename> local:</para> + + <programlisting>dnl SSL Options +define(`confCACERT_PATH',`/etc/certs')dnl +define(`confCACERT',`/etc/certs/new.crt')dnl +define(`confSERVER_CERT',`/etc/certs/new.crt')dnl +define(`confSERVER_KEY',`/etc/certs/myca.key')dnl +define(`confTLS_SRV_OPTIONS', `V')dnl</programlisting> + + <para>Où <filename + class="directory">/etc/certs/</filename> est le + répertoire à utiliser pour stocker localement + les certificats et les clés. La dernière + condition nécessaire étant une reconstruction du + fichier <filename>.cf</filename>. Cela se fait facilement en + tapant <command>make</command> <parameter>install</parameter> + à l'intérieur du répertoire <filename + class="directory">/etc/mail</filename>. Suivi d'un + <command>make</command> <parameter>restart</parameter> qui + devrait relancer le <quote>daemon</quote> + <application>sendmail</application>.</para> + + <para>Si tout s'est bien passé il n'y aura pas de message + d'erreur dans le fichier <filename>/var/log/maillog</filename> + et <application>sendmail</application> apparaîtra dans + la liste des processus.</para> + + <para>Comme test simple, connectez vous au serveur de messagerie + à l'aide de l'utilitaire &man.telnet.1;:</para> + + <screen>&prompt.root; <userinput>telnet <replaceable>example.com</replaceable> 25</userinput> +Trying 192.0.34.166... +Connected to <hostid role="fqdn">example.com</hostid>. +Escape character is '^]'. +220 <hostid role="fqdn">example.com</hostid> ESMTP Sendmail 8.12.10/8.12.10; Tue, 31 Aug 2004 03:41:22 -0400 (EDT) +<userinput>ehlo <replaceable>example.com</replaceable></userinput> +250-example.com Hello example.com [192.0.34.166], pleased to meet you +250-ENHANCEDSTATUSCODES +250-PIPELINING +250-8BITMIME +250-SIZE +250-DSN +250-ETRN +250-AUTH LOGIN PLAIN +250-STARTTLS +250-DELIVERBY +250 HELP +<userinput>quit</userinput> +221 2.0.0 <hostid role="fqdn">example.com</hostid> closing connection +Connection closed by foreign host.</screen> - <para>OpenSSL fait partie des catalogues - <application>CVSup</application> <literal>src-crypto</literal> - et <literal>src-secure</literal>. Reportez-vous à la - section <link linkend="mirrors">Se procurer FreeBSD</link> pour - savoir comment se procurer et mettre à jour le code - source de &os;.<para> + <para>Si la ligne <quote>STARTTLS</quote> apparaît dans la + sortie, cela signifie alors que tout fonctionne + correctement.</para> </sect2> </sect1> @@ -2603,10 +2807,101 @@ <indexterm> <primary>Portaudit</primary> </indexterm> - <title>Monitoring Third Party Security Issues ** Traduction en - Cours **</title> + <title>Surveillance des problèmes de sécurité + relatifs aux programmes tierce-partie</title> + + <para>Ces dernières années, le monde de la + sécurité a fait beaucoup de progrès dans la + manière d'évaluer les + vulnérabilités. Le risque d'une intrusion dans le + système augmente avec l'installation et la configuration + d'utilitaires tierce-partie et cela pour quasiment n'importe + quel système d'exploitation disponible + aujourd'hui.</para> + + <para>L'évaluation des vulnérabilités est un + facteur clé de la politique de sécurité, + alors que &os; publie des avis pour le système de base, + faire de même pour les programmes tierce-partie + dépasse les capacités du projet &os;. Il existe + un moyen d'atténuer les vulnérabilités des + logiciels tierce-partie et de prévenir les + administrateurs des problèmes de sécurité + connus. Un outil &os; connu sous le nom de + <application>Portaudit</application> existe dans cet unique + but.</para> + + <para>Le logiciel porté <filename + role="port">ports-mgmt/portaudit</filename> consulte une base de + données, mise à jour et maintenue par + l'équipe de sécurité de &os; et les + développeurs des logiciels portés, à la + recherche de problèmes de sécurité + connus.</para> + + <para>Pour utiliser <application>Portaudit</application>, ce + dernier doit être installé à partir du + catalogue des logiciels portés:</para> + + <screen>&prompt.root; <userinput>cd /usr/ports/ports-mgmt/portaudit && make install clean</userinput></screen> + + <para>Lors du processus d'installation, les fichiers de + configuration de &man.periodic.8; seront mis à jour, + autorisant l'ajout des résultats de + <application>Portaudit</application> dans l'exécution + quotidienne du rapport de sécurité. Assurez-vous + que les rapports de sécurité quotidiens, qui sont + envoyés au compte messagerie de + <username>root</username>, sont bien lus. Pas plus de + configuration ne sera nécessaire.</para> + + <para>Après l'installation, un administrateur peut mettre + à jour la base de données et afficher les + vulnérabilités connues des logiciels + installés en invoquant la commande suivante:</para> + + <screen>&prompt.root; <userinput>portaudit -Fda</userinput></screen> + + <note> + <para>La base de données sera automatiquement mise + à jour lors de l'exécution de &man.periodic.8;, + cela rendant par conséquent facultative la commande + précédente. Elle n'est requise que pour les + exemples qui vont suivre.</para> + </note> + + <para>Pour contrôler à n'importe quel moment les + programmes tierce-partie installés à partir du + catalogue des logiciels portés, un administrateur n'aura + qu'à exécuter la commande suivante:</para> + + <screen>&prompt.root; <userinput>portaudit -a</userinput></screen> + + <para><application>Portaudit</application> produira pour les + logiciels vulnérables quelque chose comme ceci:</para> + + <programlisting>Affected package: cups-base-1.1.22.0_1 +Type of problem: cups-base -- HPGL buffer overflow vulnerability. +Reference: <http://www.FreeBSD.org/ports/portaudit/40a3bca2-6809-11d9-a9e7-0001020eed82.html> + +1 problem(s) in your installed packages found. + +You are advised to update or deinstall the affected package(s) immediately.</programlisting> + + <para>En faisant pointer un navigateur Web sur + l'<acronym>URL</acronym> proposée, un administrateur + pourra obtenir plus d'information au sujet de la + vulnérabilité en question. Cela comprendra les + versions affectées, listées par version du + logiciel porté &os;, ainsi que des liens vers d'autres + sites Web pouvant contenir des avis de + sécurité.</para> - <para></para> + <para>En résumé, + <application>Portaudit</application> est un outil puissant et + extrêmement utile quand il est employé + conjointement avec le logiciel + <application>Portupgrade</application>.</para> </sect1> <sect1 id="security-advisories"> ==== //depot/projects/dtrace/doc/zh_TW.Big5/books/handbook/Makefile#8 (text+ko) ==== @@ -1,5 +1,5 @@ # -# $FreeBSD: doc/zh_TW.Big5/books/handbook/Makefile,v 1.9 2008/05/01 05:09:34 chinsan Exp $ +# $FreeBSD: doc/zh_TW.Big5/books/handbook/Makefile,v 1.10 2008/06/29 16:05:30 chinsan Exp $ # Original revision: 1.108 # # Build the FreeBSD Handbook. @@ -213,7 +213,7 @@ SRCS+= geom/chapter.sgml SRCS+= install/chapter.sgml SRCS+= introduction/chapter.sgml -#SRCS+= jails/chapter.sgml +SRCS+= jails/chapter.sgml SRCS+= kernelconfig/chapter.sgml SRCS+= l10n/chapter.sgml SRCS+= linuxemu/chapter.sgml ==== //depot/projects/dtrace/doc/zh_TW.Big5/books/handbook/book.sgml#7 (text+ko) ==== @@ -1,7 +1,7 @@ <!-- The FreeBSD Documentation Project - $FreeBSD: doc/zh_TW.Big5/books/handbook/book.sgml,v 1.7 2007/12/01 18:47:53 chinsan Exp $ + $FreeBSD: doc/zh_TW.Big5/books/handbook/book.sgml,v 1.8 2008/06/29 16:05:30 chinsan Exp $ Original revision: 1.163 --> @@ -24,6 +24,7 @@ <!ENTITY % chap.users "IGNORE"> <!ENTITY % chap.kernelconfig "IGNORE"> <!ENTITY % chap.security "IGNORE"> +<!ENTITY % chap.jails "IGNORE"> <!ENTITY % chap.printing "IGNORE"> <!ENTITY % chap.disks "IGNORE"> <!ENTITY % chap.geom "IGNORE"> @@ -74,6 +75,7 @@ <year>2005</year> <year>2006</year> <year>2007</year> + <year>2008</year> <holder>FreeBSD ¤å¥ópµe</holder> </copyright> @@ -243,6 +245,7 @@ <![ %chap.boot; [ &chap.boot; ]]> <![ %chap.users; [ &chap.users; ]]> <![ %chap.security; [ &chap.security; ]]> + <![ %chap.jails; [ &chap.jails; ]]> <![ %chap.mac; [ &chap.mac; ]]> <![ %chap.audit; [ &chap.audit; ]]> <![ %chap.disks; [ &chap.disks; ]]> ==== //depot/projects/dtrace/doc/zh_TW.Big5/books/handbook/chapters.ent#5 (text+ko) ==== @@ -6,7 +6,7 @@ Chapters should be listed in the order in which they are referenced. - $FreeBSD: doc/zh_TW.Big5/books/handbook/chapters.ent,v 1.4 2007/10/12 17:41:08 chinsan Exp $ + $FreeBSD: doc/zh_TW.Big5/books/handbook/chapters.ent,v 1.5 2008/06/29 16:05:30 chinsan Exp $ Original revision: 1.33 --> @@ -31,7 +31,7 @@ <!ENTITY chap.boot SYSTEM "boot/chapter.sgml"> <!ENTITY chap.users SYSTEM "users/chapter.sgml"> <!ENTITY chap.security SYSTEM "security/chapter.sgml"> -<!-- <!ENTITY chap.jails SYSTEM "jails/chapter.sgml"> --> +<!ENTITY chap.jails SYSTEM "jails/chapter.sgml"> <!ENTITY chap.mac SYSTEM "mac/chapter.sgml"> <!ENTITY chap.audit SYSTEM "audit/chapter.sgml"> <!ENTITY chap.disks SYSTEM "disks/chapter.sgml"> ==== //depot/projects/dtrace/ports/MOVED#98 (text+ko) ==== @@ -1,7 +1,7 @@ # # MOVED - a list of (recently) moved or removed ports # -# $FreeBSD: ports/MOVED,v 1.1636 2008/06/23 17:34:34 novel Exp $ +# $FreeBSD: ports/MOVED,v 1.1637 2008/06/29 16:48:00 simon Exp $ # # Each entry consists of a single line containing the following four # fields in the order named, separated with the pipe (`|') character: @@ -3517,3 +3517,4 @@ java/bsh|lang/bsh|2008-06-22|Moved to lang/bsh www/mod_security2|www/mod_security21|2008-06-22|Moved to www/mod_security2. security/gnutls-devel||2008-06-23|Removed +security/ca-roots||2008-06-29|No longer supported by FreeBSD Security Officer ==== //depot/projects/dtrace/src/lib/libc/stdio/Makefile.inc#6 (text+ko) ==== @@ -1,5 +1,5 @@ # @(#)Makefile.inc 8.3 (Berkeley) 4/17/94 -# $FreeBSD: src/lib/libc/stdio/Makefile.inc,v 1.38 2008/05/02 15:25:07 jhb Exp $ +# $FreeBSD: src/lib/libc/stdio/Makefile.inc,v 1.39 2008/06/29 21:52:40 das Exp $ # stdio sources .PATH: ${.CURDIR}/stdio @@ -12,7 +12,8 @@ ftell.c funopen.c fvwrite.c fwalk.c fwide.c fwprintf.c fwscanf.c \ fwrite.c getc.c \ getchar.c gets.c getw.c getwc.c getwchar.c makebuf.c mktemp.c \ - perror.c printf.c putc.c putchar.c puts.c putw.c putwc.c putwchar.c \ + perror.c printf.c printf-pos.c putc.c putchar.c \ + puts.c putw.c putwc.c putwchar.c \ refill.c remove.c rewind.c rget.c scanf.c setbuf.c setbuffer.c \ setvbuf.c snprintf.c sprintf.c sscanf.c stdio.c swprintf.c swscanf.c \ tempnam.c tmpfile.c \ ==== //depot/projects/dtrace/src/lib/libc/stdio/vfprintf.c#8 (text+ko) ==== @@ -34,7 +34,7 @@ static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/stdio/vfprintf.c,v 1.78 2008/04/17 22:17:54 jhb Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/stdio/vfprintf.c,v 1.81 2008/06/29 22:54:26 das Exp $"); /* * Actual printf innards. @@ -62,46 +62,7 @@ #include "libc_private.h" #include "local.h" #include "fvwrite.h" - -union arg { - int intarg; - u_int uintarg; - long longarg; - u_long ulongarg; - long long longlongarg; - unsigned long long ulonglongarg; - ptrdiff_t ptrdiffarg; - size_t sizearg; - intmax_t intmaxarg; - uintmax_t uintmaxarg; - void *pvoidarg; - char *pchararg; - signed char *pschararg; - short *pshortarg; - int *pintarg; - long *plongarg; - long long *plonglongarg; - ptrdiff_t *pptrdiffarg; - size_t *psizearg; - intmax_t *pintmaxarg; -#ifndef NO_FLOATING_POINT - double doublearg; - long double longdoublearg; -#endif - wint_t wintarg; - wchar_t *pwchararg; -}; - -/* - * Type ids for argument type table. - */ -enum typeid { - T_UNUSED, TP_SHORT, T_INT, T_U_INT, TP_INT, - T_LONG, T_U_LONG, TP_LONG, T_LLONG, T_U_LLONG, TP_LLONG, - T_PTRDIFFT, TP_PTRDIFFT, T_SIZET, TP_SIZET, - T_INTMAXT, T_UINTMAXT, TP_INTMAXT, TP_VOID, TP_CHAR, TP_SCHAR, - T_DOUBLE, T_LONG_DOUBLE, T_WINT, TP_WCHAR -}; +#include "printflocal.h" static int __sprint(FILE *, struct __suio *); static int __sbprintf(FILE *, const char *, va_list) __printflike(2, 0); @@ -110,8 +71,6 @@ static char *__ultoa(u_long, char *, int, int, const char *, int, char, const char *); static char *__wcsconv(wchar_t *, int); -static void __find_arguments(const char *, va_list, union arg **); -static void __grow_type_table(int, enum typeid **, int *); /* * Flush out all the vectors defined by the given uio, @@ -167,13 +126,6 @@ } /* - * Macros for converting digits to letters and vice versa - */ -#define to_digit(c) ((c) - '0') -#define is_digit(c) ((unsigned)to_digit(c) <= 9) -#define to_char(n) ((n) + '0') - -/* * Convert an unsigned long to ASCII for printf purposes, returning * a pointer to the first character of the string representation. * Octal numbers can be forced to have a leading zero; hex numbers @@ -426,27 +378,7 @@ */ #define BUF 100 -#define STATIC_ARG_TBL_SIZE 8 /* Size of static argument table. */ - /* - * Flags used during conversion. - */ -#define ALT 0x001 /* alternate form */ -#define LADJUST 0x004 /* left adjustment */ -#define LONGDBL 0x008 /* long double */ -#define LONGINT 0x010 /* long integer */ -#define LLONGINT 0x020 /* long long integer */ -#define SHORTINT 0x040 /* short integer */ -#define ZEROPAD 0x080 /* zero (as opposed to blank) pad */ -#define FPT 0x100 /* Floating point number */ -#define GROUPING 0x200 /* use grouping ("'" flag) */ - /* C99 additional size modifiers: */ -#define SIZET 0x400 /* size_t */ -#define PTRDIFFT 0x800 /* ptrdiff_t */ -#define INTMAXT 0x1000 /* intmax_t */ -#define CHARINT 0x2000 /* print char using int format */ - -/* * Non-MT-safe version */ int @@ -623,7 +555,10 @@ int hold = nextarg; \ if (argtable == NULL) { \ argtable = statargtable; \ - __find_arguments (fmt0, orgap, &argtable); \ + if (__find_arguments (fmt0, orgap, &argtable)) { \ + ret = EOF; \ + goto error; \ + } \ } \ nextarg = n2; \ val = GETARG (int); \ @@ -751,8 +686,11 @@ nextarg = n; if (argtable == NULL) { argtable = statargtable; - __find_arguments (fmt0, orgap, - &argtable); + if (__find_arguments (fmt0, orgap, + &argtable)) { + ret = EOF; + goto error; + } } goto rflag; } @@ -1255,364 +1193,6 @@ /* NOTREACHED */ } -/* - * Find all arguments when a positional parameter is encountered. Returns a - * table, indexed by argument number, of pointers to each arguments. The - * initial argument table should be an array of STATIC_ARG_TBL_SIZE entries. - * It will be replaces with a malloc-ed one if it overflows. - */ -static void -__find_arguments (const char *fmt0, va_list ap, union arg **argtable) -{ - char *fmt; /* format string */ - int ch; /* character from fmt */ - int n, n2; /* handy integer (short term usage) */ - char *cp; /* handy char pointer (short term usage) */ - int flags; /* flags as above */ - int width; /* width from format (%8d), or 0 */ - enum typeid *typetable; /* table of types */ - enum typeid stattypetable [STATIC_ARG_TBL_SIZE]; - int tablesize; /* current size of type table */ - int tablemax; /* largest used index in table */ - int nextarg; /* 1-based argument index */ - - /* - * Add an argument type to the table, expanding if necessary. - */ -#define ADDTYPE(type) \ - ((nextarg >= tablesize) ? \ - __grow_type_table(nextarg, &typetable, &tablesize) : (void)0, \ - (nextarg > tablemax) ? tablemax = nextarg : 0, \ - typetable[nextarg++] = type) - -#define ADDSARG() \ - ((flags&INTMAXT) ? ADDTYPE(T_INTMAXT) : \ - ((flags&SIZET) ? ADDTYPE(T_SIZET) : \ - ((flags&PTRDIFFT) ? ADDTYPE(T_PTRDIFFT) : \ - ((flags&LLONGINT) ? ADDTYPE(T_LLONG) : \ - ((flags&LONGINT) ? ADDTYPE(T_LONG) : ADDTYPE(T_INT)))))) - -#define ADDUARG() \ - ((flags&INTMAXT) ? ADDTYPE(T_UINTMAXT) : \ - ((flags&SIZET) ? ADDTYPE(T_SIZET) : \ - ((flags&PTRDIFFT) ? ADDTYPE(T_PTRDIFFT) : \ - ((flags&LLONGINT) ? ADDTYPE(T_U_LLONG) : \ - ((flags&LONGINT) ? ADDTYPE(T_U_LONG) : ADDTYPE(T_U_INT)))))) - - /* - * Add * arguments to the type array. - */ -#define ADDASTER() \ - n2 = 0; \ - cp = fmt; \ - while (is_digit(*cp)) { \ - n2 = 10 * n2 + to_digit(*cp); \ - cp++; \ - } \ - if (*cp == '$') { \ - int hold = nextarg; \ - nextarg = n2; \ - ADDTYPE (T_INT); \ - nextarg = hold; \ - fmt = ++cp; \ - } else { \ - ADDTYPE (T_INT); \ - } - fmt = (char *)fmt0; - typetable = stattypetable; - tablesize = STATIC_ARG_TBL_SIZE; - tablemax = 0; - nextarg = 1; - for (n = 0; n < STATIC_ARG_TBL_SIZE; n++) - typetable[n] = T_UNUSED; - - /* - * Scan the format for conversions (`%' character). - */ - for (;;) { - for (cp = fmt; (ch = *fmt) != '\0' && ch != '%'; fmt++) - /* void */; - if (ch == '\0') - goto done; - fmt++; /* skip over '%' */ - - flags = 0; - width = 0; - -rflag: ch = *fmt++; -reswitch: switch (ch) { - case ' ': - case '#': - goto rflag; - case '*': - ADDASTER (); - goto rflag; - case '-': - case '+': - case '\'': - goto rflag; - case '.': - if ((ch = *fmt++) == '*') { - ADDASTER (); - goto rflag; - } - while (is_digit(ch)) { - ch = *fmt++; - } - goto reswitch; - case '0': - goto rflag; - case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - n = 0; - do { - n = 10 * n + to_digit(ch); - ch = *fmt++; - } while (is_digit(ch)); - if (ch == '$') { - nextarg = n; - goto rflag; - } - width = n; - goto reswitch; -#ifndef NO_FLOATING_POINT - case 'L': - flags |= LONGDBL; - goto rflag; -#endif - case 'h': - if (flags & SHORTINT) { - flags &= ~SHORTINT; - flags |= CHARINT; - } else - flags |= SHORTINT; - goto rflag; - case 'j': - flags |= INTMAXT; - goto rflag; - case 'l': - if (flags & LONGINT) { - flags &= ~LONGINT; - flags |= LLONGINT; - } else - flags |= LONGINT; - goto rflag; - case 'q': - flags |= LLONGINT; /* not necessarily */ - goto rflag; - case 't': - flags |= PTRDIFFT; - goto rflag; - case 'z': - flags |= SIZET; - goto rflag; - case 'C': - flags |= LONGINT; - /*FALLTHROUGH*/ - case 'c': - if (flags & LONGINT) - ADDTYPE(T_WINT); - else - ADDTYPE(T_INT); - break; - case 'D': - flags |= LONGINT; - /*FALLTHROUGH*/ - case 'd': - case 'i': - ADDSARG(); - break; -#ifndef NO_FLOATING_POINT - case 'a': - case 'A': - case 'e': - case 'E': - case 'f': - case 'g': - case 'G': - if (flags & LONGDBL) - ADDTYPE(T_LONG_DOUBLE); - else - ADDTYPE(T_DOUBLE); - break; -#endif /* !NO_FLOATING_POINT */ - case 'n': - if (flags & INTMAXT) - ADDTYPE(TP_INTMAXT); - else if (flags & PTRDIFFT) - ADDTYPE(TP_PTRDIFFT); - else if (flags & SIZET) - ADDTYPE(TP_SIZET); - else if (flags & LLONGINT) - ADDTYPE(TP_LLONG); - else if (flags & LONGINT) - ADDTYPE(TP_LONG); - else if (flags & SHORTINT) - ADDTYPE(TP_SHORT); - else if (flags & CHARINT) - ADDTYPE(TP_SCHAR); - else - ADDTYPE(TP_INT); - continue; /* no output */ - case 'O': - flags |= LONGINT; - /*FALLTHROUGH*/ - case 'o': - ADDUARG(); - break; - case 'p': - ADDTYPE(TP_VOID); - break; - case 'S': - flags |= LONGINT; - /*FALLTHROUGH*/ - case 's': - if (flags & LONGINT) - ADDTYPE(TP_WCHAR); - else - ADDTYPE(TP_CHAR); - break; - case 'U': - flags |= LONGINT; - /*FALLTHROUGH*/ - case 'u': - case 'X': - case 'x': - ADDUARG(); - break; - default: /* "%?" prints ?, unless ? is NUL */ - if (ch == '\0') - goto done; - break; - } - } -done: - /* - * Build the argument table. - */ - if (tablemax >= STATIC_ARG_TBL_SIZE) { - *argtable = (union arg *) - malloc (sizeof (union arg) * (tablemax + 1)); - } - - (*argtable) [0].intarg = 0; - for (n = 1; n <= tablemax; n++) { - switch (typetable [n]) { - case T_UNUSED: /* whoops! */ - (*argtable) [n].intarg = va_arg (ap, int); - break; - case TP_SCHAR: - (*argtable) [n].pschararg = va_arg (ap, signed char *); - break; - case TP_SHORT: - (*argtable) [n].pshortarg = va_arg (ap, short *); - break; - case T_INT: - (*argtable) [n].intarg = va_arg (ap, int); - break; - case T_U_INT: - (*argtable) [n].uintarg = va_arg (ap, unsigned int); - break; - case TP_INT: - (*argtable) [n].pintarg = va_arg (ap, int *); - break; - case T_LONG: - (*argtable) [n].longarg = va_arg (ap, long); - break; - case T_U_LONG: - (*argtable) [n].ulongarg = va_arg (ap, unsigned long); - break; - case TP_LONG: - (*argtable) [n].plongarg = va_arg (ap, long *); - break; - case T_LLONG: - (*argtable) [n].longlongarg = va_arg (ap, long long); - break; - case T_U_LLONG: - (*argtable) [n].ulonglongarg = va_arg (ap, unsigned long long); - break; - case TP_LLONG: - (*argtable) [n].plonglongarg = va_arg (ap, long long *); - break; - case T_PTRDIFFT: - (*argtable) [n].ptrdiffarg = va_arg (ap, ptrdiff_t); - break; - case TP_PTRDIFFT: - (*argtable) [n].pptrdiffarg = va_arg (ap, ptrdiff_t *); - break; - case T_SIZET: - (*argtable) [n].sizearg = va_arg (ap, size_t); - break; - case TP_SIZET: - (*argtable) [n].psizearg = va_arg (ap, size_t *); - break; - case T_INTMAXT: - (*argtable) [n].intmaxarg = va_arg (ap, intmax_t); - break; - case T_UINTMAXT: - (*argtable) [n].uintmaxarg = va_arg (ap, uintmax_t); - break; - case TP_INTMAXT: - (*argtable) [n].pintmaxarg = va_arg (ap, intmax_t *); - break; - case T_DOUBLE: -#ifndef NO_FLOATING_POINT - (*argtable) [n].doublearg = va_arg (ap, double); -#endif >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200806300632.m5U6Wm6X098785>