summaryrefslogtreecommitdiffabout
path: root/gammu/emb/gammu/smsd/smsdcore.c
Unidiff
Diffstat (limited to 'gammu/emb/gammu/smsd/smsdcore.c') (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/gammu/smsd/smsdcore.c31
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
@@ -110,11 +110,11 @@ void SMSD_ReadConfig(char *filename, GSM_SMSDConfig *Config, bool log, char *ser
110 110
111 Config->PINCode=INI_GetValue(smsdcfgfile, "smsd", "PIN", false); 111 Config->PINCode=INI_GetValue(smsdcfgfile, "smsd", "PIN", false);
112 if (Config->PINCode == NULL) { 112 if (Config->PINCode == NULL) {
113 if (log) WriteSMSDLog("No PIN code in %s file",filename); 113 if (log) WriteSMSDLog("Warning: No PIN code in %s file",filename);
114 fprintf(stderr,"No PIN code in %s file\n",filename); 114 fprintf(stderr,"Warning: No PIN code in %s file\n",filename);
115 exit(-1); 115 } else {
116 if (log) WriteSMSDLog("PIN code is \"%s\"",Config->PINCode);
116 } 117 }
117 if (log) WriteSMSDLog("PIN code is \"%s\"",Config->PINCode);
118 118
119 str = INI_GetValue(smsdcfgfile, "smsd", "commtimeout", false); 119 str = INI_GetValue(smsdcfgfile, "smsd", "commtimeout", false);
120 if (str) Config->commtimeout=atoi(str); else Config->commtimeout = 1; 120 if (str) Config->commtimeout=atoi(str); else Config->commtimeout = 1;
@@ -217,16 +217,21 @@ bool SMSD_CheckSecurity(GSM_SMSDConfig *Config)
217 /* If PIN, try to enter */ 217 /* If PIN, try to enter */
218 switch (SecurityCode.Type) { 218 switch (SecurityCode.Type) {
219 case SEC_Pin: 219 case SEC_Pin:
220 WriteSMSDLog("Trying to enter PIN"); 220 if (Config->PINCode==NULL) {
221 strcpy(SecurityCode.Code,Config->PINCode); 221 WriteSMSDLog("Warning: no PIN in config");
222 error=Phone->EnterSecurityCode(&s,SecurityCode);
223 if (error == ERR_SECURITYERROR) {
224 GSM_Terminate_SMSD("ERROR: incorrect PIN", error, true, -1);
225 }
226 if (error != ERR_NONE) {
227 WriteSMSDLog("Error entering PIN (%i)", error);
228 return false; 222 return false;
229 } 223 } else {
224 WriteSMSDLog("Trying to enter PIN");
225 strcpy(SecurityCode.Code,Config->PINCode);
226 error=Phone->EnterSecurityCode(&s,SecurityCode);
227 if (error == ERR_SECURITYERROR) {
228 GSM_Terminate_SMSD("ERROR: incorrect PIN", error, true, -1);
229 }
230 if (error != ERR_NONE) {
231 WriteSMSDLog("Error entering PIN (%i)", error);
232 return false;
233 }
234 }
230 break; 235 break;
231 case SEC_SecurityCode: 236 case SEC_SecurityCode:
232 case SEC_Pin2: 237 case SEC_Pin2: