Diffstat (limited to 'gammu/emb/gammu/smsd/smsdcore.c') (more/less context) (ignore whitespace changes)
-rw-r--r-- | gammu/emb/gammu/smsd/smsdcore.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/gammu/emb/gammu/smsd/smsdcore.c b/gammu/emb/gammu/smsd/smsdcore.c index cc9accc..e69a6e7 100644 --- a/gammu/emb/gammu/smsd/smsdcore.c +++ b/gammu/emb/gammu/smsd/smsdcore.c @@ -107,17 +107,17 @@ void SMSD_ReadConfig(char *filename, GSM_SMSDConfig *Config, bool log, char *ser memcpy(&s.Config,&smsdcfg,sizeof(GSM_Config)); error=GSM_SetDebugFile(s.Config[0].DebugFile, &di); } Config->PINCode=INI_GetValue(smsdcfgfile, "smsd", "PIN", false); if (Config->PINCode == NULL) { - if (log) WriteSMSDLog("No PIN code in %s file",filename); - fprintf(stderr,"No PIN code in %s file\n",filename); - exit(-1); + if (log) WriteSMSDLog("Warning: No PIN code in %s file",filename); + fprintf(stderr,"Warning: No PIN code in %s file\n",filename); + } else { + if (log) WriteSMSDLog("PIN code is \"%s\"",Config->PINCode); } - if (log) WriteSMSDLog("PIN code is \"%s\"",Config->PINCode); str = INI_GetValue(smsdcfgfile, "smsd", "commtimeout", false); if (str) Config->commtimeout=atoi(str); else Config->commtimeout = 1; str = INI_GetValue(smsdcfgfile, "smsd", "sendtimeout", false); if (str) Config->sendtimeout=atoi(str); else Config->sendtimeout = 10; str = INI_GetValue(smsdcfgfile, "smsd", "receivefrequency", false); @@ -214,22 +214,27 @@ bool SMSD_CheckSecurity(GSM_SMSDConfig *Config) /* No supported - do not check more */ if (error == ERR_NOTSUPPORTED) return true; /* If PIN, try to enter */ switch (SecurityCode.Type) { case SEC_Pin: - WriteSMSDLog("Trying to enter PIN"); - strcpy(SecurityCode.Code,Config->PINCode); - error=Phone->EnterSecurityCode(&s,SecurityCode); - if (error == ERR_SECURITYERROR) { - GSM_Terminate_SMSD("ERROR: incorrect PIN", error, true, -1); - } - if (error != ERR_NONE) { - WriteSMSDLog("Error entering PIN (%i)", error); + if (Config->PINCode==NULL) { + WriteSMSDLog("Warning: no PIN in config"); return false; - } + } else { + WriteSMSDLog("Trying to enter PIN"); + strcpy(SecurityCode.Code,Config->PINCode); + error=Phone->EnterSecurityCode(&s,SecurityCode); + if (error == ERR_SECURITYERROR) { + GSM_Terminate_SMSD("ERROR: incorrect PIN", error, true, -1); + } + if (error != ERR_NONE) { + WriteSMSDLog("Error entering PIN (%i)", error); + return false; + } + } break; case SEC_SecurityCode: case SEC_Pin2: case SEC_Puk: case SEC_Puk2: GSM_Terminate_SMSD("ERROR: phone requires not supported code type", 0, true, -1); |