Add new error code for security

https://github.com/Hamlib/Hamlib/issues/813
pull/1022/head
Mike Black W9MDB 2022-04-29 17:17:43 -05:00
rodzic 5c0e98fe56
commit 0b62193d92
3 zmienionych plików z 11 dodań i 8 usunięć

Wyświetl plik

@ -157,7 +157,8 @@ enum rig_errcode_e {
RIG_EARG, /*!< 15 NULL RIG handle or any invalid pointer parameter in get arg */ RIG_EARG, /*!< 15 NULL RIG handle or any invalid pointer parameter in get arg */
RIG_EVFO, /*!< 16 Invalid VFO */ RIG_EVFO, /*!< 16 Invalid VFO */
RIG_EDOM, /*!< 17 Argument out of domain of func */ RIG_EDOM, /*!< 17 Argument out of domain of func */
RIG_EDEPRECATED /*!< 18 Function deprecated */ RIG_EDEPRECATED,/*!< 18 Function deprecated */
RIG_ESECURITY /*!< 19 Security error */
}; };
/** /**
@ -167,7 +168,7 @@ enum rig_errcode_e {
*/ */
#define RIG_IS_SOFT_ERRCODE(errcode) (errcode == RIG_EINVAL || errcode == RIG_ENIMPL || errcode == RIG_ERJCTED \ #define RIG_IS_SOFT_ERRCODE(errcode) (errcode == RIG_EINVAL || errcode == RIG_ENIMPL || errcode == RIG_ERJCTED \
|| errcode == RIG_ETRUNC || errcode == RIG_ENAVAIL || errcode == RIG_ENTARGET \ || errcode == RIG_ETRUNC || errcode == RIG_ENAVAIL || errcode == RIG_ENTARGET \
|| errcode == RIG_EVFO || errcode == RIG_EDOM) || errcode == RIG_EVFO || errcode == RIG_EDOM || errcode == RIG_ESECURITY)
/** /**
* \brief Token in the netrigctl protocol for returning error code * \brief Token in the netrigctl protocol for returning error code

Wyświetl plik

@ -195,7 +195,8 @@ static const char *const rigerror_table[] =
"NULL RIG handle or invalid pointer parameter", "NULL RIG handle or invalid pointer parameter",
"Invalid VFO", "Invalid VFO",
"Argument out of domain of func", "Argument out of domain of func",
"Function deprecated" "Function deprecated",
"Security error password not provided or crypto failure"
}; };
@ -1950,9 +1951,11 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
*freq += rig->state.lo_freq; *freq += rig->state.lo_freq;
} }
rig_cache_show(rig, __func__, __LINE__); if (retcode == RIG_OK)
rig_cache_show(rig, __func__, __LINE__);
rig_set_cache_freq(rig, vfo, *freq); rig_set_cache_freq(rig, vfo, *freq);
rig_cache_show(rig, __func__, __LINE__); if (retcode == RIG_OK)
rig_cache_show(rig, __func__, __LINE__);
ELAPSED2; ELAPSED2;
return (retcode); return (retcode);

Wyświetl plik

@ -1702,10 +1702,9 @@ readline_repeat:
if (use_password && !is_passwordOK && (cmd_entry->arg1 != NULL) && !preCmd) if (use_password && !is_passwordOK && (cmd_entry->arg1 != NULL) && !preCmd)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: need password=%s for cmd=%s\n", __func__, rig_debug(RIG_DEBUG_ERR, "%s: password has not been provided\n", __func__)
rigctld_password, cmd_entry->arg1);
fflush(fin); fflush(fin);
retcode = -RIG_EPROTO; retcode = -RIG_ESECURITY;
} }
else else