summaryrefslogtreecommitdiff
path: root/src/libgsmd
diff options
context:
space:
mode:
authortick <tick@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-12-01 01:55:39 +0000
committertick <tick@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-12-01 01:55:39 +0000
commitd88e15979081740b86f48a78c81df56f5122a2c4 (patch)
tree1fb1484659cb51743726501c46d0e55edfefcc79 /src/libgsmd
parentf07e7027fe91ac71a8ab760f863c3a05a1d1499d (diff)
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
Diffstat (limited to 'src/libgsmd')
-rw-r--r--src/libgsmd/libgsmd_pin.c14
1 files changed, 7 insertions, 7 deletions
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;
personal git repositories of Harald Welte. Your mileage may vary