コード例 #1
0
ファイル: generate.c プロジェクト: 2014-class/freerouter
static void
generate_process64ex_token(const char *directory, const char *token_filename,
    u_int32_t type)
{
	token_t *process64ex_token;
	char *buf;

	buf = (char *)malloc(strlen(token_filename) + 6);
	if (type == AU_IPv6) {
		inet_pton(AF_INET6, "fe80::1", process64_tid_addr.at_addr);
		process64_tid_addr.at_type = AU_IPv6;
		sprintf(buf, "%s%s", token_filename, "-IPv6");
	} else {
		process64_tid_addr.at_addr[0] = inet_addr("127.0.0.1");
		process64_tid_addr.at_type = AU_IPv4;
		sprintf(buf, "%s%s", token_filename, "-IPv4");
	}

	process64ex_token = au_to_process64_ex(process64_auid, process64_euid,
	    process64_egid, process64_ruid, process64_rgid, process64_pid,
	    process64_sid, &process64_tid_addr);
	if (process64ex_token == NULL)
		err(EX_UNAVAILABLE, "au_to_process64_ex");
	write_token(directory, buf, process64ex_token);
	free(buf);
}
コード例 #2
0
ファイル: generate.c プロジェクト: 2014-class/freerouter
static void
generate_seq_token(const char *directory, const char *token_filename)
{
	token_t *seq_token;

	seq_token = au_to_seq(seq_audit_count);
	if (seq_token == NULL)
		err(EX_UNAVAILABLE, "au_to_seq");
	write_token(directory, token_filename, seq_token);
}
コード例 #3
0
ファイル: generate.c プロジェクト: 2014-class/freerouter
static void
generate_text_token(const char *directory, const char *token_filename)
{
	token_t *text_token;

	text_token = au_to_text(text_token_text);
	if (text_token == NULL)
		err(EX_UNAVAILABLE, "au_to_text");
	write_token(directory, token_filename, text_token);
}
コード例 #4
0
ファイル: generate.c プロジェクト: 2014-class/freerouter
static void
generate_opaque_token(const char *directory, const char *token_filename)
{
	token_t *opaque_token;

	opaque_token = au_to_opaque(opaque_token_data, opaque_token_bytes);
	if (opaque_token == NULL)
		err(EX_UNAVAILABLE, "au_to_opaque");
	write_token(directory, token_filename, opaque_token);
}
コード例 #5
0
static int
assist_write_token(void *sock,
		   void *buffer,
		   size_t buffer_size)
{
    assert(sock != NULL);
    assert(buffer != NULL);
    
    return write_token(*((int *) sock), (char *) buffer, buffer_size);
}
コード例 #6
0
ファイル: generate.c プロジェクト: 2014-class/freerouter
static void
generate_path_token(const char *directory, const char *token_filename)
{
	token_t *path_token;

	path_token = au_to_path(path_token_path);
	if (path_token == NULL)
		err(EX_UNAVAILABLE, "au_to_path");
	write_token(directory, token_filename, path_token);
}
コード例 #7
0
ファイル: generate.c プロジェクト: 2014-class/freerouter
static void
generate_zonename_token(const char *directory, const char *token_filename)
{
	token_t *zonename_token;

	zonename_token = au_to_zonename(zonename_sample);
	if (zonename_token == NULL)
		err(EX_UNAVAILABLE, "au_to_zonename");
	write_token(directory, token_filename, zonename_token);
}
コード例 #8
0
ファイル: generate.c プロジェクト: 2014-class/freerouter
static void
generate_trailer_token(const char *directory, const char *token_filename)
{
	token_t *trailer_token;

	trailer_token = au_to_trailer(trailer_token_len);
	if (trailer_token == NULL)
		err(EX_UNAVAILABLE, "au_to_trailer");
	write_token(directory, token_filename, trailer_token);
}
コード例 #9
0
ファイル: generate.c プロジェクト: 2014-class/freerouter
static void
generate_ipc_token(const char *directory, const char *token_filename)
{
	token_t *ipc_token;

	ipc_token = au_to_ipc(ipc_type, ipc_id);
	if (ipc_token == NULL)
		err(EX_UNAVAILABLE, "au_to_ipc");
	write_token(directory, token_filename, ipc_token);
}
コード例 #10
0
ファイル: generate.c プロジェクト: 2014-class/freerouter
static void
generate_file_token(const char *directory, const char *token_filename)
{
	token_t *file_token;

	file_token = au_to_file("test", file_token_timeval);
	if (file_token == NULL)
		err(EX_UNAVAILABLE, "au_to_file");
	write_token(directory, token_filename, file_token);
}
コード例 #11
0
ファイル: generate.c プロジェクト: 2014-class/freerouter
static void
generate_arg32_token(const char *directory, const char *token_filename)
{
	token_t *arg32_token;

	arg32_token = au_to_arg32(arg32_token_n, arg32_token_text,
	    arg32_token_v);
	if (arg32_token == NULL)
		err(EX_UNAVAILABLE, "au_to_arg32");
	write_token(directory, token_filename, arg32_token);
}
コード例 #12
0
ファイル: generate.c プロジェクト: 2014-class/freerouter
static void
generate_return32_token(const char *directory, const char *token_filename)
{
	token_t *return32_token;

	return32_token = au_to_return32(au_errno_to_bsm(return32_status),
	    return32_ret);
	if (return32_token == NULL)
		err(EX_UNAVAILABLE, "au_to_return32");
	write_token(directory, token_filename, return32_token);
}
コード例 #13
0
ファイル: generate.c プロジェクト: 2014-class/freerouter
static void
generate_data_token(const char *directory, const char *token_filename)
{
	token_t *data_token;

	data_token = au_to_data(data_token_unit_print, data_token_unit_type,
	    data_token_unit_count, data_token_data);
	if (data_token == NULL)
		err(EX_UNAVAILABLE, "au_to_data");
	write_token(directory, token_filename, data_token);
}
コード例 #14
0
ファイル: generate.c プロジェクト: 2014-class/freerouter
static void
generate_header32_token(const char *directory, const char *token_filename)
{
	token_t *header32_token;

	header32_token = au_to_header32_tm(header32_token_len,
	    header32_e_type, header32_e_mod, header32_tm);
	if (header32_token == NULL)
		err(EX_UNAVAILABLE, "au_to_header32");
	write_token(directory, token_filename, header32_token);
}
コード例 #15
0
ファイル: su.c プロジェクト: htchoi1995/Superuser
static int socket_send_request(int fd, const struct su_context *ctx) {
#define write_data(fd, data, data_len)              \
do {                                                \
    size_t __len = htonl(data_len);                 \
    __len = write((fd), &__len, sizeof(__len));     \
    if (__len != sizeof(__len)) {                   \
        PLOGE("write(" #data ")");                  \
        return -1;                                  \
    }                                               \
    __len = write((fd), data, data_len);            \
    if (__len != data_len) {                        \
        PLOGE("write(" #data ")");                  \
        return -1;                                  \
    }                                               \
} while (0)

#define write_string(fd, name, data)        \
do {                                        \
    write_data(fd, name, strlen(name));     \
    write_data(fd, data, strlen(data));     \
} while (0)

// stringify everything.
#define write_token(fd, name, data)         \
do {                                        \
    char buf[16];                           \
    snprintf(buf, sizeof(buf), "%d", data); \
    write_string(fd, name, buf);            \
} while (0)

    write_token(fd, "version", PROTO_VERSION);
    write_token(fd, "pid", ctx->from.pid);
    write_string(fd, "from.name", ctx->from.name);
    write_string(fd, "to.name", ctx->to.name);
    write_token(fd, "from.uid", ctx->from.uid);
    write_token(fd, "to.uid", ctx->to.uid);
    write_string(fd, "from.bin", ctx->from.bin);
    write_string(fd, "command", get_command(&ctx->to));
    write_token(fd, "eof", PROTO_VERSION);
    return 0;
}
コード例 #16
0
ファイル: generate.c プロジェクト: 2014-class/freerouter
static void
generate_in_addr_token(const char *directory, const char *token_filename)
{
	token_t *in_addr_token;

	in_addr_token_addr.s_addr = inet_addr("192.168.100.15");

	in_addr_token = au_to_in_addr(&in_addr_token_addr);
	if (in_addr_token == NULL)
		err(EX_UNAVAILABLE, "au_to_in_addr");
	write_token(directory, token_filename, in_addr_token);
}
コード例 #17
0
ファイル: generate.c プロジェクト: 2014-class/freerouter
static void
generate_iport_token(const char *directory, const char *token_filename)
{
	token_t *iport_token;

	iport_token_iport = htons(80);

	iport_token = au_to_iport(iport_token_iport);
	if (iport_token == NULL)
		err(EX_UNAVAILABLE, "au_to_iport");
	write_token(directory, token_filename, iport_token);
}
コード例 #18
0
// FIXME:  change this to just printing comments, and call write_token()
//         directly from write_html() for non-comments.
void
Html_File::write_comment_split(FILE* f, CXFile file, CXToken tok) {
  unsigned line;
  unsigned column;
  unsigned offset;

  CXSourceLocation loc = clang_getTokenLocation(tu_file_->tu(), tok);
  clang_getExpansionLocation(loc, &file, &line, &column, &offset);

  CXTokenKind kind = clang_getTokenKind(tok);
  CXString s = clang_getTokenSpelling(tu_file_->tu(), tok);

  std::string sub = clang_getCString(s);
  clang_disposeString(s);

  // actually split up multi-line comments and send one at
  // a time -- that way each line gets line numbers.
  if (kind == CXToken_Comment || kind == CXToken_Literal) {
    std::string str = sub.c_str();
    if (kind == CXToken_Comment)
      str = fix(sub.c_str());
    size_t i;
    size_t begin = 0;
    for (i = 0; i < str.length(); ++i) {
      if (str[i] == '\n') {
        sub = str.substr(begin, i-begin);
        if (begin)
          line++; column = 1;
        begin = i + 1;
        write_token(f, file, tok, sub.c_str(), line, column);
      }
    }
    if (begin) {
      line++;
      column = 1;
    }
    sub = str.substr(begin, i-begin);
  }
  write_token(f, file, tok, sub.c_str(), line, column);
}
コード例 #19
0
ファイル: generate.c プロジェクト: 2014-class/freerouter
static void
generate_subject32_token(const char *directory, const char *token_filename)
{
	token_t *subject32_token;

	subject32_tid.machine = inet_addr("127.0.0.1");

	subject32_token = au_to_subject32(subject32_auid, subject32_euid,
	    subject32_egid, subject32_ruid, subject32_rgid, subject32_pid,
	    subject32_sid, &subject32_tid);
	if (subject32_token == NULL)
		err(EX_UNAVAILABLE, "au_to_subject32");
	write_token(directory, token_filename, subject32_token);
}
コード例 #20
0
ファイル: generate.c プロジェクト: 2014-class/freerouter
static void
generate_process64_token(const char *directory, const char *token_filename)
{
	token_t *process64_token;

	process64_tid.machine = inet_addr("127.0.0.1");

	process64_token = au_to_process64(process64_auid, process64_euid,
	    process64_egid, process64_ruid, process64_rgid, process64_pid,
	    process64_sid, &process64_tid);
	if (process64_token == NULL)
		err(EX_UNAVAILABLE, "au_to_process64");
	write_token(directory, token_filename, process64_token);
}
コード例 #21
0
ファイル: cfgopts.c プロジェクト: denizt/hatari
/**
 * Write given section header and tokens for that
 * Return number of written tokens
 */
static int write_header_tokens(FILE *fp, const struct Config_Tag *ptr, const char *header)
{
	int count = 0;

	if (header != NULL)
	{
		fprintf(fp, "%s\n", header);
	}

	for (; ptr->buf; ++ptr)        /* scan for token */
	{
		if (write_token(fp, ptr) == 0)
			++count;
	}

	fprintf(fp, "\n");

	return count;
}
コード例 #22
0
ファイル: generate.c プロジェクト: 2014-class/freerouter
static void
generate_ip_token(const char *directory, const char *token_filename)
{
	token_t *ip_token;

	ip_token_ip_src.s_addr = inet_addr("192.168.100.155");
	ip_token_ip_dst.s_addr = inet_addr("192.168.110.48");

	memset(&ip_token_ip, 0, sizeof(ip_token_ip));
	ip_token_ip.ip_v = ip_token_ip_v;
	ip_token_ip.ip_len = htons(sizeof(ip_token_ip));
	ip_token_ip.ip_id = htons(ip_token_ip_id);
	ip_token_ip.ip_ttl = ip_token_ip_ttl;
	ip_token_ip.ip_p = ip_token_ip_p;
	ip_token_ip.ip_src = ip_token_ip_src;
	ip_token_ip.ip_dst = ip_token_ip_dst;

	ip_token = au_to_ip(&ip_token_ip);
	if (ip_token == NULL)
		err(EX_UNAVAILABLE, "au_to_ip");
	write_token(directory, token_filename, ip_token);
}
コード例 #23
0
ファイル: su.c プロジェクト: phhusson/Superuser
static int socket_send_request(int fd, const struct su_context *ctx) {
    write_token(fd, "version", PROTO_VERSION);
    write_token(fd, "binary.version", VERSION_CODE);
    write_token(fd, "pid", ctx->from.pid);
    write_string_data(fd, "from.name", ctx->from.name);
    write_string_data(fd, "to.name", ctx->to.name);
    write_token(fd, "from.uid", ctx->from.uid);
    write_token(fd, "to.uid", ctx->to.uid);
    write_string_data(fd, "from.bin", ctx->from.bin);
    write_string_data(fd, "bind.from", ctx->bind.from);
    write_string_data(fd, "bind.to", ctx->bind.to);
    write_string_data(fd, "init", ctx->init);
    // TODO: Fix issue where not using -c does not result a in a command
    write_string_data(fd, "command", get_command(&ctx->to));
    write_token(fd, "eof", PROTO_VERSION);
    return 0;
}
コード例 #24
0
ファイル: compiler.c プロジェクト: bburky/compilers
/*
 * Read the next token and match it to all machines
 * Run each machine in sequence and return a lexical error if unmatched
 */
token get_next_token() {
    token (*machines[])() = { misc_machine, idres_machine, relop_machine, longreal_machine, real_machine, int_machine };
    int current_machine;
    token matched_token;

    /* if first line or end of current line */
    if (fptr == NULL || *fptr == '\0') {
        if (!get_next_line()) {
            return (token){ .lexeme = NULL, .type = EOF_TYPE, .attr.ptr = NULL };
        }
        fptr = line;
        bptr = line;
    }

    /* call each machine in order */
    for (current_machine = 0; current_machine < sizeof(machines)/sizeof(*machines); current_machine++) {
        matched_token = machines[current_machine]();
        if (matched_token.type == WHITESPACE_TYPE) {
            /* Don't even return whitespace tokens */
            return get_next_token();
        } else if (matched_token.type != NONE_TYPE) {
            if (matched_token.type == LEXERR_TYPE) {
                write_listing_lexerr(lineno, matched_token);
            }
            write_token(lineno, matched_token);
            return matched_token;
        }
    }

    /* lexical error: Unrecognized symbol */
    fptr++;
    matched_token.type = LEXERR_TYPE;
    matched_token.attr.errtype = LEX_ERR_UNRECOGNIZED_SYMBOL;
    matched_token.lexeme = extract_lexeme(fptr, bptr);
    bptr = fptr;
    write_listing_lexerr(lineno, matched_token);
    return matched_token;
}
コード例 #25
0
ファイル: generate.c プロジェクト: 2014-class/freerouter
static void
generate_socketex_token(const char *directory, const char *token_filename)
{
	token_t *socketex_token;

	bzero(&socketex_laddr, sizeof(socketex_laddr));
	socketex_laddr.sin_family = AF_INET;
	socketex_laddr.sin_len = sizeof(socketex_laddr);
	socketex_laddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);

	bzero(&socketex_raddr, sizeof(socketex_raddr));
	socketex_raddr.sin_family = AF_INET;
	socketex_raddr.sin_len = sizeof(socketex_raddr);
	socketex_raddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);

	socketex_token = au_to_socket_ex(au_domain_to_bsm(socketex_domain),
	    au_socket_type_to_bsm(socketex_type),
	    (struct sockaddr *)&socketex_laddr,
	    (struct sockaddr *)&socketex_raddr);
	if (socketex_token == NULL)
		err(EX_UNAVAILABLE, "au_to_socket_ex");
	write_token(directory, token_filename, socketex_token);
}
コード例 #26
0
ファイル: su.c プロジェクト: Wonfee/su-binary
static int socket_send_request(int fd, const struct su_context *ctx)
{
    size_t len;
    size_t bin_size, cmd_size;
    char *cmd;

#define write_token(fd, data)				\
do {							\
	uint32_t __data = htonl(data);			\
	size_t __count = sizeof(__data);		\
	size_t __len = write((fd), &__data, __count);	\
	if (__len != __count) {				\
		PLOGE("write(" #data ")");		\
		return -1;				\
	}						\
} while (0)

    write_token(fd, PROTO_VERSION);
    write_token(fd, PATH_MAX);
    write_token(fd, ARG_MAX);
    write_token(fd, ctx->from.uid);
    write_token(fd, ctx->to.uid);
    bin_size = strlen(ctx->from.bin) + 1;
    write_token(fd, bin_size);
    len = write(fd, ctx->from.bin, bin_size);
    if (len != bin_size) {
        PLOGE("write(bin)");
        return -1;
    }
    cmd = get_command(&ctx->to);
    cmd_size = strlen(cmd) + 1;
    write_token(fd, cmd_size);
    len = write(fd, cmd, cmd_size);
    if (len != cmd_size) {
        PLOGE("write(cmd)");
        return -1;
    }
    return 0;
}
コード例 #27
0
ファイル: NFA.c プロジェクト: manavs19/compiler-design
int main()
{
	int i, LB;
	FILE * fp1,* fp2;
	char PATTERN[100];
	char REGEX[100];	
	char * POSTFIX;
	
	fp1 = fopen("regexp.in", "r");
	if(fp1==NULL)
	{
		printf("Could not open regexp.in!!");
		exit(0);
	}
	
	while(!feof(fp1))
	{
		fscanf(fp1, "%s %s",PATTERN, REGEX);
		if(strlen(REGEX)==1 || (strlen(REGEX)==2 && REGEX[1]=='*'))
		{
			buildIndividualNFA(PATTERN, REGEX);
			continue;
		}
		else if(strlen(REGEX)==2 && REGEX[1]!='*')
		{
			REGEX[2]='&';
			REGEX[3]='\0';
			buildIndividualNFA(PATTERN, REGEX);
			continue;
		}
		POSTFIX = conversion(REGEX);
		buildIndividualNFA(PATTERN, POSTFIX);			
	}
	fclose(fp1);	
	buildCombinedNFA();
	
	char input[1000];
	char tokenread[100];	
	
	initialize_Symbol_Table();
	remove("a4_2.out");
	
	while(gets(input))
	{
		int lexemeBegin = 0;
		
		while(input[lexemeBegin]!='\0'&&input[lexemeBegin]!='\n' &&input[lexemeBegin]!='\r')  //while end of line is not found
		{			
			while(input[lexemeBegin]==' ' || input[lexemeBegin]=='\t')
				lexemeBegin++;
										
			lexemeBegin = comment(input, lexemeBegin);
			if(input[lexemeBegin] == '\0' || input[lexemeBegin]=='\n'||input[lexemeBegin]=='\r')
				break;
				
			STATE_AND_FORWARD final = simulateNFA(input, HEAD, lexemeBegin);
			i = final.forward - lexemeBegin+1;
			memcpy(tokenread, input+lexemeBegin, i);
			tokenread[i] = '\0';
			
			token t;//Token			
			attrType a;//attribute field
			a.string = (char *)malloc((i+1)*sizeof(char));
							
			int tokenID = getTokenID(final.state);
			if(tokenID == IDNTIFIER)
			{
				strcpy(a.string, tokenread);
				int flag = 0;
	
				int j;
				for(j=0;j<24;j++)
				{
					if(strcmp(a.string,keywordArr[j].keyword)==0)    //checking if string detected is a keyword
					{
						t.tokenID = keywordArr[j].tokenID;
						t.attribute.string = '\0';
						flag = 1;
						break;
					}
				}
				
				if(flag==0)   //not a keyword; is an identifier
				{
					t.tokenID = IDNTIFIER;		
					fp1 = fopen("symbol_table_2.out","r");		
					int nflag = 0;
		
					char identifier[100];
					int marker;
					while(!feof(fp1))
					{
						fscanf(fp1,"%s %d",identifier,&marker);
			
						if(strcmp(identifier,a.string)==0)           //if identifer is already present in symbol table
						{
							nflag = 1;
							break;
						}
					}
					fclose(fp1);
		
					if(nflag==0)               //identifier not present in symbol table
					{
						fp1 = fopen("symbol_table_2.out","a");
						fprintf(fp1,"%s 1\n",a.string);
						fclose(fp1);
					}
					t.attribute = a;
				}	
			}
			else if(tokenID == INT_CONST)
			{
				a.integer = atoi(tokenread);
				t.tokenID = INT_CONST;
				t.attribute = a;
			}
			else if(tokenID == FLO_CONST)
			{
				a.integer = atof(tokenread);
				t.tokenID = FLO_CONST;
				t.attribute = a;
			}
			else if(tokenID!=NOTOK)
			{
				t.tokenID = tokenID;
				t.attribute.string = '\0';
			}
			
			if(tokenID != NOTOK)
			write_token(t);
			else
			{
				lexemeBegin++;
				continue;
			}
			
			lexemeBegin = final.forward+1;			
		}
	}		
}
コード例 #28
0
ファイル: initcard.c プロジェクト: 12019/pam_iccard
int main(int argc, char **argv)
{
    token tok;
    
    setlocale(LC_ALL, "");
    bindtextdomain("pam_iccard", ".");
    textdomain("pam_iccard");

    if(argc > 1 && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))) {
        printf(
            _("Tool for initialize card, for pam_iccard\n"
              "Usage: initcard\n")
        );
        return 0;
    }
    
    if(!parse_file("/etc/pam_iccard.conf", 0)) {
        printf(_("Error reading conf file: %s\n"), card_strerror());
        return 0;
    }

    if(!read_token(&tok)) {
        printf(_("Read card failed: %s\n"), card_strerror());
        goto hell;
    }

    if(tok.magic == MAGIC) {
        char c ;
        struct termios t1, t2;

        printf(
            _("It seems that this card has already been initialized,\n"
              "reinitializing will cause auth failure if the card already registered.\n")
        );
        
        tcgetattr(STDIN_FILENO, &t1);
        t2 = t1;
        t2.c_lflag &= ~(ICANON | ECHO);
        tcsetattr(STDIN_FILENO, TCSANOW, &t2);
        do {
            printf(_("Are you sure?(Y/N)"));
            //fgets(str, sizeof(str), stdin);
            c=tolower(getchar());
            printf("\n");
        } while(!(c == 'y' || c == 'n'));
        tcsetattr(STDIN_FILENO, TCSANOW, &t1);

        if(c == 'n')
            goto hell;
    }

    tok.magic = MAGIC;
    tok.magic1 = MAGIC;
    (void) get_rand_bytes(&tok.id, sizeof(tok.id) + sizeof(tok.token));

    {
        char pin[100];
        struct termios t1, t2;
        
        tcgetattr(STDIN_FILENO, &t1);
        t2 = t1;
        t2.c_lflag &= ~ECHO;
        tcsetattr(STDIN_FILENO, TCSANOW, &t2);
        printf(_("Enter your PIN: "));
        memset(pin, 0, sizeof(pin));
        fgets(pin, 100, stdin);
        pin[strlen(pin)-1] = 0;
        if(pin[0]) {
            aes_encrypt(&tok.magic1, sizeof(tok) - sizeof(tok.magic), &tok.magic1, pin);
        }
        printf("\n");
        tcsetattr(STDIN_FILENO, TCSANOW, &t1);
    }

    
    if(!write_token(&tok)) {
        printf(_("Write card failed: %s\n"), card_strerror());
        goto hell;
    }

    printf(_("Card initialized.\n"));

    hell:
    return 0;
}
コード例 #29
0
void main(){

FILE *infile,*outfile;
char currch,nextch,ch[100],*chp;
staggered_list *listpointer,*root=create_list_with_file("B:keywords");
SYMTAB_ENTRY **symtab=create_symbol_table_array(100);
int dat,length_of;
TOKEN *token,t;
NODE *node;


                int g2_001_DATA_STUFFSUB_A;
                int g3_001_REST_SUBTREE_A;
                int g4_001_SINGLE_SUBTREE_A;
                int g5_001_DOUBLE_SUBTREE_A;
                int g6_001_WORD_SUBTREE_A;
      /**************************************************************************/
      /**************************************************************************/
      /******************** DRIVING PROCEDURE    B:\OPSANYL *********************/
      /**************************************************************************/
       PROCEDURE_DIVISION:
      /**/
      /** The ops analyser takes the .ops file*/
      /** and tokenises it for processing by*/
      /** the ops builder*/
      /**/
       C1_001_OPS_ANALYSER:
           goto C1_002_OPS_START;
       C1_002_OPS_START_EX:
           goto C1_003_OPS;
       C1_003_OPS_EX:
           goto C1_015_OPS_END;
       C1_015_OPS_END_EX:
           goto veryend;
      /**/
       C1_002_OPS_START:
  /*028*/      token=&t;
  /*001*/      infile=open_input("b:altest.ops");
  /*003*/      outfile=open_output("b:opsout.dat");
  /*008*/      load_symtab(symtab,"b:symtable.out");
           cross_reference(symtab,100);
  /*005*/      currch=getc(infile);
           if(currch!=EOF) nextch=getc(infile);
           goto C1_002_OPS_START_EX;
      /**/
       C1_003_OPS:
       C1_004_OP_GROUP_EX:
           if(!(
  /*C01*/         (currch==EOF)
))
                   goto C1_004_OP_GROUP;
           goto C1_003_OPS_EX;
      /**/
       C1_004_OP_GROUP:
           goto C1_005_OP_NUM_REC;
       C1_005_OP_NUM_REC_EX:
           goto C1_014_REST_SUBTREE;
       C1_014_REST_SUBTREE_EX:
           goto C1_004_OP_GROUP_EX;
      /**/
      /** an op consists of the op number*/
      /** followed by the rest of it*/
      /**/
       C1_005_OP_NUM_REC:
           goto C1_006_OP_NUM;
       C1_006_OP_NUM_EX:
           goto C1_011_DATA;
       C1_011_DATA_EX:
           goto C1_005_OP_NUM_REC_EX;
      /**/
       C1_006_OP_NUM:
           goto C1_007_OP_NUM_START;
       C1_007_OP_NUM_START_EX:
           goto C1_008_OP_NUM_BODY;
       C1_008_OP_NUM_BODY_EX:
           goto C1_010_OP_NUM_END;
       C1_010_OP_NUM_END_EX:
           goto C1_006_OP_NUM_EX;
      /**/
       C1_007_OP_NUM_START:
  /*007*/      chp=ch;
  /*021*/      *chp=currch;
  /*020*/      chp++;
  /*019*/      *chp='\0';
  /*006*/      currch=nextch;
           if(nextch!=EOF) nextch=getc(infile);
           goto C1_007_OP_NUM_START_EX;
      /**/
       C1_008_OP_NUM_BODY:
       C1_009_OP_NUM_NUMBER_EX:
           if(!(
  /*C02*/         (currch==' ')
))
                   goto C1_009_OP_NUM_NUMBER;
           goto C1_008_OP_NUM_BODY_EX;
      /**/
       C1_009_OP_NUM_NUMBER:
  /*021*/      *chp=currch;
  /*020*/      chp++;
  /*019*/      *chp='\0';
  /*006*/      currch=nextch;
           if(nextch!=EOF) nextch=getc(infile);
           goto C1_009_OP_NUM_NUMBER_EX;
      /**/
       C1_010_OP_NUM_END:
  /*018*/      dat=str_to_int(ch);
  /*022*/      token->token_type=OP_NUM;token->value.keyword_number=dat;
  /*012*/      write_token(outfile,token);
           goto C1_010_OP_NUM_END_EX;
      /**/
       C1_011_DATA:
       C1_012_DATA_GROUP_EX:
           if(!(
  /*C03*/         (currch==EOF || currch=='\n')
))
                   goto C1_012_DATA_GROUP;
           goto C1_011_DATA_EX;
      /**/
       C1_012_DATA_GROUP:
           goto C1_013_DATA_STUFFSUB;
       C1_013_DATA_STUFFSUB_EX:
           goto C1_012_DATA_GROUP_EX;
      /**/
       C1_013_DATA_STUFFSUB:
                g2_001_DATA_STUFFSUB_A=0;
           goto C2_001_DATA_STUFFSUB;
       C2_001_EXIT01:
           goto C1_013_DATA_STUFFSUB_EX;
      /**/
       C1_014_REST_SUBTREE:
                g3_001_REST_SUBTREE_A=0;
           goto C3_001_REST_SUBTREE;
       C3_001_EXIT01:
           goto C1_014_REST_SUBTREE_EX;
      /**/
       C1_015_OPS_END:
  /*002*/      close_file(infile);
  /*004*/      close_file(outfile);
           goto C1_015_OPS_END_EX;
      /**/
       C2_001_DATA_STUFFSUB:
           goto C2_002_BLANKS;
       C2_002_BLANKS_EX:
           goto C2_004_DATA;
       C2_004_DATA_EX:
       C2_001_DATA_STUFFSUB_A:
                switch(g2_001_DATA_STUFFSUB_A){
                case 0 : goto C2_001_EXIT01;break;
                case 1 : goto C2_001_EXIT03;break;
                }
      /**/
       C2_002_BLANKS:
       C2_003_BLANK_EX:
           if(!(
  /*C04*/         (currch!=' ')
))
                   goto C2_003_BLANK;
           goto C2_002_BLANKS_EX;
      /**/
       C2_003_BLANK:
  /*006*/      currch=nextch;
           if(nextch!=EOF) nextch=getc(infile);
           goto C2_003_BLANK_EX;
      /**/
       C2_004_DATA:
           if((
  /*C05*/         (currch=='"' || currch=='\'')
))
                   goto C2_005_NON_NUM_LITERAL;
           if((
  /*C06*/         (currch=='.')
))
                   goto C2_010_FULLSTOP;
           if((
  /*C07*/         (currch!='"' &&
               currch!='\'' &&
               currch!='.' &&
               currch!='\n')
))
                   goto C2_012_WORD;
       C2_005_NON_NUM_LITERAL_EX:
       C2_010_FULLSTOP_EX:
       C2_012_WORD_EX:
           goto C2_004_DATA_EX;
      /**/
       C2_005_NON_NUM_LITERAL:
           if((
  /*C08*/         (currch=='\'')
))
                   goto C2_006_SINGLE;
           if((
  /*C09*/         (currch=='"')
))
                   goto C2_008_DOUBLE;
       C2_006_SINGLE_EX:
       C2_008_DOUBLE_EX:
           goto C2_005_NON_NUM_LITERAL_EX;
      /**/
       C2_006_SINGLE:
           goto C2_007_SINGLE_SUBTREE;
       C2_007_SINGLE_SUBTREE_EX:
           goto C2_006_SINGLE_EX;
      /**/
       C2_007_SINGLE_SUBTREE:
                g4_001_SINGLE_SUBTREE_A=0;
           goto C4_001_SINGLE_SUBTREE;
       C4_001_EXIT01:
           goto C2_007_SINGLE_SUBTREE_EX;
      /**/
       C2_008_DOUBLE:
           goto C2_009_DOUBLE_SUBTREE;
       C2_009_DOUBLE_SUBTREE_EX:
           goto C2_008_DOUBLE_EX;
      /**/
       C2_009_DOUBLE_SUBTREE:
                g5_001_DOUBLE_SUBTREE_A=0;
           goto C5_001_DOUBLE_SUBTREE;
       C5_001_EXIT01:
           goto C2_009_DOUBLE_SUBTREE_EX;
      /**/
       C2_010_FULLSTOP:
           goto C2_011_PERIOD;
       C2_011_PERIOD_EX:
           goto C2_010_FULLSTOP_EX;
      /**/
       C2_011_PERIOD:
  /*013*/      token->token_type=FULLSTOP;token->value.keyword_number=FULLSTOP;
  /*012*/      write_token(outfile,token);
  /*006*/      currch=nextch;
           if(nextch!=EOF) nextch=getc(infile);
           goto C2_011_PERIOD_EX;
      /**/
       C2_012_WORD:
           goto C2_013_WORD_SUBTREE;
       C2_013_WORD_SUBTREE_EX:
           goto C2_012_WORD_EX;
      /**/
       C2_013_WORD_SUBTREE:
                g6_001_WORD_SUBTREE_A=0;
           goto C6_001_WORD_SUBTREE;
       C6_001_EXIT01:
           goto C2_013_WORD_SUBTREE_EX;
      /**/
       C6_001_WORD_SUBTREE:
           goto C6_002_WORD_START;
       C6_002_WORD_START_EX:
           goto C6_003_WORD_BODY;
       C6_003_WORD_BODY_EX:
       C6_001_WORD_SUBTREE_A:
                switch(g6_001_WORD_SUBTREE_A){
                case 0 : goto C6_001_EXIT01;break;
                }
      /**/
       C6_002_WORD_START:
  /*007*/      chp=ch;
  /*019*/      *chp='\0';
           goto C6_002_WORD_START_EX;
      /**/
       C6_003_WORD_BODY:
           goto C6_004_KEYWORD;
       C6_004_KEYWORD_EX:
       C6_009_NON_KEYWOR_D_EX:
           goto C6_003_WORD_BODY_EX;
      /**/
       C6_004_KEYWORD:
           goto C6_005_KEYWORD_START;
       C6_005_KEYWORD_START_EX:
           goto C6_006_KEYWORD_BODY;
       C6_006_KEYWORD_BODY_EX:
           goto C6_008_KEYWORD_END;
       C6_008_KEYWORD_END_EX:
           goto C6_004_KEYWORD_EX;
      /**/
       C6_005_KEYWORD_START:
  /*009*/      listpointer=root;
  /*021*/      *chp=currch;
  /*020*/      chp++;
  /*019*/      *chp='\0';
  /*010*/      listpointer=check_pointer(listpointer,currch);
           if((
  /*Q01*/         (!isupper(currch)) && currch!='-'
))
                   goto C6_009_NON_KEYWOR_D;
           if((
  /*Q02*/         listpointer==NULL
))
                   goto C6_009_NON_KEYWOR_D;
  /*006*/      currch=nextch;
           if(nextch!=EOF) nextch=getc(infile);
           goto C6_005_KEYWORD_START_EX;
      /**/
       C6_006_KEYWORD_BODY:
       C6_007_KEYWORD_CHAR_EX:
           if(!(
  /*C10*/         (currch==' ' || currch=='\n' ||
               currch=='.' || currch==EOF)
))
                   goto C6_007_KEYWORD_CHAR;
           goto C6_006_KEYWORD_BODY_EX;
      /**/
       C6_007_KEYWORD_CHAR:
  /*021*/      *chp=currch;
  /*020*/      chp++;
  /*019*/      *chp='\0';
  /*010*/      listpointer=check_pointer(listpointer,currch);
           if((
  /*Q01*/         (!isupper(currch)) && currch!='-'
))
                   goto C6_009_NON_KEYWOR_D;
           if((
  /*Q02*/         listpointer==NULL
))
                   goto C6_009_NON_KEYWOR_D;
  /*006*/      currch=nextch;
           if(nextch!=EOF) nextch=getc(infile);
           goto C6_007_KEYWORD_CHAR_EX;
      /**/
       C6_008_KEYWORD_END:
  /*011*/      dat=get_data(listpointer);
           if((
  /*Q03*/         dat==NULL
))
                   goto C6_009_NON_KEYWOR_D;
  /*014*/      token->token_type=KEYWORD;token->value.keyword_number=dat;
  /*012*/      write_token(outfile,token);
           goto C6_008_KEYWORD_END_EX;
      /**/
       C6_009_NON_KEYWOR_D:
           goto C6_010_CHARS;
       C6_010_CHARS_EX:
           goto C6_015_CHOICE;
       C6_015_CHOICE_EX:
           goto C6_009_NON_KEYWOR_D_EX;
      /**/
       C6_010_CHARS:
           goto C6_011_CHARS_START;
       C6_011_CHARS_START_EX:
           goto C6_012_CHARS_BODY;
       C6_012_CHARS_BODY_EX:
           goto C6_014_CHARS_END;
       C6_014_CHARS_END_EX:
           goto C6_010_CHARS_EX;
      /**/
       C6_011_CHARS_START:
  /*006*/      currch=nextch;
           if(nextch!=EOF) nextch=getc(infile);
           goto C6_011_CHARS_START_EX;
      /**/
       C6_012_CHARS_BODY:
       C6_013_CHAR_EX:
           if(!(
  /*C10*/         (currch==' ' || currch=='\n' ||
               currch=='.' || currch==EOF)
))
                   goto C6_013_CHAR;
           goto C6_012_CHARS_BODY_EX;
      /**/
       C6_013_CHAR:
  /*021*/      *chp=currch;
  /*020*/      chp++;
  /*019*/      *chp='\0';
  /*006*/      currch=nextch;
           if(nextch!=EOF) nextch=getc(infile);
           goto C6_013_CHAR_EX;
      /**/
       C6_014_CHARS_END:
  /*027*/      node=look_for_by_name(ch,symtab);
           goto C6_014_CHARS_END_EX;
      /**/
       C6_015_CHOICE:
           if((
  /*C11*/         (node==NULL && isdigit(ch[0]))
))
                   goto C6_016_POSSIBLE_NUMBER;
           if((
  /*C18*/         (node!=NULL)
))
                   goto C6_018_VARIABLE;
       C6_016_POSSIBLE_NUMBER_EX:
       C6_018_VARIABLE_EX:
           goto C6_015_CHOICE_EX;
      /**/
       C6_016_POSSIBLE_NUMBER:
           goto C6_017_NUMBER;
       C6_017_NUMBER_EX:
           goto C6_016_POSSIBLE_NUMBER_EX;
      /**/
       C6_017_NUMBER:
  /*018*/      dat=str_to_int(ch);
  /*024*/      token->token_type=NUMERIC;token->value.keyword_number=dat;
  /*012*/      write_token(outfile,token);
           goto C6_017_NUMBER_EX;
      /**/
       C6_018_VARIABLE:
           goto C6_019_VAR_START;
       C6_019_VAR_START_EX:
           goto C6_018_VARIABLE_EX;
      /**/
       C6_019_VAR_START:
  /*023*/      token->token_type=VARIABLE_NAME;token->value.var_values.hash=node->own.hash;
           token->value.var_values.unique=node->own.unique;
  /*012*/      write_token(outfile,token);
           goto C6_019_VAR_START_EX;
      /**/
       C3_001_REST_SUBTREE:
           goto C3_002_REST_OF_GROUP;
       C3_002_REST_OF_GROUP_EX:
       C3_001_REST_SUBTREE_A:
                switch(g3_001_REST_SUBTREE_A){
                case 0 : goto C3_001_EXIT01;break;
                }
      /**/
       C3_002_REST_OF_GROUP:
       C3_003_DATA_GROUP_EX:
           if(!(
  /*C12*/         (currch==EOF || isdigit(currch))
))
                   goto C3_003_DATA_GROUP;
           goto C3_002_REST_OF_GROUP_EX;
      /**/
       C3_003_DATA_GROUP:
           goto C3_004_DATA;
       C3_004_DATA_EX:
           goto C3_007_DATA_END;
       C3_007_DATA_END_EX:
           goto C3_003_DATA_GROUP_EX;
      /**/
       C3_004_DATA:
       C3_005_LINE_EX:
           if(!(
  /*C13*/         (currch=='\n' || currch==EOF)
))
                   goto C3_005_LINE;
           goto C3_004_DATA_EX;
      /**/
       C3_005_LINE:
           goto C3_006_DATA_STUFFSUB;
       C3_006_DATA_STUFFSUB_EX:
           goto C3_005_LINE_EX;
      /**/
       C3_006_DATA_STUFFSUB:
                g2_001_DATA_STUFFSUB_A=1;
           goto C2_001_DATA_STUFFSUB;
       C2_001_EXIT03:
           goto C3_006_DATA_STUFFSUB_EX;
      /**/
       C3_007_DATA_END:
  /*006*/      currch=nextch;
           if(nextch!=EOF) nextch=getc(infile);
           goto C3_007_DATA_END_EX;
      /**/
       C4_001_SINGLE_SUBTREE:
           goto C4_002__START;
       C4_002__START_EX:
           goto C4_003__BODY;
       C4_003__BODY_EX:
           goto C4_007__END;
       C4_007__END_EX:
       C4_001_SINGLE_SUBTREE_A:
                switch(g4_001_SINGLE_SUBTREE_A){
                case 0 : goto C4_001_EXIT01;break;
                }
      /**/
       C4_002__START:
  /*007*/      chp=ch;
  /*019*/      *chp='\0';
  /*025*/      length_of=0;
  /*006*/      currch=nextch;
           if(nextch!=EOF) nextch=getc(infile);
           goto C4_002__START_EX;
      /**/
       C4_003__BODY:
       C4_004_CHAR_EX:
           if(!(
  /*C16*/         (currch=='\'' && nextch!='\'')
))
                   goto C4_004_CHAR;
           goto C4_003__BODY_EX;
      /**/
       C4_004_CHAR:
           if((
  /*C14*/         (currch=='\'' && nextch=='\'')
))
                   goto C4_005_QUOTE_QUOTE;
           if(!(
  /*C14*/         (currch=='\'' && nextch=='\'')
))
                   goto C4_006_ANY;
       C4_005_QUOTE_QUOTE_EX:
       C4_006_ANY_EX:
           goto C4_004_CHAR_EX;
      /**/
       C4_005_QUOTE_QUOTE:
  /*026*/      length_of++;
  /*021*/      *chp=currch;
  /*020*/      chp++;
  /*019*/      *chp='\0';
  /*006*/      currch=nextch;
           if(nextch!=EOF) nextch=getc(infile);
  /*006*/      currch=nextch;
           if(nextch!=EOF) nextch=getc(infile);
           goto C4_005_QUOTE_QUOTE_EX;
      /**/
       C4_006_ANY:
  /*026*/      length_of++;
  /*021*/      *chp=currch;
  /*020*/      chp++;
  /*019*/      *chp='\0';
  /*006*/      currch=nextch;
           if(nextch!=EOF) nextch=getc(infile);
           goto C4_006_ANY_EX;
      /**/
       C4_007__END:
  /*017*/      token->token_type=NON_NUMERIC_LITERAL_LENGTH;token->value.keyword_number=
                                                                           length_of;
  /*012*/      write_token(outfile,token);
  /*016*/      token->token_type=NON_NUMERIC_LITERAL;token->value.string=ch;
  /*012*/      write_token(outfile,token);
  /*006*/      currch=nextch;
           if(nextch!=EOF) nextch=getc(infile);
           goto C4_007__END_EX;
      /**/
       C5_001_DOUBLE_SUBTREE:
           goto C5_002__START;
       C5_002__START_EX:
           goto C5_003__BODY;
       C5_003__BODY_EX:
           goto C5_007__END;
       C5_007__END_EX:
       C5_001_DOUBLE_SUBTREE_A:
                switch(g5_001_DOUBLE_SUBTREE_A){
                case 0 : goto C5_001_EXIT01;break;
                }
      /**/
       C5_002__START:
  /*007*/      chp=ch;
  /*019*/      *chp='\0';
  /*025*/      length_of=0;
  /*006*/      currch=nextch;
           if(nextch!=EOF) nextch=getc(infile);
           goto C5_002__START_EX;
      /**/
       C5_003__BODY:
       C5_004_CHAR_EX:
           if(!(
  /*C17*/         (currch=='"' && nextch!='"')
))
                   goto C5_004_CHAR;
           goto C5_003__BODY_EX;
      /**/
       C5_004_CHAR:
           if((
  /*C15*/         (currch=='"' && nextch=='"')
))
                   goto C5_005_QUOTE_QUOTE;
           if(!(
  /*C15*/         (currch=='"' && nextch=='"')
))
                   goto C5_006_ANY;
       C5_005_QUOTE_QUOTE_EX:
       C5_006_ANY_EX:
           goto C5_004_CHAR_EX;
      /**/
       C5_005_QUOTE_QUOTE:
  /*026*/      length_of++;
  /*021*/      *chp=currch;
  /*020*/      chp++;
  /*019*/      *chp='\0';
  /*006*/      currch=nextch;
           if(nextch!=EOF) nextch=getc(infile);
  /*006*/      currch=nextch;
           if(nextch!=EOF) nextch=getc(infile);
           goto C5_005_QUOTE_QUOTE_EX;
      /**/
       C5_006_ANY:
  /*026*/      length_of++;
  /*021*/      *chp=currch;
  /*020*/      chp++;
  /*019*/      *chp='\0';
  /*006*/      currch=nextch;
           if(nextch!=EOF) nextch=getc(infile);
           goto C5_006_ANY_EX;
      /**/
       C5_007__END:
  /*017*/      token->token_type=NON_NUMERIC_LITERAL_LENGTH;token->value.keyword_number=
                                                                           length_of;
  /*012*/      write_token(outfile,token);
  /*016*/      token->token_type=NON_NUMERIC_LITERAL;token->value.string=ch;
  /*012*/      write_token(outfile,token);
  /*006*/      currch=nextch;
           if(nextch!=EOF) nextch=getc(infile);
           goto C5_007__END_EX;
      /**/
      /*   Data Analysis Map*/
      /**/
      /*                         ------------- Data Analysis By -------------*/
      /**/
      /*                         BOX TYPE               OPERATION  ALLOCATION*/
      /*  Tree name: OPS-ANALYSER*/
      /**/
      /*                         Leaf      :   5          Operations:  19*/
      /*                                                  Quits     :   0*/
      /*                         Selections:   0*/
      /*                         Sequences :   5*/
      /*                         Iterations:   3*/
      /*                         Backtracks:   0*/
      /*                         Subtrees  :   2   -->    DATA-STUFFSUB*/
      /*                                                  REST-SUBTREE*/
      /**/
      /*  Tree name: DATA-STUFFSUB*/
      /**/
      /*                         Leaf      :   2          Operations:   4*/
      /*                                                  Quits     :   0*/
      /*                         Selections:   2*/
      /*                         Sequences :   5*/
      /*                         Iterations:   1*/
      /*                         Backtracks:   0*/
      /*                         Subtrees  :   3   -->    SINGLE-SUBTREE*/
      /*                                                  DOUBLE-SUBTREE*/
      /*                                                  WORD-SUBTREE*/
      /**/
      /*  Tree name: WORD-SUBTREE*/
      /**/
      /*                         Leaf      :   9          Operations:  27*/
      /*                                                  Quits     :   5*/
      /*                         Selections:   1*/
      /*                         Sequences :   6*/
      /*                         Iterations:   2*/
      /*                         Backtracks:   1*/
      /*                         Subtrees  :   0*/
      /**/
      /*  Tree name: REST-SUBTREE*/
      /**/
      /*                         Leaf      :   1          Operations:   1*/
      /*                                                  Quits     :   0*/
      /*                         Selections:   0*/
      /*                         Sequences :   3*/
      /*                         Iterations:   2*/
      /*                         Backtracks:   0*/
      /*                         Subtrees  :   1   -->    DATA-STUFFSUB*/
      /**/
      /*  Tree name: SINGLE-SUBTREE*/
      /**/
      /*                         Leaf      :   4          Operations:  20*/
      /*                                                  Quits     :   0*/
      /*                         Selections:   1*/
      /*                         Sequences :   1*/
      /*                         Iterations:   1*/
      /*                         Backtracks:   0*/
      /*                         Subtrees  :   0*/
      /**/
      /*  Tree name: DOUBLE-SUBTREE*/
      /**/
      /*                         Leaf      :   4          Operations:  20*/
      /*                                                  Quits     :   0*/
      /*                         Selections:   1*/
      /*                         Sequences :   1*/
      /*                         Iterations:   1*/
      /*                         Backtracks:   0*/
      /*                         Subtrees  :   0*/
      /**/
      /**/
      /**/
veryend: ;
}
コード例 #30
0
int
GSI_SOCKET_write_buffer(GSI_SOCKET *self,
			const char *buffer,
			const size_t buffer_len)
{
    int return_value = GSI_SOCKET_ERROR;
    
    if (self == NULL)
    {
	return GSI_SOCKET_ERROR;
    }
    
#if 0
    if (buffer[buffer_len-1] == '\0') {
	myproxy_debug("writing a null-terminated message");
    } else {
	myproxy_debug("writing a non-null-terminated message");
    }
#endif

    if ((buffer == NULL) || (buffer_len == 0))
    {
	return 0;
    }
    
    if (self->gss_context == GSS_C_NO_CONTEXT)
    {
	/* No context established, just send in the clear */
	return_value = write_token(self->sock, buffer, buffer_len);
	
	if (return_value == -1)
	{
	    self->error_number = errno;
	    GSI_SOCKET_set_error_string(self, "failed to write token");
	    goto error;
	}
    }
    else
    {
	/* Encrypt buffer before sending */
	gss_buffer_desc unwrapped_buffer;
	gss_buffer_desc wrapped_buffer;
	int conf_state;
	
	unwrapped_buffer.value = (char *) buffer;
	unwrapped_buffer.length = buffer_len;
	
	self->major_status = gss_wrap(&self->minor_status,
				      self->gss_context,
				      1 /* encrypt */,
				      GSS_C_QOP_DEFAULT,
				      &unwrapped_buffer,
				      &conf_state,
				      &wrapped_buffer);
	
	if (self->major_status != GSS_S_COMPLETE)
	{
	    goto error;
	}
	
	if (!conf_state) {
	  GSI_SOCKET_set_error_string(self, "GSI_SOCKET failed to encrypt");
	  goto error;
	}
	
	return_value = write_token(self->sock, wrapped_buffer.value,
				   wrapped_buffer.length);
	
	if (return_value == -1)
	{
	    self->error_number = errno;
	    GSI_SOCKET_set_error_string(self, "failed to write token");
	    gss_release_buffer(&self->minor_status, &wrapped_buffer);
	    goto error;
	}
	
	gss_release_buffer(&self->minor_status, &wrapped_buffer);
    }
/*     fprintf(stderr, "\nwrote:\n%s\n", buffer); */
  error:
    return return_value;
}