Deleted Added
full compact
login.c (185289) login.c (211095)
1/*-
1/*-
2 * Copyright (c) 2005-2008 Daniel Braniss <danny@cs.huji.ac.il>
2 * Copyright (c) 2005-2010 Daniel Braniss <danny@cs.huji.ac.il>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright

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

24 * SUCH DAMAGE.
25 *
26 */
27/*
28 | $Id: login.c,v 1.4 2007/04/27 07:40:40 danny Exp danny $
29 */
30
31#include <sys/cdefs.h>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright

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

24 * SUCH DAMAGE.
25 *
26 */
27/*
28 | $Id: login.c,v 1.4 2007/04/27 07:40:40 danny Exp danny $
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sbin/iscontrol/login.c 185289 2008-11-25 07:17:11Z scottl $");
32__FBSDID("$FreeBSD: head/sbin/iscontrol/login.c 211095 2010-08-09 12:36:36Z des $");
33
34#include <sys/param.h>
35#include <sys/types.h>
36#include <sys/socket.h>
37#include <sys/sysctl.h>
38
39#include <netinet/in.h>
40#include <netinet/tcp.h>
41#include <arpa/inet.h>
42#if __FreeBSD_version < 500000
43#include <sys/time.h>
44#endif
45#include <sys/ioctl.h>
46#include <stdio.h>
47#include <stdlib.h>
48#include <string.h>
49
33
34#include <sys/param.h>
35#include <sys/types.h>
36#include <sys/socket.h>
37#include <sys/sysctl.h>
38
39#include <netinet/in.h>
40#include <netinet/tcp.h>
41#include <arpa/inet.h>
42#if __FreeBSD_version < 500000
43#include <sys/time.h>
44#endif
45#include <sys/ioctl.h>
46#include <stdio.h>
47#include <stdlib.h>
48#include <string.h>
49
50#include "iscsi.h"
50#include <dev/iscsi/initiator/iscsi.h>
51#include "iscontrol.h"
52
53static char *status_class1[] = {
54 "Initiator error",
55 "Authentication failure",
56 "Authorization failure",
57 "Not found",
58 "Target removed",

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

102getkeyval(char *key, pdu_t *pp)
103{
104 char *ptr;
105 int klen, len, n;
106
107 debug_called(3);
108
109 len = pp->ds_len;
51#include "iscontrol.h"
52
53static char *status_class1[] = {
54 "Initiator error",
55 "Authentication failure",
56 "Authorization failure",
57 "Not found",
58 "Target removed",

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

102getkeyval(char *key, pdu_t *pp)
103{
104 char *ptr;
105 int klen, len, n;
106
107 debug_called(3);
108
109 len = pp->ds_len;
110 ptr = (char *)pp->ds;
110 ptr = (char *)pp->ds_addr;
111 klen = strlen(key);
112 while(len > klen) {
113 if(strncmp(key, ptr, klen) == 0)
114 return ptr+klen;
115 n = strlen(ptr) + 1;
116 len -= n;
117 ptr += n;
118 }

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

158{
159 isc_opt_t *op = sess->op;
160 int len, klen, n;
161 char *eq, *ptr;
162
163 debug_called(3);
164
165 len = pp->ds_len;
111 klen = strlen(key);
112 while(len > klen) {
113 if(strncmp(key, ptr, klen) == 0)
114 return ptr+klen;
115 n = strlen(ptr) + 1;
116 len -= n;
117 ptr += n;
118 }

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

158{
159 isc_opt_t *op = sess->op;
160 int len, klen, n;
161 char *eq, *ptr;
162
163 debug_called(3);
164
165 len = pp->ds_len;
166 ptr = (char *)pp->ds;
166 ptr = (char *)pp->ds_addr;
167 while(len > 0) {
168 if(vflag > 1)
169 printf("got: len=%d %s\n", len, ptr);
170 klen = 0;
171 if((eq = strchr(ptr, '=')) != NULL)
172 klen = eq - ptr;
173 if(klen > 0) {
174 if(strncmp(ptr, "TargetAddress", klen) == 0) {

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

228 login_rsp_t *lp = (login_rsp_t *)pp;
229 uint st_class, status = ntohs(lp->status);
230
231 debug_called(3);
232 debug(4, "Tbit=%d csg=%d nsg=%d status=%x", lp->T, lp->CSG, lp->NSG, status);
233
234 st_class = status >> 8;
235 if(status) {
167 while(len > 0) {
168 if(vflag > 1)
169 printf("got: len=%d %s\n", len, ptr);
170 klen = 0;
171 if((eq = strchr(ptr, '=')) != NULL)
172 klen = eq - ptr;
173 if(klen > 0) {
174 if(strncmp(ptr, "TargetAddress", klen) == 0) {

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

228 login_rsp_t *lp = (login_rsp_t *)pp;
229 uint st_class, status = ntohs(lp->status);
230
231 debug_called(3);
232 debug(4, "Tbit=%d csg=%d nsg=%d status=%x", lp->T, lp->CSG, lp->NSG, status);
233
234 st_class = status >> 8;
235 if(status) {
236 int st_detail = status & 0xff;
236 uint st_detail = status & 0xff;
237
238 switch(st_class) {
239 case 1: // Redirect
240 switch(st_detail) {
241 // the ITN (iSCSI target Name) requests a:
242 case 1: // temporary address change
243 case 2: // permanent address change
244 status = 0;

--- 199 unchanged lines hidden ---
237
238 switch(st_class) {
239 case 1: // Redirect
240 switch(st_detail) {
241 // the ITN (iSCSI target Name) requests a:
242 case 1: // temporary address change
243 case 2: // permanent address change
244 status = 0;

--- 199 unchanged lines hidden ---