ses_init_buf = kcalloc(1, sizeof(struct rfc1002_session_packet), GFP_KERNEL); 
ses_init_buf = kzalloc(sizeof(struct rfc1002_session_packet), GFP_KERNEL); 
ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket, 			 char * netbios_name){	int rc = 0;	int connected = 0;	__be16 orig_port = 0;	if(*csocket == NULL) {		rc = sock_create_kern(PF_INET, SOCK_STREAM, IPPROTO_TCP, csocket);		if (rc < 0) {			cERROR(1, ("Error %d creating socket",rc));			*csocket = NULL;			return rc;		} else {		/* BB other socket options to set KEEPALIVE, NODELAY? */			cFYI(1,("Socket created"));			(*csocket)->sk->sk_allocation = GFP_NOFS; 		}	}	psin_server->sin_family = AF_INET;	if(psin_server->sin_port) { /* user overrode default port */		rc = (*csocket)->ops->connect(*csocket,				(struct sockaddr *) psin_server,				sizeof (struct sockaddr_in),0);		if (rc >= 0)			connected = 1;	} 	if(!connected) {		/* save original port so we can retry user specified port  			later if fall back ports fail this time  */		orig_port = psin_server->sin_port;		/* do not retry on the same port we just failed on */		if(psin_server->sin_port != htons(CIFS_PORT)) {			psin_server->sin_port = htons(CIFS_PORT);			rc = (*csocket)->ops->connect(*csocket,					(struct sockaddr *) psin_server,					sizeof (struct sockaddr_in),0);			if (rc >= 0)				connected = 1;		}	}	if (!connected) {		psin_server->sin_port = htons(RFC1001_PORT);		rc = (*csocket)->ops->connect(*csocket, (struct sockaddr *)					      psin_server, sizeof (struct sockaddr_in),0);		if (rc >= 0) 			connected = 1;	}	/* give up here - unless we want to retry on different		protocol families some day */	if (!connected) {		if(orig_port)			psin_server->sin_port = orig_port;		cFYI(1,("Error %d connecting to server via ipv4",rc));		sock_release(*csocket);		*csocket = NULL;		return rc;	}	/* Eventually check for other socket options to change from 		the default. sock_setsockopt not used because it expects 		user space buffer */	(*csocket)->sk->sk_rcvtimeo = 7 * HZ;	/* send RFC1001 sessinit */	if(psin_server->sin_port == htons(RFC1001_PORT)) {		/* some servers require RFC1001 sessinit before sending		negprot - BB check reconnection in case where second 		sessinit is sent but no second negprot */		struct rfc1002_session_packet * ses_init_buf;		struct smb_hdr * smb_buf;		ses_init_buf = kcalloc(1, sizeof(struct rfc1002_session_packet), GFP_KERNEL);		if(ses_init_buf) {			ses_init_buf->trailer.session_req.called_len = 32;			rfc1002mangle(ses_init_buf->trailer.session_req.called_name,				DEFAULT_CIFS_CALLED_NAME,16);			ses_init_buf->trailer.session_req.calling_len = 32;			/* calling name ends in null (byte 16) from old smb			convention. */			if(netbios_name && (netbios_name[0] !=0)) {				rfc1002mangle(ses_init_buf->trailer.session_req.calling_name,					netbios_name,16);			} else {				rfc1002mangle(ses_init_buf->trailer.session_req.calling_name,					"LINUX_CIFS_CLNT",16);			}			ses_init_buf->trailer.session_req.scope1 = 0;			ses_init_buf->trailer.session_req.scope2 = 0;			smb_buf = (struct smb_hdr *)ses_init_buf;			/* sizeof RFC1002_SESSION_REQUEST with no scope */			smb_buf->smb_buf_length = 0x81000044;			rc = smb_send(*csocket, smb_buf, 0x44,				(struct sockaddr *)psin_server);			kfree(ses_init_buf);		}		/* else the negprot may still work without this 		even though malloc failed */			}			return rc;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/e915fc497a8da551f32b7e5fda687eb4a10bc23b/connect.c/clean/fs/cifs/connect.c