rib: Update to properly handle optional ExpirationPeriod in RibRegister command

Change-Id: I9f18988f295a993e53dc03547f2f20967431dc10
Refs: #1772
diff --git a/tools/nfdc.cpp b/tools/nfdc.cpp
index a0e1c56..8578e43 100644
--- a/tools/nfdc.cpp
+++ b/tools/nfdc.cpp
@@ -228,8 +228,10 @@
     .setName(m_name)
     .setCost(m_cost)
     .setFlags(m_flags)
-    .setOrigin(m_origin)
-    .setExpirationPeriod(m_expires);
+    .setOrigin(m_origin);
+
+  if (m_expires != DEFAULT_EXPIRATION_PERIOD)
+    parameters.setExpirationPeriod(m_expires);
 
   if (!isValidUri(m_commandLineArguments[1])) {
     try { //So the uri is not valid, may be a faceId is provided.
@@ -261,10 +263,12 @@
     .setName(m_name)
     .setCost(m_cost)
     .setFlags(m_flags)
-    .setExpirationPeriod(m_expires)
     .setOrigin(m_origin)
     .setFaceId(faceCreateResult.getFaceId());
 
+  if (m_expires != DEFAULT_EXPIRATION_PERIOD)
+    ribParameters.setExpirationPeriod(m_expires);
+
   m_controller.start<RibRegisterCommand>(ribParameters,
                                          bind(&Nfdc::onSuccess, this, _1,
                                                 "Successful in name registration"),