cosmetic: use osmo_strlcpy() everywhere
Shorten some code and make obvious to the reader that the string copy is done in a safe way. Change-Id: I900726cf06d34128db22a3d3d911ee0d1423b1bd
This commit is contained in:
parent
59504dc80f
commit
93bafb611a
|
@ -42,6 +42,7 @@
|
||||||
#include <osmocom/core/signal.h>
|
#include <osmocom/core/signal.h>
|
||||||
#include <osmocom/core/talloc.h>
|
#include <osmocom/core/talloc.h>
|
||||||
#include <osmocom/core/rate_ctr.h>
|
#include <osmocom/core/rate_ctr.h>
|
||||||
|
#include <osmocom/core/utils.h>
|
||||||
#include <osmocom/crypt/auth.h>
|
#include <osmocom/crypt/auth.h>
|
||||||
#include <osmocom/gsm/apn.h>
|
#include <osmocom/gsm/apn.h>
|
||||||
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
|
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
|
||||||
|
@ -683,11 +684,10 @@ static void extract_subscr_msisdn(struct sgsn_mm_ctx *ctx)
|
||||||
/* Prepend a '+' for international numbers */
|
/* Prepend a '+' for international numbers */
|
||||||
if (called.plan == 1 && called.type == 1) {
|
if (called.plan == 1 && called.type == 1) {
|
||||||
ctx->msisdn[0] = '+';
|
ctx->msisdn[0] = '+';
|
||||||
strncpy(&ctx->msisdn[1], called.number,
|
osmo_strlcpy(&ctx->msisdn[1], called.number,
|
||||||
sizeof(ctx->msisdn) - 1);
|
sizeof(ctx->msisdn));
|
||||||
} else {
|
} else {
|
||||||
strncpy(&ctx->msisdn[0], called.number,
|
osmo_strlcpy(ctx->msisdn, called.number, sizeof(ctx->msisdn));
|
||||||
sizeof(ctx->msisdn) - 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -725,7 +725,7 @@ static void extract_subscr_hlr(struct sgsn_mm_ctx *ctx)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(&ctx->hlr[0], called.number, sizeof(ctx->hlr) - 1);
|
osmo_strlcpy(ctx->hlr, called.number, sizeof(ctx->hlr));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BUILD_IU
|
#ifdef BUILD_IU
|
||||||
|
@ -1034,10 +1034,10 @@ static int gsm48_rx_gmm_id_resp(struct sgsn_mm_ctx *ctx, struct msgb *msg)
|
||||||
mm_ctx_cleanup_free(ictx, "GPRS IMSI re-use");
|
mm_ctx_cleanup_free(ictx, "GPRS IMSI re-use");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
strncpy(ctx->imsi, mi_string, sizeof(ctx->imsi) - 1);
|
osmo_strlcpy(ctx->imsi, mi_string, sizeof(ctx->imsi));
|
||||||
break;
|
break;
|
||||||
case GSM_MI_TYPE_IMEI:
|
case GSM_MI_TYPE_IMEI:
|
||||||
strncpy(ctx->imei, mi_string, sizeof(ctx->imei) - 1);
|
osmo_strlcpy(ctx->imei, mi_string, sizeof(ctx->imei));
|
||||||
break;
|
break;
|
||||||
case GSM_MI_TYPE_IMEISV:
|
case GSM_MI_TYPE_IMEISV:
|
||||||
break;
|
break;
|
||||||
|
@ -1138,7 +1138,7 @@ static int gsm48_rx_gmm_att_req(struct sgsn_mm_ctx *ctx, struct msgb *msg,
|
||||||
reject_cause = GMM_CAUSE_NET_FAIL;
|
reject_cause = GMM_CAUSE_NET_FAIL;
|
||||||
goto rejected;
|
goto rejected;
|
||||||
}
|
}
|
||||||
strncpy(ctx->imsi, mi_string, sizeof(ctx->imsi) - 1);
|
osmo_strlcpy(ctx->imsi, mi_string, sizeof(ctx->imsi));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (ctx->ran_type == MM_CTX_T_GERAN_Gb) {
|
if (ctx->ran_type == MM_CTX_T_GERAN_Gb) {
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
|
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
|
||||||
#include <osmocom/gsm/gsup.h>
|
#include <osmocom/gsm/gsup.h>
|
||||||
|
#include <osmocom/core/utils.h>
|
||||||
#include <openbsc/gsm_subscriber.h>
|
#include <openbsc/gsm_subscriber.h>
|
||||||
#include <openbsc/gsup_client.h>
|
#include <openbsc/gsup_client.h>
|
||||||
|
|
||||||
|
@ -164,7 +165,8 @@ static int gprs_subscr_tx_gsup_message(struct gsm_subscriber *subscr,
|
||||||
struct msgb *msg = gsup_client_msgb_alloc();
|
struct msgb *msg = gsup_client_msgb_alloc();
|
||||||
|
|
||||||
if (strlen(gsup_msg->imsi) == 0 && subscr)
|
if (strlen(gsup_msg->imsi) == 0 && subscr)
|
||||||
strncpy(gsup_msg->imsi, subscr->imsi, sizeof(gsup_msg->imsi) - 1);
|
osmo_strlcpy(gsup_msg->imsi, subscr->imsi,
|
||||||
|
sizeof(gsup_msg->imsi));
|
||||||
gsup_msg->cn_domain = OSMO_GSUP_CN_DOMAIN_PS;
|
gsup_msg->cn_domain = OSMO_GSUP_CN_DOMAIN_PS;
|
||||||
osmo_gsup_encode(msg, gsup_msg);
|
osmo_gsup_encode(msg, gsup_msg);
|
||||||
|
|
||||||
|
@ -185,7 +187,8 @@ static int gprs_subscr_tx_gsup_error_reply(struct gsm_subscriber *subscr,
|
||||||
{
|
{
|
||||||
struct osmo_gsup_message gsup_reply = {0};
|
struct osmo_gsup_message gsup_reply = {0};
|
||||||
|
|
||||||
strncpy(gsup_reply.imsi, gsup_orig->imsi, sizeof(gsup_reply.imsi) - 1);
|
osmo_strlcpy(gsup_reply.imsi, gsup_orig->imsi,
|
||||||
|
sizeof(gsup_reply.imsi));
|
||||||
gsup_reply.cause = cause;
|
gsup_reply.cause = cause;
|
||||||
gsup_reply.message_type =
|
gsup_reply.message_type =
|
||||||
OSMO_GSUP_TO_MSGT_ERROR(gsup_orig->message_type);
|
OSMO_GSUP_TO_MSGT_ERROR(gsup_orig->message_type);
|
||||||
|
@ -778,9 +781,8 @@ struct gsm_subscriber *gprs_subscr_get_or_create_by_mmctx(struct sgsn_mm_ctx *mm
|
||||||
subscr->flags &= ~GPRS_SUBSCRIBER_ENABLE_PURGE;
|
subscr->flags &= ~GPRS_SUBSCRIBER_ENABLE_PURGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(subscr->equipment.imei, mmctx->imei,
|
osmo_strlcpy(subscr->equipment.imei, mmctx->imei,
|
||||||
sizeof(subscr->equipment.imei)-1);
|
sizeof(subscr->equipment.imei));
|
||||||
subscr->equipment.imei[sizeof(subscr->equipment.imei)-1] = 0;
|
|
||||||
|
|
||||||
if (subscr->lac != mmctx->ra.lac)
|
if (subscr->lac != mmctx->ra.lac)
|
||||||
subscr->lac = mmctx->ra.lac;
|
subscr->lac = mmctx->ra.lac;
|
||||||
|
|
|
@ -2360,8 +2360,7 @@ void gtphub_resolved_ggsn(struct gtphub *hub, const char *apn_oi_str,
|
||||||
ggsn->peer = pp;
|
ggsn->peer = pp;
|
||||||
gtphub_port_ref_count_inc(pp);
|
gtphub_port_ref_count_inc(pp);
|
||||||
|
|
||||||
strncpy(ggsn->apn_oi_str, apn_oi_str, sizeof(ggsn->apn_oi_str));
|
osmo_strlcpy(ggsn->apn_oi_str, apn_oi_str, sizeof(ggsn->apn_oi_str));
|
||||||
ggsn->apn_oi_str[sizeof(ggsn->apn_oi_str) - 1] = '\0';
|
|
||||||
|
|
||||||
ggsn->expiry_entry.del_cb = resolved_gssn_del_cb;
|
ggsn->expiry_entry.del_cb = resolved_gssn_del_cb;
|
||||||
expiry_add(&hub->expire_slowly, &ggsn->expiry_entry, now);
|
expiry_add(&hub->expire_slowly, &ggsn->expiry_entry, now);
|
||||||
|
|
|
@ -121,8 +121,8 @@ static void make_addr_str(struct ggsn_lookup *lookup)
|
||||||
apn_oi_str = osmo_apn_qualify_from_imsi(lookup->imsi_str,
|
apn_oi_str = osmo_apn_qualify_from_imsi(lookup->imsi_str,
|
||||||
lookup->apn_ni_str,
|
lookup->apn_ni_str,
|
||||||
lookup->have_3dig_mnc);
|
lookup->have_3dig_mnc);
|
||||||
strncpy(lookup->apn_oi_str, apn_oi_str, sizeof(lookup->apn_oi_str));
|
osmo_strlcpy(lookup->apn_oi_str, apn_oi_str,
|
||||||
lookup->apn_oi_str[sizeof(lookup->apn_oi_str)-1] = '\0';
|
sizeof(lookup->apn_oi_str));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int start_ares_query(struct ggsn_lookup *lookup)
|
static int start_ares_query(struct ggsn_lookup *lookup)
|
||||||
|
@ -170,11 +170,9 @@ struct gtphub_peer_port *gtphub_resolve_ggsn_addr(struct gtphub *hub,
|
||||||
expiring_item_init(&lookup->expiry_entry);
|
expiring_item_init(&lookup->expiry_entry);
|
||||||
lookup->hub = hub;
|
lookup->hub = hub;
|
||||||
|
|
||||||
strncpy(lookup->imsi_str, imsi_str, sizeof(lookup->imsi_str));
|
osmo_strlcpy(lookup->imsi_str, imsi_str, sizeof(lookup->imsi_str));
|
||||||
lookup->imsi_str[sizeof(lookup->imsi_str)-1] = '\0';
|
osmo_strlcpy(lookup->apn_ni_str, apn_ni_str,
|
||||||
|
sizeof(lookup->apn_ni_str));
|
||||||
strncpy(lookup->apn_ni_str, apn_ni_str, sizeof(lookup->apn_ni_str));
|
|
||||||
lookup->apn_ni_str[sizeof(lookup->apn_ni_str)-1] = '\0';
|
|
||||||
|
|
||||||
make_addr_str(lookup);
|
make_addr_str(lookup);
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
|
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
|
||||||
|
#include <osmocom/core/utils.h>
|
||||||
#include <openbsc/sgsn.h>
|
#include <openbsc/sgsn.h>
|
||||||
#include <openbsc/gprs_sgsn.h>
|
#include <openbsc/gprs_sgsn.h>
|
||||||
#include <openbsc/gprs_gmm.h>
|
#include <openbsc/gprs_gmm.h>
|
||||||
|
@ -62,7 +63,7 @@ int sgsn_acl_add(const char *imsi, struct sgsn_config *cfg)
|
||||||
acl = talloc_zero(NULL, struct imsi_acl_entry);
|
acl = talloc_zero(NULL, struct imsi_acl_entry);
|
||||||
if (!acl)
|
if (!acl)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
strncpy(acl->imsi, imsi, sizeof(acl->imsi) - 1);
|
osmo_strlcpy(acl->imsi, imsi, sizeof(acl->imsi));
|
||||||
|
|
||||||
llist_add(&acl->list, &cfg->imsi_acl);
|
llist_add(&acl->list, &cfg->imsi_acl);
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include <osmocom/gsm/tlv.h>
|
#include <osmocom/gsm/tlv.h>
|
||||||
#include <osmocom/gsm/abis_nm.h>
|
#include <osmocom/gsm/abis_nm.h>
|
||||||
#include <osmocom/core/talloc.h>
|
#include <osmocom/core/talloc.h>
|
||||||
|
#include <osmocom/core/utils.h>
|
||||||
#include <openbsc/abis_nm.h>
|
#include <openbsc/abis_nm.h>
|
||||||
#include <openbsc/misdn.h>
|
#include <openbsc/misdn.h>
|
||||||
#include <openbsc/signal.h>
|
#include <openbsc/signal.h>
|
||||||
|
@ -2235,8 +2236,7 @@ static int bs11_read_swl_file(struct abis_nm_bs11_sw *bs11_sw)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* construct new filename */
|
/* construct new filename */
|
||||||
strncpy(dir, bs11_sw->swl_fname, sizeof(dir));
|
osmo_strlcpy(dir, bs11_sw->swl_fname, sizeof(dir));
|
||||||
dir[sizeof(dir)-1] = '\0';
|
|
||||||
strncat(fle->fname, dirname(dir), sizeof(fle->fname) - 1);
|
strncat(fle->fname, dirname(dir), sizeof(fle->fname) - 1);
|
||||||
strcat(fle->fname, "/");
|
strcat(fle->fname, "/");
|
||||||
strncat(fle->fname, file_id, sizeof(fle->fname) - 1 -strlen(fle->fname));
|
strncat(fle->fname, file_id, sizeof(fle->fname) - 1 -strlen(fle->fname));
|
||||||
|
@ -2307,8 +2307,7 @@ int abis_nm_bs11_load_swl(struct gsm_bts *bts, const char *fname,
|
||||||
bs11_sw->user_cb = cbfn;
|
bs11_sw->user_cb = cbfn;
|
||||||
bs11_sw->forced = forced;
|
bs11_sw->forced = forced;
|
||||||
|
|
||||||
strncpy(bs11_sw->swl_fname, fname, sizeof(bs11_sw->swl_fname));
|
osmo_strlcpy(bs11_sw->swl_fname, fname, sizeof(bs11_sw->swl_fname));
|
||||||
bs11_sw->swl_fname[sizeof(bs11_sw->swl_fname)-1] = '\0';
|
|
||||||
rc = bs11_read_swl_file(bs11_sw);
|
rc = bs11_read_swl_file(bs11_sw);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
|
@ -451,8 +451,7 @@ static int rf_create_socket(struct osmo_bsc_rf *rf, const char *path)
|
||||||
}
|
}
|
||||||
|
|
||||||
local.sun_family = AF_UNIX;
|
local.sun_family = AF_UNIX;
|
||||||
strncpy(local.sun_path, path, sizeof(local.sun_path));
|
osmo_strlcpy(local.sun_path, path, sizeof(local.sun_path));
|
||||||
local.sun_path[sizeof(local.sun_path) - 1] = '\0';
|
|
||||||
unlink(local.sun_path);
|
unlink(local.sun_path);
|
||||||
|
|
||||||
/* we use the same magic that X11 uses in Xtranssock.c for
|
/* we use the same magic that X11 uses in Xtranssock.c for
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include <osmocom/core/talloc.h>
|
#include <osmocom/core/talloc.h>
|
||||||
|
#include <osmocom/core/utils.h>
|
||||||
#include <openbsc/gsm_subscriber.h>
|
#include <openbsc/gsm_subscriber.h>
|
||||||
#include <openbsc/debug.h>
|
#include <openbsc/debug.h>
|
||||||
|
|
||||||
|
@ -115,7 +116,7 @@ struct gsm_subscriber *subscr_get_or_create(struct gsm_subscriber_group *sgrp,
|
||||||
if (!subscr)
|
if (!subscr)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
strncpy(subscr->imsi, imsi, sizeof(subscr->imsi)-1);
|
osmo_strlcpy(subscr->imsi, imsi, sizeof(subscr->imsi));
|
||||||
subscr->group = sgrp;
|
subscr->group = sgrp;
|
||||||
return subscr;
|
return subscr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,8 +75,7 @@ static struct imsi_op *imsi_op_alloc(void *ctx, const char *imsi,
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
io = talloc_zero(ctx, struct imsi_op);
|
io = talloc_zero(ctx, struct imsi_op);
|
||||||
strncpy(io->imsi, imsi, sizeof(io->imsi));
|
osmo_strlcpy(io->imsi, imsi, sizeof(io->imsi));
|
||||||
io->imsi[sizeof(io->imsi)-1] = '\0';
|
|
||||||
io->type = type;
|
io->type = type;
|
||||||
io->timer.cb = imsi_op_timer_cb;
|
io->timer.cb = imsi_op_timer_cb;
|
||||||
io->timer.data = io;
|
io->timer.data = io;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <osmocom/ctrl/control_cmd.h>
|
#include <osmocom/ctrl/control_cmd.h>
|
||||||
|
#include <osmocom/core/utils.h>
|
||||||
#include <openbsc/gsm_data.h>
|
#include <openbsc/gsm_data.h>
|
||||||
#include <openbsc/gsm_subscriber.h>
|
#include <openbsc/gsm_subscriber.h>
|
||||||
#include <openbsc/db.h>
|
#include <openbsc/db.h>
|
||||||
|
@ -103,8 +104,7 @@ static int set_subscriber_modify(struct ctrl_cmd *cmd, void *data)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
subscr->authorized = 1;
|
subscr->authorized = 1;
|
||||||
strncpy(subscr->extension, msisdn, GSM_EXTENSION_LENGTH - 1);
|
osmo_strlcpy(subscr->extension, msisdn, sizeof(subscr->extension));
|
||||||
subscr->extension[GSM_EXTENSION_LENGTH-1] = '\0';
|
|
||||||
|
|
||||||
/* put it back to the db */
|
/* put it back to the db */
|
||||||
rc = db_sync_subscriber(subscr);
|
rc = db_sync_subscriber(subscr);
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include <osmocom/core/talloc.h>
|
#include <osmocom/core/talloc.h>
|
||||||
#include <osmocom/core/statistics.h>
|
#include <osmocom/core/statistics.h>
|
||||||
#include <osmocom/core/rate_ctr.h>
|
#include <osmocom/core/rate_ctr.h>
|
||||||
|
#include <osmocom/core/utils.h>
|
||||||
|
|
||||||
#include <openssl/rand.h>
|
#include <openssl/rand.h>
|
||||||
|
|
||||||
|
@ -240,7 +241,7 @@ static struct gsm_sms *sms_from_result_v3(dbi_result result)
|
||||||
snprintf(buf, sizeof(buf), "%llu", sender_id);
|
snprintf(buf, sizeof(buf), "%llu", sender_id);
|
||||||
sender = db_get_subscriber(GSM_SUBSCRIBER_ID, buf);
|
sender = db_get_subscriber(GSM_SUBSCRIBER_ID, buf);
|
||||||
OSMO_ASSERT(sender);
|
OSMO_ASSERT(sender);
|
||||||
strncpy(sms->src.addr, sender->extension, sizeof(sms->src.addr)-1);
|
osmo_strlcpy(sms->src.addr, sender->extension, sizeof(sms->src.addr));
|
||||||
subscr_direct_free(sender);
|
subscr_direct_free(sender);
|
||||||
sender = NULL;
|
sender = NULL;
|
||||||
|
|
||||||
|
@ -252,10 +253,8 @@ static struct gsm_sms *sms_from_result_v3(dbi_result result)
|
||||||
"data_coding_scheme");
|
"data_coding_scheme");
|
||||||
|
|
||||||
daddr = dbi_result_get_string(result, "dest_addr");
|
daddr = dbi_result_get_string(result, "dest_addr");
|
||||||
if (daddr) {
|
if (daddr)
|
||||||
strncpy(sms->dst.addr, daddr, sizeof(sms->dst.addr));
|
osmo_strlcpy(sms->dst.addr, daddr, sizeof(sms->dst.addr));
|
||||||
sms->dst.addr[sizeof(sms->dst.addr)-1] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
sms->user_data_len = dbi_result_get_field_length(result, "user_data");
|
sms->user_data_len = dbi_result_get_field_length(result, "user_data");
|
||||||
user_data = dbi_result_get_binary(result, "user_data");
|
user_data = dbi_result_get_binary(result, "user_data");
|
||||||
|
@ -264,10 +263,8 @@ static struct gsm_sms *sms_from_result_v3(dbi_result result)
|
||||||
memcpy(sms->user_data, user_data, sms->user_data_len);
|
memcpy(sms->user_data, user_data, sms->user_data_len);
|
||||||
|
|
||||||
text = dbi_result_get_string(result, "text");
|
text = dbi_result_get_string(result, "text");
|
||||||
if (text) {
|
if (text)
|
||||||
strncpy(sms->text, text, sizeof(sms->text));
|
osmo_strlcpy(sms->text, text, sizeof(sms->text));
|
||||||
sms->text[sizeof(sms->text)-1] = '\0';
|
|
||||||
}
|
|
||||||
return sms;
|
return sms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,7 +546,7 @@ struct gsm_subscriber *db_create_subscriber(const char *imsi, uint64_t smin,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
subscr->id = dbi_conn_sequence_last(conn, NULL);
|
subscr->id = dbi_conn_sequence_last(conn, NULL);
|
||||||
strncpy(subscr->imsi, imsi, sizeof(subscr->imsi)-1);
|
osmo_strlcpy(subscr->imsi, imsi, sizeof(subscr->imsi));
|
||||||
dbi_result_free(result);
|
dbi_result_free(result);
|
||||||
LOGP(DDB, LOGL_INFO, "New Subscriber: ID %llu, IMSI %s\n", subscr->id, subscr->imsi);
|
LOGP(DDB, LOGL_INFO, "New Subscriber: ID %llu, IMSI %s\n", subscr->id, subscr->imsi);
|
||||||
if (alloc_exten)
|
if (alloc_exten)
|
||||||
|
@ -585,7 +582,7 @@ static int get_equipment_by_subscr(struct gsm_subscriber *subscr)
|
||||||
|
|
||||||
string = dbi_result_get_string(result, "imei");
|
string = dbi_result_get_string(result, "imei");
|
||||||
if (string)
|
if (string)
|
||||||
strncpy(equip->imei, string, sizeof(equip->imei)-1);
|
osmo_strlcpy(equip->imei, string, sizeof(equip->imei));
|
||||||
|
|
||||||
string = dbi_result_get_string(result, "classmark1");
|
string = dbi_result_get_string(result, "classmark1");
|
||||||
if (string) {
|
if (string) {
|
||||||
|
@ -824,21 +821,19 @@ static void db_set_from_query(struct gsm_subscriber *subscr, dbi_conn result)
|
||||||
const char *string;
|
const char *string;
|
||||||
string = dbi_result_get_string(result, "imsi");
|
string = dbi_result_get_string(result, "imsi");
|
||||||
if (string)
|
if (string)
|
||||||
strncpy(subscr->imsi, string, sizeof(subscr->imsi)-1);
|
osmo_strlcpy(subscr->imsi, string, sizeof(subscr->imsi));
|
||||||
|
|
||||||
string = dbi_result_get_string(result, "tmsi");
|
string = dbi_result_get_string(result, "tmsi");
|
||||||
if (string)
|
if (string)
|
||||||
subscr->tmsi = tmsi_from_string(string);
|
subscr->tmsi = tmsi_from_string(string);
|
||||||
|
|
||||||
string = dbi_result_get_string(result, "name");
|
string = dbi_result_get_string(result, "name");
|
||||||
if (string) {
|
if (string)
|
||||||
strncpy(subscr->name, string, GSM_NAME_LENGTH);
|
osmo_strlcpy(subscr->name, string, sizeof(subscr->name));
|
||||||
subscr->name[sizeof(subscr->name)-1] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
string = dbi_result_get_string(result, "extension");
|
string = dbi_result_get_string(result, "extension");
|
||||||
if (string)
|
if (string)
|
||||||
strncpy(subscr->extension, string, GSM_EXTENSION_LENGTH);
|
osmo_strlcpy(subscr->extension, string, sizeof(subscr->extension));
|
||||||
|
|
||||||
subscr->lac = dbi_result_get_ulonglong(result, "lac");
|
subscr->lac = dbi_result_get_ulonglong(result, "lac");
|
||||||
|
|
||||||
|
@ -1351,8 +1346,7 @@ int db_subscriber_assoc_imei(struct gsm_subscriber *subscriber, char imei[GSM230
|
||||||
unsigned long long equipment_id, watch_id;
|
unsigned long long equipment_id, watch_id;
|
||||||
dbi_result result;
|
dbi_result result;
|
||||||
|
|
||||||
strncpy(subscriber->equipment.imei, imei,
|
osmo_strlcpy(subscriber->equipment.imei, imei, sizeof(subscriber->equipment.imei));
|
||||||
sizeof(subscriber->equipment.imei)-1);
|
|
||||||
|
|
||||||
result = dbi_conn_queryf(conn,
|
result = dbi_conn_queryf(conn,
|
||||||
"INSERT OR IGNORE INTO Equipment "
|
"INSERT OR IGNORE INTO Equipment "
|
||||||
|
@ -1502,19 +1496,15 @@ static struct gsm_sms *sms_from_result(struct gsm_network *net, dbi_result resul
|
||||||
sms->dst.npi = dbi_result_get_ulonglong(result, "dest_npi");
|
sms->dst.npi = dbi_result_get_ulonglong(result, "dest_npi");
|
||||||
sms->dst.ton = dbi_result_get_ulonglong(result, "dest_ton");
|
sms->dst.ton = dbi_result_get_ulonglong(result, "dest_ton");
|
||||||
daddr = dbi_result_get_string(result, "dest_addr");
|
daddr = dbi_result_get_string(result, "dest_addr");
|
||||||
if (daddr) {
|
if (daddr)
|
||||||
strncpy(sms->dst.addr, daddr, sizeof(sms->dst.addr));
|
osmo_strlcpy(sms->dst.addr, daddr, sizeof(sms->dst.addr));
|
||||||
sms->dst.addr[sizeof(sms->dst.addr)-1] = '\0';
|
|
||||||
}
|
|
||||||
sms->receiver = subscr_get_by_extension(net->subscr_group, sms->dst.addr);
|
sms->receiver = subscr_get_by_extension(net->subscr_group, sms->dst.addr);
|
||||||
|
|
||||||
sms->src.npi = dbi_result_get_ulonglong(result, "src_npi");
|
sms->src.npi = dbi_result_get_ulonglong(result, "src_npi");
|
||||||
sms->src.ton = dbi_result_get_ulonglong(result, "src_ton");
|
sms->src.ton = dbi_result_get_ulonglong(result, "src_ton");
|
||||||
saddr = dbi_result_get_string(result, "src_addr");
|
saddr = dbi_result_get_string(result, "src_addr");
|
||||||
if (saddr) {
|
if (saddr)
|
||||||
strncpy(sms->src.addr, saddr, sizeof(sms->src.addr));
|
osmo_strlcpy(sms->src.addr, saddr, sizeof(sms->src.addr));
|
||||||
sms->src.addr[sizeof(sms->src.addr)-1] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
sms->user_data_len = dbi_result_get_field_length(result, "user_data");
|
sms->user_data_len = dbi_result_get_field_length(result, "user_data");
|
||||||
user_data = dbi_result_get_binary(result, "user_data");
|
user_data = dbi_result_get_binary(result, "user_data");
|
||||||
|
@ -1523,10 +1513,8 @@ static struct gsm_sms *sms_from_result(struct gsm_network *net, dbi_result resul
|
||||||
memcpy(sms->user_data, user_data, sms->user_data_len);
|
memcpy(sms->user_data, user_data, sms->user_data_len);
|
||||||
|
|
||||||
text = dbi_result_get_string(result, "text");
|
text = dbi_result_get_string(result, "text");
|
||||||
if (text) {
|
if (text)
|
||||||
strncpy(sms->text, text, sizeof(sms->text));
|
osmo_strlcpy(sms->text, text, sizeof(sms->text));
|
||||||
sms->text[sizeof(sms->text)-1] = '\0';
|
|
||||||
}
|
|
||||||
return sms;
|
return sms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,7 @@
|
||||||
#include <osmocom/gsm/protocol/gsm_04_08.h>
|
#include <osmocom/gsm/protocol/gsm_04_08.h>
|
||||||
#include <osmocom/core/msgb.h>
|
#include <osmocom/core/msgb.h>
|
||||||
#include <osmocom/core/talloc.h>
|
#include <osmocom/core/talloc.h>
|
||||||
|
#include <osmocom/core/utils.h>
|
||||||
#include <osmocom/gsm/tlv.h>
|
#include <osmocom/gsm/tlv.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -1973,10 +1974,9 @@ static int gsm48_cc_rx_setup(struct gsm_trans *trans, struct msgb *msg)
|
||||||
|
|
||||||
/* use subscriber as calling party number */
|
/* use subscriber as calling party number */
|
||||||
setup.fields |= MNCC_F_CALLING;
|
setup.fields |= MNCC_F_CALLING;
|
||||||
strncpy(setup.calling.number, trans->subscr->extension,
|
osmo_strlcpy(setup.calling.number, trans->subscr->extension,
|
||||||
sizeof(setup.calling.number)-1);
|
sizeof(setup.calling.number));
|
||||||
strncpy(setup.imsi, trans->subscr->imsi,
|
osmo_strlcpy(setup.imsi, trans->subscr->imsi, sizeof(setup.imsi));
|
||||||
sizeof(setup.imsi)-1);
|
|
||||||
|
|
||||||
/* bearer capability */
|
/* bearer capability */
|
||||||
if (TLVP_PRESENT(&tp, GSM48_IE_BEARER_CAP)) {
|
if (TLVP_PRESENT(&tp, GSM48_IE_BEARER_CAP)) {
|
||||||
|
@ -2153,8 +2153,8 @@ static int gsm48_cc_rx_call_conf(struct gsm_trans *trans, struct msgb *msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IMSI of called subscriber */
|
/* IMSI of called subscriber */
|
||||||
strncpy(call_conf.imsi, trans->subscr->imsi,
|
osmo_strlcpy(call_conf.imsi, trans->subscr->imsi,
|
||||||
sizeof(call_conf.imsi)-1);
|
sizeof(call_conf.imsi));
|
||||||
|
|
||||||
new_cc_state(trans, GSM_CSTATE_MO_TERM_CALL_CONF);
|
new_cc_state(trans, GSM_CSTATE_MO_TERM_CALL_CONF);
|
||||||
|
|
||||||
|
@ -2307,10 +2307,9 @@ static int gsm48_cc_rx_connect(struct gsm_trans *trans, struct msgb *msg)
|
||||||
tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0);
|
tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0);
|
||||||
/* use subscriber as connected party number */
|
/* use subscriber as connected party number */
|
||||||
connect.fields |= MNCC_F_CONNECTED;
|
connect.fields |= MNCC_F_CONNECTED;
|
||||||
strncpy(connect.connected.number, trans->subscr->extension,
|
osmo_strlcpy(connect.connected.number, trans->subscr->extension,
|
||||||
sizeof(connect.connected.number)-1);
|
sizeof(connect.connected.number));
|
||||||
strncpy(connect.imsi, trans->subscr->imsi,
|
osmo_strlcpy(connect.imsi, trans->subscr->imsi, sizeof(connect.imsi));
|
||||||
sizeof(connect.imsi)-1);
|
|
||||||
|
|
||||||
/* facility */
|
/* facility */
|
||||||
if (TLVP_PRESENT(&tp, GSM48_IE_FACILITY)) {
|
if (TLVP_PRESENT(&tp, GSM48_IE_FACILITY)) {
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
|
|
||||||
#include <osmocom/core/msgb.h>
|
#include <osmocom/core/msgb.h>
|
||||||
#include <osmocom/core/talloc.h>
|
#include <osmocom/core/talloc.h>
|
||||||
|
#include <osmocom/core/utils.h>
|
||||||
|
|
||||||
#include <osmocom/gsm/gsm_utils.h>
|
#include <osmocom/gsm/gsm_utils.h>
|
||||||
#include <osmocom/gsm/gsm0411_utils.h>
|
#include <osmocom/gsm/gsm0411_utils.h>
|
||||||
|
@ -92,15 +93,15 @@ struct gsm_sms *sms_from_text(struct gsm_subscriber *receiver,
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
sms->receiver = subscr_get(receiver);
|
sms->receiver = subscr_get(receiver);
|
||||||
strncpy(sms->text, text, sizeof(sms->text)-1);
|
osmo_strlcpy(sms->text, text, sizeof(sms->text));
|
||||||
|
|
||||||
strncpy(sms->src.addr, sender->extension, sizeof(sms->src.addr)-1);
|
osmo_strlcpy(sms->src.addr, sender->extension, sizeof(sms->src.addr));
|
||||||
sms->reply_path_req = 0;
|
sms->reply_path_req = 0;
|
||||||
sms->status_rep_req = 0;
|
sms->status_rep_req = 0;
|
||||||
sms->ud_hdr_ind = 0;
|
sms->ud_hdr_ind = 0;
|
||||||
sms->protocol_id = 0; /* implicit */
|
sms->protocol_id = 0; /* implicit */
|
||||||
sms->data_coding_scheme = dcs;
|
sms->data_coding_scheme = dcs;
|
||||||
strncpy(sms->dst.addr, receiver->extension, sizeof(sms->dst.addr)-1);
|
osmo_strlcpy(sms->dst.addr, receiver->extension, sizeof(sms->dst.addr));
|
||||||
/* Generate user_data */
|
/* Generate user_data */
|
||||||
sms->user_data_len = gsm_7bit_encode_n(sms->user_data, sizeof(sms->user_data),
|
sms->user_data_len = gsm_7bit_encode_n(sms->user_data, sizeof(sms->user_data),
|
||||||
sms->text, NULL);
|
sms->text, NULL);
|
||||||
|
@ -464,7 +465,8 @@ static int gsm340_rx_tpdu(struct gsm_subscriber_connection *conn, struct msgb *m
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(gsms->src.addr, conn->subscr->extension, sizeof(gsms->src.addr)-1);
|
osmo_strlcpy(gsms->src.addr, conn->subscr->extension,
|
||||||
|
sizeof(gsms->src.addr));
|
||||||
|
|
||||||
LOGP(DLSMS, LOGL_INFO, "RX SMS: Sender: %s, MTI: 0x%02x, VPF: 0x%02x, "
|
LOGP(DLSMS, LOGL_INFO, "RX SMS: Sender: %s, MTI: 0x%02x, VPF: 0x%02x, "
|
||||||
"MR: 0x%02x PID: 0x%02x, DCS: 0x%02x, DA: %s, "
|
"MR: 0x%02x PID: 0x%02x, DCS: 0x%02x, DA: %s, "
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <osmocom/core/socket.h>
|
#include <osmocom/core/socket.h>
|
||||||
#include <osmocom/core/write_queue.h>
|
#include <osmocom/core/write_queue.h>
|
||||||
#include <osmocom/core/talloc.h>
|
#include <osmocom/core/talloc.h>
|
||||||
|
#include <osmocom/core/utils.h>
|
||||||
|
|
||||||
#include <osmocom/vty/command.h>
|
#include <osmocom/vty/command.h>
|
||||||
#include <osmocom/vty/vty.h>
|
#include <osmocom/vty/vty.h>
|
||||||
|
@ -52,12 +53,9 @@ static int process_meas_rep(struct gsm_meas_rep *mr)
|
||||||
mfm->hdr.version = MEAS_FEED_VERSION;
|
mfm->hdr.version = MEAS_FEED_VERSION;
|
||||||
|
|
||||||
/* fill in MEAS_FEED_MEAS specific header */
|
/* fill in MEAS_FEED_MEAS specific header */
|
||||||
strncpy(mfm->imsi, subscr->imsi, sizeof(mfm->imsi)-1);
|
osmo_strlcpy(mfm->imsi, subscr->imsi, sizeof(mfm->imsi));
|
||||||
mfm->imsi[sizeof(mfm->imsi)-1] = '\0';
|
osmo_strlcpy(mfm->name, subscr->name, sizeof(mfm->name));
|
||||||
strncpy(mfm->name, subscr->name, sizeof(mfm->name)-1);
|
osmo_strlcpy(mfm->scenario, g_mfs.scenario, sizeof(mfm->scenario));
|
||||||
mfm->name[sizeof(mfm->name)-1] = '\0';
|
|
||||||
strncpy(mfm->scenario, g_mfs.scenario, sizeof(mfm->scenario));
|
|
||||||
mfm->scenario[sizeof(mfm->scenario)-1] = '\0';
|
|
||||||
|
|
||||||
/* copy the entire measurement report */
|
/* copy the entire measurement report */
|
||||||
memcpy(&mfm->mr, mr, sizeof(mfm->mr));
|
memcpy(&mfm->mr, mr, sizeof(mfm->mr));
|
||||||
|
@ -160,8 +158,7 @@ void meas_feed_cfg_get(char **host, uint16_t *port)
|
||||||
|
|
||||||
void meas_feed_scenario_set(const char *name)
|
void meas_feed_scenario_set(const char *name)
|
||||||
{
|
{
|
||||||
strncpy(g_mfs.scenario, name, sizeof(g_mfs.scenario)-1);
|
osmo_strlcpy(g_mfs.scenario, name, sizeof(g_mfs.scenario));
|
||||||
g_mfs.scenario[sizeof(g_mfs.scenario)-1] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *meas_feed_scenario_get(void)
|
const char *meas_feed_scenario_get(void)
|
||||||
|
|
|
@ -133,12 +133,13 @@ static int submit_to_sms(struct gsm_sms **psms, struct gsm_network *net,
|
||||||
sms->receiver = dest;
|
sms->receiver = dest;
|
||||||
sms->dst.ton = submit->dest_addr_ton;
|
sms->dst.ton = submit->dest_addr_ton;
|
||||||
sms->dst.npi = submit->dest_addr_npi;
|
sms->dst.npi = submit->dest_addr_npi;
|
||||||
strncpy(sms->dst.addr, dest->extension, sizeof(sms->dst.addr)-1);
|
osmo_strlcpy(sms->dst.addr, dest->extension, sizeof(sms->dst.addr));
|
||||||
|
|
||||||
/* fill in the source address */
|
/* fill in the source address */
|
||||||
sms->src.ton = submit->source_addr_ton;
|
sms->src.ton = submit->source_addr_ton;
|
||||||
sms->src.npi = submit->source_addr_npi;
|
sms->src.npi = submit->source_addr_npi;
|
||||||
strncpy(sms->src.addr, (char *)submit->source_addr, sizeof(sms->src.addr)-1);
|
osmo_strlcpy(sms->src.addr, (char *)submit->source_addr,
|
||||||
|
sizeof(sms->src.addr));
|
||||||
|
|
||||||
if (submit->esm_class & 0x40)
|
if (submit->esm_class & 0x40)
|
||||||
sms->ud_hdr_ind = 1;
|
sms->ud_hdr_ind = 1;
|
||||||
|
|
|
@ -567,8 +567,7 @@ DEFUN(ena_subscr_name,
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(subscr->name, name, sizeof(subscr->name));
|
osmo_strlcpy(subscr->name, name, sizeof(subscr->name));
|
||||||
subscr->name[sizeof(subscr->name)-1] = '\0';
|
|
||||||
talloc_free(name);
|
talloc_free(name);
|
||||||
db_sync_subscriber(subscr);
|
db_sync_subscriber(subscr);
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <sys/utsname.h> /* uname() */
|
#include <sys/utsname.h> /* uname() */
|
||||||
|
|
||||||
#include <osmocom/core/talloc.h>
|
#include <osmocom/core/talloc.h>
|
||||||
|
#include <osmocom/core/utils.h>
|
||||||
#include <openbsc/gsm_data.h>
|
#include <openbsc/gsm_data.h>
|
||||||
#include <osmocom/core/msgb.h>
|
#include <osmocom/core/msgb.h>
|
||||||
#include <osmocom/core/select.h>
|
#include <osmocom/core/select.h>
|
||||||
|
@ -368,9 +369,9 @@ static int rtcp_mangle(struct msgb *msg, struct rtp_socket *rs)
|
||||||
}
|
}
|
||||||
if (rtph->type == RTCP_TYPE_SDES) {
|
if (rtph->type == RTCP_TYPE_SDES) {
|
||||||
char new_cname[255];
|
char new_cname[255];
|
||||||
strncpy(new_cname, inet_ntoa(rss->sin_local.sin_addr),
|
osmo_strlcpy(new_cname,
|
||||||
sizeof(new_cname));
|
inet_ntoa(rss->sin_local.sin_addr),
|
||||||
new_cname[sizeof(new_cname)-1] = '\0';
|
sizeof(new_cname));
|
||||||
rc = rtcp_sdes_cname_mangle(msg, rtph, &old_len,
|
rc = rtcp_sdes_cname_mangle(msg, rtph, &old_len,
|
||||||
new_cname);
|
new_cname);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include <osmocom/core/linuxlist.h>
|
#include <osmocom/core/linuxlist.h>
|
||||||
#include <osmocom/core/talloc.h>
|
#include <osmocom/core/talloc.h>
|
||||||
|
#include <osmocom/core/utils.h>
|
||||||
#include <osmocom/gsm/gsm0808.h>
|
#include <osmocom/gsm/gsm0808.h>
|
||||||
#include <osmocom/gsm/ipa.h>
|
#include <osmocom/gsm/ipa.h>
|
||||||
|
|
||||||
|
@ -129,15 +130,15 @@ static void update_called_number(struct gsm_mncc_number *called,
|
||||||
{
|
{
|
||||||
if (strncmp(chosen_number, "00", 2) == 0) {
|
if (strncmp(chosen_number, "00", 2) == 0) {
|
||||||
called->type = 1;
|
called->type = 1;
|
||||||
strncpy(called->number, chosen_number + 2, sizeof(called->number));
|
osmo_strlcpy(called->number, chosen_number + 2,
|
||||||
|
sizeof(called->number));
|
||||||
} else {
|
} else {
|
||||||
/* rewrite international to unknown */
|
/* rewrite international to unknown */
|
||||||
if (called->type == 1)
|
if (called->type == 1)
|
||||||
called->type = 0;
|
called->type = 0;
|
||||||
strncpy(called->number, chosen_number, sizeof(called->number));
|
osmo_strlcpy(called->number, chosen_number,
|
||||||
|
sizeof(called->number));
|
||||||
}
|
}
|
||||||
|
|
||||||
called->number[sizeof(called->number) - 1] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -73,7 +73,7 @@ static struct ms_state *find_alloc_ms(const char *imsi)
|
||||||
ms = find_ms(imsi);
|
ms = find_ms(imsi);
|
||||||
if (!ms) {
|
if (!ms) {
|
||||||
ms = talloc_zero(NULL, struct ms_state);
|
ms = talloc_zero(NULL, struct ms_state);
|
||||||
strncpy(ms->imsi, imsi, sizeof(ms->imsi)-1);
|
osmo_strlcpy(ms->imsi, imsi, sizeof(ms->imsi));
|
||||||
ms->ul._lbl[0] = ms->ul.label;
|
ms->ul._lbl[0] = ms->ul.label;
|
||||||
ms->dl._lbl[0] = ms->dl.label;
|
ms->dl._lbl[0] = ms->dl.label;
|
||||||
llist_add_tail(&ms->list, &g_st.ms_list);
|
llist_add_tail(&ms->list, &g_st.ms_list);
|
||||||
|
@ -88,7 +88,7 @@ static int handle_meas(struct msgb *msg)
|
||||||
struct ms_state *ms = find_alloc_ms(mfm->imsi);
|
struct ms_state *ms = find_alloc_ms(mfm->imsi);
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
|
|
||||||
strncpy(ms->name, mfm->name, sizeof(ms->imsi)-1);
|
osmo_strlcpy(ms->name, mfm->name, sizeof(ms->name));
|
||||||
memcpy(&ms->mr, &mfm->mr, sizeof(ms->mr));
|
memcpy(&ms->mr, &mfm->mr, sizeof(ms->mr));
|
||||||
ms->ul.last_update = now;
|
ms->ul.last_update = now;
|
||||||
if (ms->mr.flags & MEAS_REP_F_DL_VALID)
|
if (ms->mr.flags & MEAS_REP_F_DL_VALID)
|
||||||
|
|
|
@ -437,21 +437,15 @@ struct gtphub_peer_port *__wrap_gtphub_resolve_ggsn_addr(struct gtphub *hub,
|
||||||
" returning GGSN addr from imsi %s ni %s: %s\n",
|
" returning GGSN addr from imsi %s ni %s: %s\n",
|
||||||
imsi_str, apn_ni_str, gtphub_port_str(pp));
|
imsi_str, apn_ni_str, gtphub_port_str(pp));
|
||||||
|
|
||||||
if (imsi_str) {
|
if (!imsi_str)
|
||||||
strncpy(resolve_ggsn_got_imsi, imsi_str,
|
imsi_str = "(null)";
|
||||||
sizeof(resolve_ggsn_got_imsi));
|
osmo_strlcpy(resolve_ggsn_got_imsi, imsi_str,
|
||||||
resolve_ggsn_got_imsi[sizeof(resolve_ggsn_got_imsi) - 1] = '\0';
|
sizeof(resolve_ggsn_got_imsi));
|
||||||
}
|
|
||||||
else
|
|
||||||
strcpy(resolve_ggsn_got_imsi, "(null)");
|
|
||||||
|
|
||||||
if (apn_ni_str) {
|
if (!apn_ni_str)
|
||||||
strncpy(resolve_ggsn_got_ni, apn_ni_str,
|
apn_ni_str = "(null)";
|
||||||
sizeof(resolve_ggsn_got_ni));
|
osmo_strlcpy(resolve_ggsn_got_ni, apn_ni_str,
|
||||||
resolve_ggsn_got_ni[sizeof(resolve_ggsn_got_ni) - 1] = '\0';
|
sizeof(resolve_ggsn_got_ni));
|
||||||
}
|
|
||||||
else
|
|
||||||
strcpy(resolve_ggsn_got_ni, "(null)");
|
|
||||||
|
|
||||||
return pp;
|
return pp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2248,7 +2248,7 @@ static void test_ggsn_selection(void)
|
||||||
/* Create a context */
|
/* Create a context */
|
||||||
OSMO_ASSERT(count(gprs_llme_list()) == 0);
|
OSMO_ASSERT(count(gprs_llme_list()) == 0);
|
||||||
ctx = alloc_mm_ctx(local_tlli, &raid);
|
ctx = alloc_mm_ctx(local_tlli, &raid);
|
||||||
strncpy(ctx->imsi, imsi1, sizeof(ctx->imsi) - 1);
|
osmo_strlcpy(ctx->imsi, imsi1, sizeof(ctx->imsi));
|
||||||
|
|
||||||
/* Allocate and attach a subscriber */
|
/* Allocate and attach a subscriber */
|
||||||
s1 = gprs_subscr_get_or_create_by_mmctx(ctx);
|
s1 = gprs_subscr_get_or_create_by_mmctx(ctx);
|
||||||
|
@ -2273,7 +2273,7 @@ static void test_ggsn_selection(void)
|
||||||
pdp_data = sgsn_subscriber_pdp_data_alloc(s1->sgsn_data);
|
pdp_data = sgsn_subscriber_pdp_data_alloc(s1->sgsn_data);
|
||||||
pdp_data->context_id = 1;
|
pdp_data->context_id = 1;
|
||||||
pdp_data->pdp_type = 0x0121;
|
pdp_data->pdp_type = 0x0121;
|
||||||
strncpy(pdp_data->apn_str, "*", sizeof(pdp_data->apn_str)-1);
|
osmo_strlcpy(pdp_data->apn_str, "*", sizeof(pdp_data->apn_str));
|
||||||
|
|
||||||
/* Resolve GGSNs */
|
/* Resolve GGSNs */
|
||||||
|
|
||||||
|
@ -2326,7 +2326,7 @@ static void test_ggsn_selection(void)
|
||||||
|
|
||||||
/* Add PDP data entry to subscriber */
|
/* Add PDP data entry to subscriber */
|
||||||
|
|
||||||
strncpy(pdp_data->apn_str, "Test.Apn", sizeof(pdp_data->apn_str)-1);
|
osmo_strlcpy(pdp_data->apn_str, "Test.Apn", sizeof(pdp_data->apn_str));
|
||||||
|
|
||||||
tp.lv[GSM48_IE_GSM_APN].len =
|
tp.lv[GSM48_IE_GSM_APN].len =
|
||||||
gprs_str_to_apn(apn_enc, sizeof(apn_enc), "Test.Apn");
|
gprs_str_to_apn(apn_enc, sizeof(apn_enc), "Test.Apn");
|
||||||
|
|
Loading…
Reference in New Issue