Imported Debian version 4.7.26

This commit is contained in:
Marco d'Itri 2008-04-05 04:53:26 +02:00
parent d0c35c4219
commit e90424d179
14 changed files with 359 additions and 240 deletions

View File

@ -14,29 +14,31 @@ OPTS := -O2
ifdef HAVE_LIBIDN
whois_LDADD += -lidn
whois_CFLAGS += -DHAVE_LIBIDN
CFLAGS += -DHAVE_LIBIDN
endif
ifdef HAVE_XCRYPT
mkpasswd_LDADD += -lxcrypt
mkpasswd_CFLAGS += -DHAVE_XCRYPT
CFLAGS += -DHAVE_XCRYPT
else
mkpasswd_LDADD += -lcrypt
endif
PERL := perl
all: whois #pos
all: Makefile.depend whois mkpasswd #pos
whois: whois.c whois.h config.h data.h \
as_del.h as32_del.h ip_del.h ip6_del.h tld_serv.h
$(CC) $(CFLAGS) $(whois_CFLAGS) $(OPTS) whois.c -o whois \
$(LDFLAGS) $(whois_LDADD)
##############################################################################
%.o: %.c
$(CC) $(CFLAGS) $(OPTS) -c $<
mkpasswd: mkpasswd.c
$(CC) $(CFLAGS) $(mkpasswd_CFLAGS) $(OPTS) mkpasswd.c -o mkpasswd \
$(LDFLAGS) $(mkpasswd_LDADD)
whois: whois.o utils.o
$(CC) $(LDFLAGS) $(whois_LDADD) -o $@ $^
mkpasswd: mkpasswd.o utils.o
$(CC) $(LDFLAGS) $(mkpasswd_LDADD) -o $@ $^
##############################################################################
as_del.h: as_del_list make_as_del.pl
$(PERL) -w make_as_del.pl < as_del_list > $@
@ -52,6 +54,7 @@ ip6_del.h: ip6_del_list make_ip6_del.pl
tld_serv.h: tld_serv_list make_tld_serv.pl
$(PERL) -w make_tld_serv.pl < tld_serv_list > $@
##############################################################################
install: whois
install -d $(BASEDIR)$(prefix)/bin/
install -d $(BASEDIR)$(prefix)/share/man/man1/
@ -69,7 +72,8 @@ distclean: clean
rm -f po/whois.pot
clean:
rm -f as_del.h ip_del.h ip6_del.h tld_serv.h whois mkpasswd
rm -f Makefile.depend as_del.h ip_del.h ip6_del.h tld_serv.h \
*.o whois mkpasswd
rm -f po/*.mo
test:
@ -81,3 +85,8 @@ gnu:
pos:
cd po && $(MAKE)
depend: Makefile.depend
Makefile.depend:
$(CC) $(CFLAGS) -MM -MG *.c > $@
-include Makefile.depend

View File

@ -1,6 +1,6 @@
/* Program version */
/* not for the inetutils version */
#define VERSION "4.7.25"
#define VERSION "4.7.26"
/* Configurable features */
@ -39,6 +39,9 @@
# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
# define HAVE_GETADDRINFO
# endif
# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 7
# define HAVE_SHA_CRYPT
# endif
#endif
/* Linux, Solaris 5, FreeBSD 5.x. What else? */
@ -61,25 +64,3 @@
# endif
#endif
#ifdef HAVE_GETOPT_LONG
# define GETOPT_LONGISH(c, v, o, l, i) getopt_long(c, v, o, l, i)
#else
# define GETOPT_LONGISH(c, v, o, l, i) getopt(c, v, o)
#endif
/* NLS stuff */
#ifdef ENABLE_NLS
# include <libintl.h>
# include <locale.h>
# define _(a) (gettext (a))
# ifdef gettext_noop
# define N_(a) gettext_noop (a)
# else
# define N_(a) (a)
# endif
#else
# define _(a) (a)
# define N_(a) a
#endif

8
debian/changelog vendored
View File

