mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
Stop using auth_getval() now that it always returns NULL. Instead,
hardcode the default to what it would be if we didn't hardcode it, i.e. DES if supported and MD5 otherwise. MFC after: 3 weeks
This commit is contained in:
parent
9189ae71fa
commit
a0ee974f0b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=236967
|
@ -26,11 +26,7 @@ SRCS+= crypt-des.c crypt-blowfish.c blowfish.c
|
||||||
CFLAGS+= -I${.CURDIR} -DHAS_DES -DHAS_BLOWFISH
|
CFLAGS+= -I${.CURDIR} -DHAS_DES -DHAS_BLOWFISH
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
# And the auth_getval() code and support.
|
.for sym in MD4Init MD4Final MD4Update MD4Pad \
|
||||||
.PATH: ${.CURDIR}/../libutil
|
|
||||||
SRCS+= auth.c property.c
|
|
||||||
.for sym in auth_getval property_find properties_read properties_free \
|
|
||||||
MD4Init MD4Final MD4Update MD4Pad \
|
|
||||||
MD5Init MD5Final MD5Update MD5Pad \
|
MD5Init MD5Final MD5Update MD5Pad \
|
||||||
SHA256_Init SHA256_Final SHA256_Update \
|
SHA256_Init SHA256_Final SHA256_Update \
|
||||||
SHA512_Init SHA512_Final SHA512_Update
|
SHA512_Init SHA512_Final SHA512_Update
|
||||||
|
|
|
@ -238,12 +238,6 @@ The
|
||||||
.Fn crypt_set_format
|
.Fn crypt_set_format
|
||||||
function sets the default encoding format according to the supplied
|
function sets the default encoding format according to the supplied
|
||||||
.Fa string .
|
.Fa string .
|
||||||
.Pp
|
|
||||||
The global default format can be set using the
|
|
||||||
.Pa /etc/auth.conf
|
|
||||||
file using the
|
|
||||||
.Va crypt_default
|
|
||||||
property.
|
|
||||||
.Sh RETURN VALUES
|
.Sh RETURN VALUES
|
||||||
The
|
The
|
||||||
.Fn crypt
|
.Fn crypt
|
||||||
|
@ -260,9 +254,7 @@ Otherwise, a value of 0 is returned.
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr login 1 ,
|
.Xr login 1 ,
|
||||||
.Xr passwd 1 ,
|
.Xr passwd 1 ,
|
||||||
.Xr auth_getval 3 ,
|
|
||||||
.Xr getpass 3 ,
|
.Xr getpass 3 ,
|
||||||
.Xr auth.conf 5 ,
|
|
||||||
.Xr passwd 5
|
.Xr passwd 5
|
||||||
.Sh HISTORY
|
.Sh HISTORY
|
||||||
A rotor-based
|
A rotor-based
|
||||||
|
|
|
@ -79,23 +79,23 @@ static const struct {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef HAS_DES
|
||||||
|
#define CRYPT_DEFAULT "des"
|
||||||
|
#else
|
||||||
|
#define CRYPT_DEFAULT "md5"
|
||||||
|
#endif
|
||||||
|
|
||||||
static int crypt_type = -1;
|
static int crypt_type = -1;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
crypt_setdefault(void)
|
crypt_setdefault(void)
|
||||||
{
|
{
|
||||||
char *def;
|
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (crypt_type != -1)
|
if (crypt_type != -1)
|
||||||
return;
|
return;
|
||||||
def = auth_getval("crypt_default");
|
|
||||||
if (def == NULL) {
|
|
||||||
crypt_type = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (i = 0; i < sizeof(crypt_types) / sizeof(crypt_types[0]) - 1; i++) {
|
for (i = 0; i < sizeof(crypt_types) / sizeof(crypt_types[0]) - 1; i++) {
|
||||||
if (strcmp(def, crypt_types[i].name) == 0) {
|
if (strcmp(CRYPT_DEFAULT, crypt_types[i].name) == 0) {
|
||||||
crypt_type = (int)i;
|
crypt_type = (int)i;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue