.\" Copyright (c) 1995 David Nugent .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, is permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice immediately at the beginning of the file, without modification, .\" this list of conditions, and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. This work was done expressly for inclusion into FreeBSD. Other use .\" is permitted provided this notation is included. .\" 4. Absolutely no warranty of function or purpose is made by the author .\" David Nugent. .\" 5. Modifications may be freely made to this file providing the above .\" conditions are met. .\" .\" %FreeBSD: src/lib/libutil/login_ok.3,v 1.7.2.4 2001/12/17 10:08:32 ru Exp % .\" $FreeBSD$ .\" .Dd January 2, 1997 .Os .Dt LOGIN_OK 3 .Sh 名称 .Nm auth_ttyok , .Nm auth_hostok , .Nm auth_timeok .Nd ログイン制約に基づくログインクラスのチェック用関数 .Sh ライブラリ .Lb libutil .Sh 書式 .In sys/types.h .In time.h .In login_cap.h .Ft int .Fn auth_ttyok "login_cap_t *lc" "const char *tty" .Ft int .Fn auth_hostok "login_cap_t *lc" "const char *host" "char const *ip" .Ft int .Fn auth_timeok "login_cap_t *lc" "time_t t" .Sh 解説 この関数セットは、ログインが、 .Xr login.conf 5 という ログインデータベース上のログインクラス登録権限に基づき許可できるかどうかを 判定します。 .Pp .Fn auth_ttyok は、名前付 tty が指定されたクラスのユーザで 利用可能かどうかを判定します。またそれが .Em ttys.allow アクセスリストに載っており、 .Em ttys.deny アクセスリストに載っていないこともチェックします。 tty デバイス経由でくるログインは、 .Em ttys.allow リストがなく (あるいは指定されたログインクラスの登録権限定義がない) ても、空でない .Em ttys.deny リストが存在しない限り、またはデバイスあるいは tty グループ( .Xr ttys 5 を参照のこと) がリストに載っていなければ、受入れられます。 tty に対するアクセスは、 tty デバイス名で固有の制限と範囲が決められます。また デバイス名はワイルドカード指定 (例えば、ttyD* または cuaD*) を含むか、または group= タグが .Pa /etc/ttys に割り振られている場合、ttygroup の名前を定義します。 ttys と ttygroups の一致はケースによります。 .Dv NULL または文字列を tty parameter として渡すと、関数は 0 でない数値を返します。 .Pp .Fn auth_hostok は、リモートログインにおけるホスト側の制約をチェック します。この関数は、 .Em host.allow および .Em host.deny のログインクラスの権限レベルに対し、ホスト名や IP アドレス (具体的には n.n.n.n のようなテキスト形式で指定されます。) の両方のチェックを行います。 ttys およびそのグループについてと同様、許可、 非許可権限レコード内でワイルドカードや文字 クラスを使用できます。関数 .Xr fnmatch 3 は対応付けに使用されます。ホスト名の 対応付けは大文字か小文字かによります。この関数ではホスト名が完全形式で 記述 (たとえば、必要ならばローカルドメイン名が追加される) されている 必要があることに注意する必要があります。さらに、IP アドレスは標準的な 形式になっています。ホスト名やアドレス参照は行われません。 .Pp この関数の呼び出しは、ホスト名を使用するか、または IP アドレスを 指定せず (例えば .Dv NULL 指定) に実行できます。またマッチングはパラメータが 指定されなければ実行されません。どちらのパラメータについて .Dv NULL か空の文字列が渡された場合、0 以外の戻り値が返されます。 .Pp 関数 .Fn auth_timeok は、指定の時間値が、ログインクラス .Em times.allow の範囲にあり、 .Em times.deny アクセスリストにないかどうか判定します。 .Em times.allow リストが存在しないか空であれば、指定時間が .Em times.deny リストに示す時間帯にない限り、いつでもアクセス可能です。 .Em times.allow および .Em times.deny のフィールドに含まれる時間帯レコードの形式の詳細については、 .Xr login_times 3 のマニュアルページを参照してください。 .Sh 戻り値 これらの関数からの戻り値が 0 でない場合、ログインが認可されています。 戻り値が 0 の場合は、対象が .Em allow アクセスリストにないか .Em deny アクセスリストに載っています。 .Pp .Sh 関連項目 .Xr getcap 3 , .Xr login_cap 3 , .Xr login_class 3 , .Xr login_times 3 , .Xr login.conf 5 , .Xr termcap 5