Open Source Telephony
 help / color / mirror / Atom feed
From: ppessi@gmail.com
To: ofono@ofono.org
Subject: [PATCH 4/7] Network password has exactly 4 digits.
Date: Thu, 18 Mar 2010 16:44:28 +0200	[thread overview]
Message-ID: <1268923471-29059-4-git-send-email-ppessi@gmail.com> (raw)
In-Reply-To: <1268923471-29059-3-git-send-email-ppessi@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2372 bytes --]

From: Pekka Pessi <Pekka.Pessi@nokia.com>


Signed-off-by: Pekka Pessi <Pekka.Pessi@nokia.com>
---
 src/call-barring.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/call-barring.c b/src/call-barring.c
index eedb41d..f3252e1 100644
--- a/src/call-barring.c
+++ b/src/call-barring.c
@@ -360,6 +360,12 @@ static const char *cb_ss_service_to_fac(const char *svc)
 	return NULL;
 }
 
+/* Network password has exactly 4 digits */
+static inline int is_valid_password(const char *pass)
+{
+	return is_valid_pin(pass) && strlen(pass) == 4;
+}
+
 static gboolean cb_ss_control(int type, const char *sc,
 				const char *sia, const char *sib,
 				const char *sic, const char *dn,
@@ -403,7 +409,7 @@ static gboolean cb_ss_control(int type, const char *sc,
 	if (strlen(dn) > 0)
 		goto bad_format;
 
-	if (!is_valid_pin(sia))
+	if (!is_valid_password(sia))
 		goto bad_format;
 
 	switch (type) {
@@ -524,7 +530,7 @@ static gboolean cb_ss_passwd(const char *sc,
 	if (!fac)
 		return FALSE;
 
-	if (!is_valid_pin(old) || !is_valid_pin(new))
+	if (!is_valid_password(old) || !is_valid_password(new))
 		goto bad_format;
 
 	cb->pending = dbus_message_ref(msg);
@@ -855,7 +861,7 @@ static DBusMessage *cb_set_property(DBusConnection *conn, DBusMessage *msg,
 			return __ofono_error_invalid_args(msg);
 
 		dbus_message_iter_get_basic(&iter, &passwd);
-		if (!is_valid_pin(passwd))
+		if (!is_valid_password(passwd))
 			return __ofono_error_invalid_format(msg);
 	}
 
@@ -902,7 +908,7 @@ static DBusMessage *cb_disable_all(DBusConnection *conn, DBusMessage *msg,
 					DBUS_TYPE_INVALID) == FALSE)
 		return __ofono_error_invalid_args(msg);
 
-	if (!is_valid_pin(passwd))
+	if (!is_valid_password(passwd))
 		return __ofono_error_invalid_format(msg);
 
 	cb_set_query_bounds(cb, fac, FALSE);
@@ -950,10 +956,10 @@ static DBusMessage *cb_set_passwd(DBusConnection *conn, DBusMessage *msg,
 					DBUS_TYPE_INVALID) == FALSE)
 		return __ofono_error_invalid_args(msg);
 
-	if (!is_valid_pin(old_passwd))
+	if (!is_valid_password(old_passwd))
 		return __ofono_error_invalid_format(msg);
 
-	if (!is_valid_pin(new_passwd))
+	if (!is_valid_password(new_passwd))
 		return __ofono_error_invalid_format(msg);
 
 	cb->pending = dbus_message_ref(msg);
-- 
1.6.3.3


  reply	other threads:[~2010-03-18 14:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-18 14:44 [PATCH 1/7] Barring services can only be activated/deactivated ppessi
2010-03-18 14:44 ` [PATCH 2/7] Return newly-queried barring status ppessi
2010-03-18 14:44   ` [PATCH 3/7] Number of barring services is constant ppessi
2010-03-18 14:44     ` ppessi [this message]
2010-03-18 14:44       ` [PATCH 5/7] Interrogation of a barring does not require password ppessi
2010-03-18 14:44         ` [PATCH 6/7] Added call-barring-api.txt ppessi
2010-03-18 14:44           ` [PATCH 7/7] Fix: isimodem handling of call barring services ppessi
2010-03-18 16:51             ` Denis Kenzior
2010-03-18 17:38               ` Pekka Pessi
2010-03-18 17:50                 ` Denis Kenzior
2010-03-18 16:46           ` [PATCH 6/7] Added call-barring-api.txt Denis Kenzior
2010-03-18 16:44         ` [PATCH 5/7] Interrogation of a barring does not require password Denis Kenzior
2010-03-18 16:43       ` [PATCH 4/7] Network password has exactly 4 digits Denis Kenzior
2010-03-19 14:36         ` Pekka Pessi
2010-03-18 16:40     ` [PATCH 3/7] Number of barring services is constant Denis Kenzior
2010-03-18 16:39   ` [PATCH 2/7] Return newly-queried barring status Denis Kenzior
2010-03-18 16:11 ` [PATCH 1/7] Barring services can only be activated/deactivated Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1268923471-29059-4-git-send-email-ppessi@gmail.com \
    --to=ppessi@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox