From d88e15979081740b86f48a78c81df56f5122a2c4 Mon Sep 17 00:00:00 2001 From: tick Date: Sat, 1 Dec 2007 01:55:39 +0000 Subject: gsmd: Submitting a PIN for authentication needs to respond with status too.(Andrzej Zaborowski) git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@3545 99fdad57-331a-0410-800a-d7fa5415bdb3 --- src/libgsmd/libgsmd_pin.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/libgsmd') diff --git a/src/libgsmd/libgsmd_pin.c b/src/libgsmd/libgsmd_pin.c index 5ae6625..f99084a 100644 --- a/src/libgsmd/libgsmd_pin.c +++ b/src/libgsmd/libgsmd_pin.c @@ -55,7 +55,8 @@ const char *lgsm_pin_name(enum gsmd_pin_type ptype) return pin_type_names[ptype]; } -int lgsm_pin(struct lgsm_handle *lh, unsigned int type, char *pin, char *newpin) +int lgsm_pin(struct lgsm_handle *lh, unsigned int type, + const char *pin, const char *newpin) { int rc; struct { @@ -74,9 +75,7 @@ int lgsm_pin(struct lgsm_handle *lh, unsigned int type, char *pin, char *newpin) return -ENOMEM; gm->gp.type = type; - - gm->gp.pin[0] = '\0'; - strcat(gm->gp.pin, pin); + strcpy(gm->gp.pin, pin); switch (type) { case GSMD_PIN_SIM_PUK: @@ -84,10 +83,11 @@ int lgsm_pin(struct lgsm_handle *lh, unsigned int type, char *pin, char *newpin) /* GSM 07.07 explicitly states that only those two PUK types * require a new pin to be specified! Don't know if this is a * bug or a feature. */ - if (!newpin) + if (!newpin) { + free(gm); return -EINVAL; - gm->gp.newpin[0] = '\0'; - strcat(gm->gp.newpin, newpin); + } + strcpy(gm->gp.newpin, newpin); break; default: break; -- cgit v1.2.3