mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
29db9032b3
The iucvtty_read_msg() now receives the entire message header. Perform message header checks for specific message types where the payload length is clearly defined. Also this needs to be done prior starting the message chunk processing because the message datalen field will be adjusted based on the read chunks. Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
81 lines
2.4 KiB
C
81 lines
2.4 KiB
C
/*
|
|
* iucvtty / iucvconn - IUCV Terminal Applications
|
|
*
|
|
* Definition of common functions
|
|
*
|
|
* Copyright IBM Corp. 2008, 2017
|
|
*
|
|
* s390-tools is free software; you can redistribute it and/or modify
|
|
* it under the terms of the MIT license. See LICENSE for details.
|
|
*/
|
|
#ifndef __FUNCTIONS_H_
|
|
#define __FUNCTIONS_H_
|
|
|
|
#include <unistd.h>
|
|
|
|
#include "af_iucv.h"
|
|
#include "inttypes.h"
|
|
#include "iucvterm/config.h"
|
|
#include "iucvterm/proto.h"
|
|
|
|
/* Message buffer: message header + 4096 bytes of data */
|
|
#define MSG_BUFFER_SIZE (MSG_DATA_OFFSET + (4096))
|
|
|
|
/* Message data sizes */
|
|
#define MAX_TERM_SIZE 256
|
|
|
|
/* Error macros */
|
|
#define print_error(s) program_error(PRG_COMPONENT, (s))
|
|
#define iucvtty_error(m) \
|
|
do { \
|
|
uint32_t *err = (uint32_t *) (m)->data; \
|
|
iucv_msg_error(PRG_COMPONENT, *err); \
|
|
} while (0);
|
|
|
|
/* Error codes */
|
|
/* Unable to fork new process */
|
|
#define ERR_FORK 105
|
|
/* Cannot execute login program */
|
|
#define ERR_CANNOT_EXEC_LOGIN 106
|
|
/* Cannot set up terminal as a login terminal */
|
|
#define ERR_SETUP_LOGIN_TTY 107
|
|
/* Client (vm guest) is not authorized */
|
|
#define ERR_NOT_AUTHORIZED 110
|
|
|
|
|
|
extern int iucvtty_handle_req(int);
|
|
|
|
extern int iucvtty_socket(struct sockaddr_iucv *,
|
|
const char *, const char *);
|
|
|
|
extern int iucvtty_tx_termenv(int, char *);
|
|
extern int iucvtty_rx_termenv(int, void *, size_t);
|
|
extern int iucvtty_tx_winsize(int, int);
|
|
extern int iucvtty_tx_data(int, int, struct iucvtty_msg *, size_t);
|
|
extern int iucvtty_tx_error(int, uint32_t);
|
|
extern int iucvtty_copy_data(int, struct iucvtty_msg *);
|
|
extern int iucvtty_read_data(int, struct iucvtty_msg *, size_t);
|
|
|
|
extern int iucvtty_read_msg(int, struct iucvtty_msg *, size_t, size_t *);
|
|
extern int iucvtty_write_msg(int, struct iucvtty_msg *);
|
|
extern void iucvtty_skip_msg_chunk(int, size_t *);
|
|
|
|
extern ssize_t __write(int, const void*, size_t);
|
|
|
|
extern int strmatch(const char *, const char *);
|
|
extern int is_regex_valid(const char *);
|
|
extern int is_client_allowed(const char *, const struct iucvterm_cfg *);
|
|
extern int is_term_valid(const char *term, size_t len);
|
|
extern void userid_cpy(char [9], const char [8]);
|
|
|
|
extern void iucv_msg_error(const char *, uint32_t);
|
|
extern void program_error(const char *, const char *);
|
|
|
|
/* Audit/session log */
|
|
extern int open_session_log(const char *);
|
|
extern ssize_t write_session_log(const void*, size_t);
|
|
extern void write_session_info(const char *, ...);
|
|
extern void close_session_log(void);
|
|
|
|
#endif /* __FUNCTIONS_H_ */
|