Deleted Added
full compact
login.c (259305) login.c (263720)
1/*-
2 * Copyright (c) 2012 The FreeBSD Foundation
3 * All rights reserved.
4 *
5 * This software was developed by Edward Tomasz Napierala under sponsorship
6 * from the FreeBSD Foundation.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
1/*-
2 * Copyright (c) 2012 The FreeBSD Foundation
3 * All rights reserved.
4 *
5 * This software was developed by Edward Tomasz Napierala under sponsorship
6 * from the FreeBSD Foundation.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: stable/10/usr.sbin/ctld/login.c 259305 2013-12-13 15:23:07Z trasz $
29 * $FreeBSD: stable/10/usr.sbin/ctld/login.c 263720 2014-03-25 12:01:55Z trasz $
30 */
31
32#include <assert.h>
33#include <stdbool.h>
34#include <stdint.h>
35#include <stdio.h>
36#include <stdlib.h>
37#include <string.h>

--- 897 unchanged lines hidden (view full) ---

935 log_debugx("initiator requests "
936 "discovery session; auth-group \"%s\"", ag->ag_name);
937 } else {
938 log_debugx("initiator requests discovery session");
939 }
940 }
941
942 /*
30 */
31
32#include <assert.h>
33#include <stdbool.h>
34#include <stdint.h>
35#include <stdio.h>
36#include <stdlib.h>
37#include <string.h>

--- 897 unchanged lines hidden (view full) ---

935 log_debugx("initiator requests "
936 "discovery session; auth-group \"%s\"", ag->ag_name);
937 } else {
938 log_debugx("initiator requests discovery session");
939 }
940 }
941
942 /*
943 * Enforce initiator-name and initiator-portal.
944 */
945 if (auth_name_defined(ag)) {
946 if (auth_name_find(ag, initiator_name) == NULL) {
947 login_send_error(request, 0x02, 0x02);
948 log_errx(1, "initiator does not match allowed "
949 "initiator names");
950 }
951 log_debugx("initiator matches allowed initiator names");
952 } else {
953 log_debugx("auth-group does not define initiator name "
954 "restrictions");
955 }
956
957 if (auth_portal_defined(ag)) {
958 if (auth_portal_find(ag, conn->conn_initiator_addr) == NULL) {
959 login_send_error(request, 0x02, 0x02);
960 log_errx(1, "initiator does not match allowed "
961 "initiator portals");
962 }
963 log_debugx("initiator matches allowed initiator portals");
964 } else {
965 log_debugx("auth-group does not define initiator portal "
966 "restrictions");
967 }
968
969 /*
943 * Let's see if the initiator intends to do any kind of authentication
944 * at all.
945 */
946 if (login_csg(request) == BHSLR_STAGE_OPERATIONAL_NEGOTIATION) {
947 if (ag->ag_type != AG_TYPE_NO_AUTHENTICATION) {
948 login_send_error(request, 0x02, 0x01);
949 log_errx(1, "initiator skipped the authentication, "
950 "but authentication is required");

--- 111 unchanged lines hidden ---
970 * Let's see if the initiator intends to do any kind of authentication
971 * at all.
972 */
973 if (login_csg(request) == BHSLR_STAGE_OPERATIONAL_NEGOTIATION) {
974 if (ag->ag_type != AG_TYPE_NO_AUTHENTICATION) {
975 login_send_error(request, 0x02, 0x01);
976 log_errx(1, "initiator skipped the authentication, "
977 "but authentication is required");

--- 111 unchanged lines hidden ---