@ -1,3 +1,11 @@
whois (4.7.26) unstable; urgency=medium
* Added support for passing command line options in the environment
variables WHOIS_OPTIONS and MKPASSWD_OPTIONS. (Closes: #324858)
* Updated the French translation. (Closes: #474307)
-- Marco d'Itri <md@linux.it> Sat, 05 Apr 2008 04:53:26 +0200
whois (4.7.25) unstable; urgency=low
* mkpasswd: added support for the SHA-256 and SHA-512 methods from

2
debian/rules vendored
View File

@ -9,7 +9,7 @@ VERSION := $(shell dpkg-parsechangelog | sed -n 's/\+.*$$//; /^Version/s/.* //p'
build:
dh_testdir
$(MAKE) whois mkpasswd \
$(MAKE) \
OPTS="-O2 -g -DCONFIG_FILE=\\\"/etc/whois.conf\\\"" \
HAVE_LIBIDN=1
cd po && $(MAKE) whois.pot

View File

@ -33,6 +33,10 @@ than the hashed password is printed on stdout.
.TP
.B -s, --stdin
Like \fI--password-fd=0\fP.
.SH "ENVIRONMENT"
.IP "MKPASSWD_OPTIONS"
A list of options which will be evalued before the ones specified on the
command line.
.SH BUGS
If the \fI--stdin\fP option is used, passwords containing some control
characters may not be read correctly.

View File

@ -1,23 +1,26 @@
/*
* Copyright (C) 2001-2002 Marco d'Itri
* Copyright (C) 2001-2008 Marco d'Itri
*
* 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 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.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* for crypt, snprintf and strcasecmp */
#define _XOPEN_SOURCE
#define _BSD_SOURCE
/* System library */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -28,14 +31,19 @@
#include <string.h>
#include <time.h>
#include <sys/types.h>
/*#define HAVE_XCRYPT 0*/
#ifdef HAVE_XCRYPT
#include <xcrypt.h>
#include <sys/stat.h>
#include <fcntl.h>
#endif
/* Application-specific */
#include "utils.h"
/* Global variables */
#ifdef HAVE_GETOPT_LONG
static struct option longopts[] = {
static const struct option longopts[] = {
{"method", optional_argument, NULL, 'm'},
/* for backward compatibility with versions < 4.7.25 (< 20080321): */
{"hash", optional_argument, NULL, 'H'},
@ -49,18 +57,19 @@ static struct option longopts[] = {
};
#endif
static char valid_salts[] = "abcdefghijklmnopqrstuvwxyz"
static const char valid_salts[] = "abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
struct crypt_method {
const char *algo; /* short name used by the command line option */
const char *prefix; /* salt prefix */
unsigned int len; /* salt lenght */
unsigned int rounds;/* supports a variable number of rounds */
const char *desc; /* long description for the methods list */
const char *method; /* short name used by the command line option */
const char *prefix; /* salt prefix */
const unsigned int len; /* salt lenght */
const unsigned int rounds; /* supports a variable number of rounds */
const char *desc; /* long description for the methods list */
};
struct crypt_method methods[] = {
static const struct crypt_method methods[] = {
/* method prefix len rounds description */
{ "des", "", 2, 0,
N_("standard 56 bit DES-based crypt(3)") },
{ "md5", "$1$", 8, 0, "MD5" },
@ -73,7 +82,7 @@ struct crypt_method methods[] = {
#if defined FreeBSD
{ "nt", "$3$", 0, 0, "NT-Hash" },
#endif
#if defined __GLIBC__ && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 7
#if defined HAVE_SHA_CRYPT
/* http://people.redhat.com/drepper/SHA-crypt.txt */
{ "sha-256", "$5$", 16, 1, "SHA-256" },
{ "sha-512", "$6$", 16, 1, "SHA-512" },
@ -89,12 +98,11 @@ struct crypt_method methods[] = {
{ NULL, NULL, 0, 0, NULL }
};
void generate_salt(char *buf, const unsigned int len);
void *gather_entropy(int len);
void generate_salt(char *const buf, const unsigned int len);
void *gather_entropy(const int len);
void display_help(void);
void display_version(void);
void display_methods(void);
void *xmalloc(size_t);
int main(int argc, char *argv[])
{
@ -103,7 +111,7 @@ int main(int argc, char *argv[])
unsigned int salt_len = 0;
unsigned int rounds_support = 0;
const char *salt_prefix = NULL;
char *salt_arg = NULL;
const char *salt_arg = NULL;
unsigned int rounds = 0;
char *salt = NULL;
char rounds_str[30];
@ -115,16 +123,19 @@ int main(int argc, char *argv[])
textdomain(NLS_CAT_NAME);
#endif
/* prepend options from environment */
argv = merge_args(getenv("MKPASSWD_OPTIONS"), argv, &argc);
while ((ch = GETOPT_LONGISH(argc, argv, "hH:m:P:R:sSV", longopts, 0)) > 0) {
switch (ch) {
case 'm':
case 'H':
if (!optarg || strcasecmp("help", optarg) == 0) {
if (!optarg || strcaseeq("help", optarg)) {
display_methods();
exit(0);
}
for (i = 0; methods[i].algo != NULL; i++)
if (strcasecmp(methods[i].algo, optarg) == 0) {
for (i = 0; methods[i].method != NULL; i++)
if (strcaseeq(methods[i].method, optarg)) {
salt_prefix = methods[i].prefix;
salt_len = methods[i].len;
rounds_support = methods[i].rounds;
@ -193,7 +204,7 @@ int main(int argc, char *argv[])
salt_prefix = methods[0].prefix;
}
if (strcmp(salt_prefix, "$2a$") == 0) { /* OpenBSD Blowfish */
if (streq(salt_prefix, "$2a$")) { /* OpenBSD Blowfish */
if (rounds <= 4)
rounds = 4;
/* actually for 2a it is the logarithm of the number of rounds */
@ -220,8 +231,8 @@ int main(int argc, char *argv[])
}
}
salt = xmalloc(strlen(salt_prefix) + strlen(rounds_str)
+ strlen(salt_arg) + 1);
salt = NOFAIL(malloc(strlen(salt_prefix) + strlen(rounds_str)
+ strlen(salt_arg) + 1));
*salt = '\0';
strcat(salt, salt_prefix);
strcat(salt, rounds_str);
@ -229,6 +240,7 @@ int main(int argc, char *argv[])
} else {
#ifdef HAVE_XCRYPT
void *entropy = gather_entropy(64);
salt = crypt_gensalt(salt_prefix, rounds, entropy, 64);
if (!salt) {
fprintf(stderr, "crypt_gensalt failed.\n");
@ -236,8 +248,8 @@ int main(int argc, char *argv[])
}
free(entropy);
#else
salt = xmalloc(strlen(salt_prefix) + strlen(rounds_str)
+ salt_len + 1);
salt = NOFAIL(malloc(strlen(salt_prefix) + strlen(rounds_str)
+ salt_len + 1));
*salt = '\0';
strcat(salt, salt_prefix);
strcat(salt, rounds_str);
@ -245,55 +257,55 @@ int main(int argc, char *argv[])
#endif
}
if (!password) {
if (password_fd != -1) {
FILE *fp;
unsigned char *p;
if (password) {
} else if (password_fd != -1) {
FILE *fp;
unsigned char *p;
if (isatty(password_fd))
fprintf(stderr, _("Password: "));
password = xmalloc(128);
fp = fdopen(password_fd, "r");
if (!fp) {
perror("fdopen");
exit(2);
}
if (!fgets(password, 128, fp)) {
perror("fgets");
exit(2);
}
if (isatty(password_fd))
fprintf(stderr, _("Password: "));
password = NOFAIL(malloc(128));
fp = fdopen(password_fd, "r");
if (!fp) {
perror("fdopen");
exit(2);
}
if (!fgets(password, 128, fp)) {
perror("fgets");
exit(2);
}
p = (unsigned char *)password;
while (*p) {
if (*p == '\n') {
*p = '\0';
break;
}
/* which characters are valid? */
if (*p > 0x7f) {
fprintf(stderr,
_("Illegal password character '0x%hhx'.\n"), *p);
exit(1);
}
p++;
p = (unsigned char *)password;
while (*p) {
if (*p == '\n' || *p == '\r') {
*p = '\0';
break;
}
} else {
password = getpass(_("Password: "));
if (!password) {
perror("getpass");
exit(2);
/* which characters are valid? */
if (*p > 0x7f) {
fprintf(stderr,
_("Illegal password character '0x%hhx'.\n"), *p);
exit(1);
}
p++;
}
} else {
password = getpass(_("Password: "));
if (!password) {
perror("getpass");
exit(2);
}
}
{
char *result;
const char *result;
result = crypt(password, salt);
if (!result || strcmp(result, "*0") == 0) {
/* xcrypt returns "*0" on errors */
if (!result || result[0] == '*') {
fprintf(stderr, "crypt failed.\n");
exit(2);
}
if (strncmp(result, salt_prefix, strlen(salt_prefix)) != 0) {
if (!strneq(result, salt_prefix, strlen(salt_prefix))) {
fprintf(stderr, _("Method not supported by crypt(3).\n"));
exit(2);
}
@ -309,12 +321,12 @@ int main(int argc, char *argv[])
#define RANDOM_DEVICE "/dev/urandom"
#endif
void* gather_entropy(int count)
void* gather_entropy(const int count)
{
char *buf;
int fd;
buf = xmalloc(count);
buf = NOFAIL(malloc(count));
fd = open(RANDOM_DEVICE, O_RDONLY);
if (fd < 0) {
perror("open");
@ -331,7 +343,7 @@ void* gather_entropy(int count)
#else
void generate_salt(char *buf, const unsigned int len)
void generate_salt(char *const buf, const unsigned int len)
{
unsigned int i;
@ -343,18 +355,6 @@ void generate_salt(char *buf, const unsigned int len)
#endif
void *xmalloc(size_t n)
{
void *retval;
if (!(retval = malloc(n))) {
fprintf(stderr, "malloc failed\n");
exit(2);
}
return retval;
}
void display_help(void)
{
fprintf(stderr, _("Usage: mkpasswd [OPTIONS]... [PASSWORD [SALT]]\n"
@ -389,7 +389,7 @@ void display_methods(void)
int i;
printf(_("Available methods:\n"));
for (i = 0; methods[i].algo != NULL; i++)
printf("%s\t%s\n", methods[i].algo, methods[i].desc);
for (i = 0; methods[i].method != NULL; i++)
printf("%s\t%s\n", methods[i].method, methods[i].desc);
}

123
po/fr.po
View File

@ -1,17 +1,17 @@
#
# Traduction de whois.pot
# Copyright © 2003 William Steve Applegate <wsapplegate@est.un.goret.info>
#
# Copyright © 2003 William Steve Applegate <wsapplegate@est.un.goret.info>
# -2008: Mohammed Adnène Trojette <adn+deb@diwi.org>
msgid ""
msgstr ""
"Project-Id-Version: whois 4.6.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-03-23 22:06+0100\n"
"PO-Revision-Date: 2005-02-22 20:06+0100\n"
"Last-Translator: Mohammed Adnène Trojette <adn+deb@diwi.org>\n"
"PO-Revision-Date: 2008-03-25 20:16+0100\n"
"Last-Translator: Simon Paillard <simon.paillard@resel.enst-bretagne.fr>\n"
"Language-Team: French <debian-l10n-french@lists.debian.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-15\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../whois.c:117
@ -23,19 +23,19 @@ msgid ""
msgstr ""
"Version %s.\n"
"\n"
"Veuillez rapporter les bogues à %s.\n"
"Veuillez signaler les bogues à %s.\n"
#: ../whois.c:167 ../whois.c:227 ../whois.c:233 ../whois.c:240 ../whois.c:246
#: ../whois.c:273
#, c-format
msgid "Using server %s.\n"
msgstr "Le serveur %s est sélectionné.\n"
msgstr "Le serveur %s est sélectionné.\n"
#: ../whois.c:209
msgid "This TLD has no whois server, but you can access the whois database at"
msgstr ""
"Ce TLD n'a pas de serveur whois, mais vous pouvez accéder à la base de "
"données à"
"Ce TLD n'a pas de serveur whois, mais vous pouvez accéder à la base de "
"données à"
#: ../whois.c:217
msgid "This TLD has no whois server."
@ -47,7 +47,7 @@ msgstr "Aucun serveur whois n'est connu pour ce type d'objet."
#: ../whois.c:223
msgid "Unknown AS number or IP network. Please upgrade this program."
msgstr "Numéro d'AS ou réseau IP inconnu. Veuillez mettre à jour ce programme."
msgstr "Numéro d'AS ou réseau IP inconnu. Veuillez mettre à jour ce programme."
#. XXX should fail if p = 0.0.0.0
#: ../whois.c:253
@ -58,18 +58,18 @@ msgid ""
"\n"
msgstr ""
"\n"
"Requête faite pour l'extrémité IPv4 %s d'une adresse IPv6 6to4.\n"
"Requête faite pour l'extrémité IPv4 %s d'une adresse IPv6 6to4.\n"
"\n"
#: ../whois.c:260
#, fuzzy, c-format
#, c-format
msgid ""
"\n"
"Querying for the IPv4 endpoint %s of a Teredo IPv6 address.\n"
"\n"
msgstr ""
"\n"
"Requête faite pour l'extrémité IPv4 %s d'une adresse IPv6 6to4.\n"
"Requête faite pour l'extrémité IPv4 %s d'une adresse IPv6 6to4.\n"
"\n"
#: ../whois.c:274
@ -78,7 +78,7 @@ msgid ""
"Query string: \"%s\"\n"
"\n"
msgstr ""
"Requête: \"%s\"\n"
"Requête : \"%s\"\n"
"\n"
#: ../whois.c:284
@ -91,31 +91,31 @@ msgid ""
msgstr ""
"\n"
"\n"
"Renvoi trouvé vers %s.\n"
"Renvoi trouvé vers %s.\n"
"\n"
#: ../whois.c:327 ../whois.c:330
#, c-format
msgid "Cannot parse this line: %s"
msgstr "Impossible d'interpréter la ligne: %s"
msgstr "Impossible d'interpréter la ligne : %s"
#: ../whois.c:483
msgid "Warning: RIPE flags used with a traditional server."
msgstr ""
"Avertissement: des options RIPE ont été utilisées avec un serveur classique."
"Avertissement : des options RIPE ont été utilisées avec un serveur classique."
#: ../whois.c:621 ../whois.c:754
msgid ""
"Catastrophic error: disclaimer text has been changed.\n"
"Please upgrade this program.\n"
msgstr ""
"Erreur catastrophique: le texte de déni de responsabilité a changé.\n"
"Veuillez mettre à jour ce programme.\n"
"Erreur catastrophique : le texte de déni de responsabilité a changé.\n"
"Veuillez mettre à jour ce programme.\n"
#: ../whois.c:795
#, c-format
msgid "Host %s not found."
msgstr "L'hôte %s est introuvable."
msgstr "L'hôte %s est introuvable."
#: ../whois.c:805
#, c-format
@ -124,7 +124,7 @@ msgstr "%s/tcp: service inconnu"
#: ../whois.c:824
msgid "Timeout."
msgstr "Temps limite dépassé."
msgstr "Temps limite dépassé."
#: ../whois.c:830
#, c-format
@ -168,55 +168,54 @@ msgid ""
msgstr ""
"Usage: whois [OPTION]... OBJET...\n"
"\n"
"-l réduire d'un niveau la spécificité de la recherche "
"-l réduire d'un niveau la spécificité de la recherche "
"[RPSL seulement]\n"
"-L trouver toutes les occurrences moins spécifiques\n"
"-L trouver toutes les occurrences moins spécifiques\n"
"-m trouver les occurrences de premier niveau plus "
"spécifiques\n"
"-M trouver toutes les occurrences plus spécifiques\n"
"-c trouver l'occurrence la plus spécifique contenant un "
"spécifiques\n"
"-M trouver toutes les occurrences plus spécifiques\n"
"-c trouver l'occurrence la plus spécifique contenant un "
"attribut mnt-irt\n"
"-x occurrences exactes [RPSL seulement]\n"
"-d renvoyer aussi les objets de délégation DNS inverse "
"-d renvoyer aussi les objets de délégation DNS inverse "
"[RPSL seulement]\n"
"-i ATTR[,ATTR]... effectuer une recherche inverse pour les ATTRibuts "
"spécifiés\n"
"spécifiés\n"
"-T TYPE[,TYPE]... chercher seulement les objets de ce TYPE\n"
"-K seules les clés primaires sont renvoyées [RPSL "
"-K seules les clés primaires sont renvoyées [RPSL "
"seulement]\n"
"-r désactiver la recherche récursive des informations de "
"-r désactiver la recherche récursive des informations de "
"contact\n"
"-R forcer l'affichage de la copie locale de l'objet de "
"domaine,\n"
" même s'il contient un renvoi\n"
"-a rechercher dans toutes les bases de données\n"
" même s'il contient un renvoi\n"
"-a rechercher dans toutes les bases de données\n"
"-s SOURCE[,SOURCE]... rechercher dans la base de la SOURCE\n"
"-g SOURCE:PREM-DERN trouver les mises à jour de la SOURCE ayant des "
"numéros de série compris entre PREM et DERN\n"
"-g SOURCE:PREM-DERN trouver les mises à jour de la SOURCE ayant des "
"numéros de série compris entre PREM et DERN\n"
"-t TYPE demander la syntaxe pour les objets de ce TYPE ('all' "
"donne une liste)\n"
"-v TYPE demander la syntaxe détaillée pour les objets de ce "
"-v TYPE demander la syntaxe détaillée pour les objets de ce "
"TYPE\n"
"-q [version|sources|types] demander les informations spécifiées au serveur "
"-q [version|sources|types] demander les informations spécifiées au serveur "
"[RPSL seulement]\n"
"-F sortie rapide au format brut (l'option -r est "
"implicite)\n"
"-h HOTE se connecter au serveur HOTE\n"
"-p PORT se connecter à ce PORT\n"
"-H cacher les textes légaux de déni de responsabilité\n"
" --verbose détailler les actions entreprises\n"
"-p PORT se connecter à ce PORT\n"
"-H cacher les textes légaux de déni de responsabilité\n"
" --verbose détailler les actions entreprises\n"
" --help afficher cette page d'aide et sortir\n"
" --version afficher les informations de version et sortir\n"
#: ../mkpasswd.c:65
#, fuzzy
msgid "standard 56 bit DES-based crypt(3)"
msgstr "\tfonction crypt(3) standard, chiffrement DES à 56 bits"
msgstr "fonction crypt(3) standard, chiffrement DES à 56 bits"
#: ../mkpasswd.c:134
#, fuzzy, c-format
#, c-format
msgid "Invalid method '%s'.\n"
msgstr "Le nombre '%s' est invalide.\n"
msgstr "La méthode '%s' est invalide.\n"
#: ../mkpasswd.c:143 ../mkpasswd.c:153
#, c-format
@ -232,27 +231,27 @@ msgstr "Veuillez taper '%s --help' pour plus d'informations.\n"
#: ../mkpasswd.c:211
#, c-format
msgid "Wrong salt length: %d byte(s) when %d expected.\n"
msgstr "Mauvaise taille d'aléa: %d octet(s) au lieu de %d.\n"
msgstr "Mauvaise taille d'aléa: %d octet(s) au lieu de %d.\n"
#: ../mkpasswd.c:217
#, c-format
msgid "Illegal salt character '%c'.\n"
msgstr "Le caractère '%c' est invalide dans l'aléa.\n"
msgstr "Le caractère '%c' est invalide dans l'aléa.\n"
#: ../mkpasswd.c:254 ../mkpasswd.c:281
#, c-format
msgid "Password: "
msgstr "Mot de passe: "
msgstr "Mot de passe : "
#: ../mkpasswd.c:275
#, c-format
msgid "Illegal password character '0x%hhx'.\n"
msgstr "Le caractère '0x%hhx' est invalide dans le mot de passe.\n"
msgstr "Le caractère '0x%hhx' est invalide dans le mot de passe.\n"
#: ../mkpasswd.c:297
#, c-format
msgid "Method not supported by crypt(3).\n"
msgstr ""
msgstr "Méthode non prise en charge par crypt(3).\n"
#: ../mkpasswd.c:360
#, c-format
@ -261,12 +260,12 @@ msgid ""
"Crypts the PASSWORD using crypt(3).\n"
"\n"
msgstr ""
"Usage : mkpasswd [OPTIONS]... [MOT DE PASSE [ALÉA]]\n"
"Chiffre le MOT DE PASSE à l'aide de la fonction crypt(3).\n"
"Usage : mkpasswd [OPTIONS]... [MOT DE PASSE [ALÉA]]\n"
"Chiffre le MOT DE PASSE à l'aide de la fonction crypt(3).\n"
"\n"
#: ../mkpasswd.c:363
#, fuzzy, c-format
#, c-format
msgid ""
" -m, --method=TYPE select method TYPE\n"
" -S, --salt=SALT use the specified SALT\n"
@ -283,25 +282,23 @@ msgid ""
"\n"
"Report bugs to %s.\n"
msgstr ""
" -H, --hash=TYPE sélectionner ce TYPE de hachage\n"
" -S, --salt=ALÉA utiliser cette ALÉA\n"
" -m, --method=TYPE sélectionner ce TYPE de méthode\n"
" -S, --salt=ALÉA utiliser cette ALÉA\n"
" -R, --rounds=NOMBRE utiliser le NOMBRE de passages indiqué\n"
" -P, --password-fd=NUM lire le mot de passe depuis le descripteur de "
"fichier NUM\n"
" au lieu de /dev/tty\n"
" -s, --stdin équivalent à --password-fd=0\n"
" -s, --stdin équivalent à --password-fd=0\n"
" -h, --help afficher cette page d'aide et sortir\n"
" -V, --version afficher les informations de version et sortir\n"
"\n"
"Si le MOT DE PASSE est manquant, il est demandé interactivement.\n"
"Si aucune ALÉA n'est spécifiée, un aléa aléatoire est générée.\n"
"Si le TYPE est manquant, les algorithmes disponibles sont affichés.\n"
"Si le MOT DE PASSE est manquant, il est demandé interactivement.\n"
"Si aucune ALÉA n'est spécifiée, un aléa aléatoire est générée.\n"
"Si le TYPE est 'help', les méthodes disponibles sont affichés.\n"
"\n"
"Veuillez rapporter les bogues à %s.\n"
"Veuillez signaler les bogues à %s.\n"
#: ../mkpasswd.c:391
#, fuzzy, c-format
#, c-format
msgid "Available methods:\n"
msgstr "Algorithmes disponibles:\n"
#~ msgid "Invalid hash type '%s'.\n"
#~ msgstr "Le type de hachage '%s' est invalide.\n"
msgstr "Méthodes disponibles :\n"

View File

@ -1,6 +1,4 @@
# NIC? means I have not been able to find the registry
# UPR means the TLD is managed by UPR, but I could not find any info
#
.br.com whois.centralnic.net
.cn.com whois.centralnic.net
@ -321,7 +319,7 @@
.yt whois.nic.yt
.yu NONE # www.nic.yu
.ac.za whois.ac.za
.co.za WEB http://whois.co.za/
.co.za WEB http://whois.co.za/ # whois.coza.net.za contains much less data
.gov.za whois.gov.za
#.net.za whois.net.za
.org.za WEB http://www.org.za/ # rwhois.org.za:4321

96
utils.c Normal file
View File

@ -0,0 +1,96 @@
/*
* Copyright 1999-2008 by Marco d'Itri <md@linux.it>.
*
* do_nofail and merge_args come from the module-init-tools package.
* Copyright 2001 by Rusty Russell.
* Copyright 2002, 2003 by Rusty Russell, IBM Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* for strdup */
#define _XOPEN_SOURCE 500
/* System library */
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
/* Application-specific */
#include "utils.h"
void *do_nofail(void *ptr, const char *file, const int line)
{
if (ptr)
return ptr;
err_quit("Memory allocation failure at %s:%d.", file, line);
}
/* Prepend options from a string. */
char **merge_args(char *args, char *argv[], int *argc)
{
char *arg, *argstring;
char **newargs = NULL;
unsigned int i, num_env = 0;
if (!args)
return argv;
argstring = NOFAIL(strdup(args));
for (arg = strtok(argstring, " "); arg; arg = strtok(NULL, " ")) {
num_env++;
newargs = NOFAIL(realloc(newargs,
sizeof(newargs[0]) * (num_env + *argc + 1)));
newargs[num_env] = arg;
}
if (!newargs)
return argv;
/* Append commandline args */
newargs[0] = argv[0];
for (i = 1; i <= *argc; i++)
newargs[num_env + i] = argv[i];
*argc += num_env;
return newargs;
}
/* Error routines */
void err_sys(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
fprintf(stderr, ": %s\n", strerror(errno));
va_end(ap);
exit(2);
}
void err_quit(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
fputs("\n", stderr);
va_end(ap);
exit(2);
}

51
utils.h Normal file
View File

@ -0,0 +1,51 @@
#ifndef WHOIS_UTILS_H
#define WHOIS_UTILS_H
/* Convenience macros */
#define streq(a, b) (strcmp(a, b) == 0)
#define strcaseeq(a, b) (strcasecmp(a, b) == 0)
#define strneq(a, b, n) (strncmp(a, b, n) == 0)
#define strncaseeq(a, b, n) (strncasecmp(a, b, n) == 0)
#define NOFAIL(ptr) do_nofail((ptr), __FILE__, __LINE__)
/* Portability macros */
#ifdef __GNUC__
# define NORETURN __attribute__((noreturn))
#else
# define NORETURN
#endif
#ifndef AI_IDN
# define AI_IDN 0
#endif
#ifdef HAVE_GETOPT_LONG
# define GETOPT_LONGISH(c, v, o, l, i) getopt_long(c, v, o, l, i)
#else
# define GETOPT_LONGISH(c, v, o, l, i) getopt(c, v, o)
#endif
#ifdef ENABLE_NLS
# include <libintl.h>
# include <locale.h>
# define _(a) (gettext(a))
# ifdef gettext_noop
# define N_(a) gettext_noop(a)
# else
# define N_(a) (a)
# endif
#else
# define _(a) (a)
# define N_(a) (a)
#endif
/* Prototypes */
void *do_nofail(void *ptr, const char *file, const int line);
char **merge_args(char *args, char *argv[], int *argc);
void err_quit(const char *fmt, ...) NORETURN;
void err_sys(const char *fmt, ...) NORETURN;
#endif

View File

@ -84,13 +84,13 @@ current system locale and converted to the IDN ASCII Compatible Encoding.
When querying \fIwhois.nic.ad.jp\fP and \fIwhois.jprs.jp\fP english text
is requested unless the
\fILANG\fP environment variable specifies a Japanese locale.
.IP "WHOIS_OPTIONS"
A list of options which will be evalued before the ones specified on the
command line.
.IP "WHOIS_SERVER"
This server will be queried if the program cannot guess where some kind
of objects are located. If the variable does not exist then
\fIwhois.arin.net\fP will be queried.
.IP "WHOIS_HIDE"
If this variable is defined, legal disclaimers will be hidden even if
the \fI\-H\fP flag is not used.
.SH "SEE ALSO"
\fIRFC 3912\fP: WHOIS Protocol Specification
.PP

68
whois.c
View File

@ -32,16 +32,14 @@
#include <idna.h>
#endif
#ifndef AI_IDN
#define AI_IDN 0
#endif
/* Application-specific */
#include "data.h"
#include "whois.h"
#include "utils.h"
#define streq(a, b) (strcmp(a, b) == 0)
#define strneq(a, b, n) (strncmp(a, b, n) == 0)
/* hack */
#define malloc(s) NOFAIL(malloc(s))
#define realloc(p, s) NOFAIL(realloc(p, s))
/* Global variables */
int sockfd, verb = 0;
@ -52,10 +50,10 @@ int hide_discl = HIDE_UNSTARTED;
int hide_discl = HIDE_DISABLED;
#endif
char *client_tag = (char *)IDSTRING;
const char *client_tag = (char *)IDSTRING;
#ifdef HAVE_GETOPT_LONG
static struct option longopts[] = {
static const struct option longopts[] = {
{"help", no_argument, NULL, 0 },
{"version", no_argument, NULL, 1 },
{"verbose", no_argument, NULL, 2 },
@ -81,6 +79,9 @@ int main(int argc, char *argv[])
textdomain(NLS_CAT_NAME);
#endif
/* prepend options from environment */
argv = merge_args(getenv("WHOIS_OPTIONS"), argv, &argc);
while ((ch = GETOPT_LONGISH(argc, argv,
"abBcdFg:Gh:Hi:KlLmMp:q:rRs:St:T:v:V:x", longopts, 0)) > 0) {
/* RIPE flags */
@ -364,14 +365,14 @@ const char *whichwhois(const char *s)
{
unsigned long ip, as32;
unsigned int i;
char *colon;
const char *colon;
/* IPv6 address */
if ((colon = strchr(s, ':'))) {
unsigned long v6prefix, v6net;
/* RPSL hierarchical objects */
if (strncasecmp(s, "as", 2) == 0) {
if (strncaseeq(s, "as", 2)) {
if (isasciidigit(s[2]))
return whereas(atoi(s + 2));
else
@ -400,7 +401,7 @@ const char *whichwhois(const char *s)
/* no dot and no hyphen means it's a NSI NIC handle or ASN (?) */
if (!strpbrk(s, ".-")) {
if (strncasecmp(s, "as", 2) == 0 && /* it's an AS */
if (strncaseeq(s, "as", 2) && /* it's an AS */
(isasciidigit(s[2]) || s[2] == ' '))
return whereas(atoi(s + 2));
if (*s == '!') /* NSI NIC handle */
@ -410,8 +411,7 @@ const char *whichwhois(const char *s)
}
/* ASN32? */
if (strncasecmp(s, "as", 2) == 0 && s[2] &&
(as32 = asn32_to_long(s + 2)) != 0)
if (strncaseeq(s, "as", 2) && s[2] && (as32 = asn32_to_long(s + 2)) != 0)
return whereas32(as32);
/* smells like an IP? */
@ -431,7 +431,7 @@ const char *whichwhois(const char *s)
if (!strchr(s, '.')) {
/* search for strings at the start of the word */
for (i = 0; nic_handles[i]; i += 2)
if (strncasecmp(s, nic_handles[i], strlen(nic_handles[i])) == 0)
if (strncaseeq(s, nic_handles[i], strlen(nic_handles[i])))
return nic_handles[i + 1];
/* it's probably a network name */
return "";
@ -502,7 +502,7 @@ char *queryformat(const char *server, const char *flags, const char *query)
#endif
if (!isripe && (streq(server, "whois.nic.mil") ||
streq(server, "whois.nic.ad.jp")) &&
strncasecmp(query, "AS", 2) == 0 && isasciidigit(query[2]))
strncaseeq(query, "AS", 2) && isasciidigit(query[2]))
/* FIXME: /e is not applied to .JP ASN */
sprintf(buf, "AS %s", query + 2); /* fix query for DDN */
else if (!isripe && (streq(server, "whois.nic.ad.jp") ||
@ -712,7 +712,7 @@ const char *query_pir(const int sock, const char *query)
const char *query_afilias(const int sock, const char *query)
{
char *temp, buf[2000], *p, *ret = NULL;
char *temp, buf[2000], *ret = NULL;
FILE *fi;
int hide = hide_discl;
int state = 0;
@ -739,12 +739,14 @@ const char *query_afilias(const int sock, const char *query)
*q = '\0';
}
if (hide_line(&hide, buf))
continue;
if (!hide_line(&hide, buf)) {
char *p;
for (p = buf; *p && *p != '\r' && *p != '\n'; p++);
*p = '\0';
fprintf(stdout, "%s\n", buf);
for (p = buf; *p && *p != '\r' && *p != '\n'; p++)
;
*p = '\0';
fprintf(stdout, "%s\n", buf);
}
}
if (ferror(fi))
err_sys("fgets");
@ -1028,27 +1030,3 @@ void usage(void)
exit(0);
}
/* Error routines */
void err_sys(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
fprintf(stderr, ": %s\n", strerror(errno));
va_end(ap);
exit(2);
}
void err_quit(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
fputs("\n", stderr);
va_end(ap);
exit(2);
}

View File

@ -36,9 +36,6 @@ const char *handle_query(const char *server, const char *port,
void split_server_port(const char *const input, const char **server,
const char **port);
void err_quit(const char *,...);
void err_sys(const char *,...);
/* flags for RIPE-like servers */
const char *ripeflags="abBcdFGKlLmMrRSx";

View File

@ -1,6 +1,6 @@
Summary: Enhanced WHOIS client
Name: whois
Version: 4.7.25
Version: 4.7.26
Release: 1
License: GPL
Vendor: Marco d'Itri <md@linux.it>