src/communication/security-server-comm.c
/* Receive check privilege request packet body (new mode)*/
Receive check privilege request packet body (new mode)
Receive check privilege request packet body ( new mode )
int recv_check_privilege_new_request(int sockfd,
                                     unsigned char *requested_cookie,
                                     char *object_label,
                                     char *access_rights)
{
	int retval;
        int olen, alen;
	retval = read(sockfd, requested_cookie, SECURITY_SERVER_COOKIE_LEN);
	if(retval < SECURITY_SERVER_COOKIE_LEN)
	{
		SEC_SVR_DBG("Received cookie size is too small: %d", retval);
		return SECURITY_SERVER_ERROR_RECV_FAILED;
	}
	retval = read(sockfd, &olen, sizeof(int));
	if(retval < sizeof(int) || olen < 0 || olen > MAX_OBJECT_LABEL_LEN)
	{
		SEC_SVR_DBG("error reading object_label len: %d", retval);
		return SECURITY_SERVER_ERROR_RECV_FAILED;
	}
	retval = read(sockfd, &alen, sizeof(int));
	if(retval < sizeof(int) || alen < 0 || olen > MAX_MODE_STR_LEN)
	{
		SEC_SVR_DBG("error reading access_rights len: %d", retval);
		return SECURITY_SERVER_ERROR_RECV_FAILED;
	}
	retval = read(sockfd, object_label, olen);
	if(retval < olen)
	{
		SEC_SVR_DBG("error reading object_label: %d", retval);
		return SECURITY_SERVER_ERROR_RECV_FAILED;
	}
        object_label[olen] = '\0';
	retval = read(sockfd, access_rights, olen);
	if(retval < alen)
	{
		SEC_SVR_DBG("error reading access_rights: %d", retval);
		return SECURITY_SERVER_ERROR_RECV_FAILED;
	}
        access_rights[alen] = '\0';
	return SECURITY_SERVER_SUCCESS;
}
int recv_check_privilege_new_request ( int sockfd , unsigned char * requested_cookie , char * object_label , char * access_rights ) { int retval ; int olen , alen ; retval = read ( sockfd , requested_cookie , SECURITY_SERVER_COOKIE_LEN ) ; if ( retval < SECURITY_SERVER_COOKIE_LEN ) { SEC_SVR_DBG ( " " , retval ) ; return SECURITY_SERVER_ERROR_RECV_FAILED ; } retval = read ( sockfd , & olen , sizeof ( int ) ) ; if ( retval < sizeof ( int ) || olen < 0 || olen > MAX_OBJECT_LABEL_LEN ) { SEC_SVR_DBG ( " " , retval ) ; return SECURITY_SERVER_ERROR_RECV_FAILED ; } retval = read ( sockfd , & alen , sizeof ( int ) ) ; if ( retval < sizeof ( int ) || alen < 0 || olen > MAX_MODE_STR_LEN ) { SEC_SVR_DBG ( " " , retval ) ; return SECURITY_SERVER_ERROR_RECV_FAILED ; } retval = read ( sockfd , object_label , olen ) ; if ( retval < olen ) { SEC_SVR_DBG ( " " , retval ) ; return SECURITY_SERVER_ERROR_RECV_FAILED ; } object_label [ olen ] = ' \0 ' ; retval = read ( sockfd , access_rights , olen ) ; if ( retval < alen ) { SEC_SVR_DBG ( " " , retval ) ; return SECURITY_SERVER_ERROR_RECV_FAILED ; } access_rights [ alen ] = ' \0 ' ; return SECURITY_SERVER_SUCCESS ; }
Receive check privilege request packet body (new mode)
Receive check privilege request packet body ( new mode )